fix conditions

This commit is contained in:
Mike Zozu 2020-03-15 00:53:10 +03:00 committed by Fedor Korotkiy
parent d3877a13e5
commit 669faec71c

View file

@ -67,8 +67,8 @@ func TestKeyLock_DeadlockFree(t *testing.T) {
defer wg.Done() defer wg.Done()
for i := 0; i < N; i++ { for i := 0; i < N; i++ {
locked, unlock := l.LockKeys(keys, nil) cancelled, unlock := l.LockKeys(keys, nil)
if !locked { if cancelled {
t.Error("spurious lock failure") t.Error("spurious lock failure")
return return
} }
@ -100,8 +100,8 @@ func TestKeyLock_SingleKeyStress(t *testing.T) {
defer wg.Done() defer wg.Done()
for i := 0; i < N; i++ { for i := 0; i < N; i++ {
locked, unlock := l.LockKeys([]string{"a"}, timeout(time.Millisecond)) cancelled, unlock := l.LockKeys([]string{"a"}, timeout(time.Millisecond))
if locked { if !cancelled {
unlock() unlock()
} }
} }