docker / libkv

Distributed key/value store abstraction library
Apache License 2.0
854 stars 205 forks source link

Add a test for Lock Waits #187

Closed jlhawn closed 6 years ago

jlhawn commented 6 years ago

Added a test case for consul and etcd which asserts that clients correctly block if the lock key is already held by another client. It also tests that the waiting client unblocks once the lock is released.

jlhawn commented 6 years ago

This PR shows that there is a bug in the etcd lock code because the new LockWait test case fails against the etcd package:

--- FAIL: TestEtcdStore (24.45s)

    --- PASS: TestEtcdStore/Common (0.34s)

        --- PASS: TestEtcdStore/Common/PutGetDeleteExists (0.32s)

        --- PASS: TestEtcdStore/Common/List (0.01s)

        --- PASS: TestEtcdStore/Common/DeleteTree (0.01s)

    --- PASS: TestEtcdStore/Atomic (0.02s)

        --- PASS: TestEtcdStore/Atomic/Put (0.01s)

        --- PASS: TestEtcdStore/Atomic/PutCreate (0.01s)

        --- PASS: TestEtcdStore/Atomic/PutWithSlashSuffixKey (0.00s)

        --- PASS: TestEtcdStore/Atomic/Delete (0.01s)

    --- PASS: TestEtcdStore/Watch (0.51s)

    --- PASS: TestEtcdStore/WatchTree (0.51s)

    --- PASS: TestEtcdStore/Lock (0.01s)

    --- PASS: TestEtcdStore/LockTTL (10.01s)

    --- FAIL: TestEtcdStore/LockWait (10.00s)

    --- PASS: TestEtcdStore/PutTTL (3.01s)

FAIL

FAIL    github.com/docker/libkv/store/etcd  24.472s

There is a fix for this in this PR: https://github.com/docker/libkv/pull/186

vieux commented 6 years ago

closed by #186