Adding back some tests in guardian

This commit is contained in:
DanB
2017-03-19 19:03:22 +01:00
parent ea8c50b490
commit b9be89d8f6

View File

@@ -141,16 +141,13 @@ func TestGuardianGuardIDs(t *testing.T) {
if len(Guardian.locksMap) != 3 {
t.Errorf("locksMap should be have 3 elements, have: %+v", Guardian.locksMap)
}
/*
// Only good for debugging since there is duration involved failing often, last test is more relevant for operations on counters
for _, lkID := range lockIDs {
if itmLock, hasKey := Guardian.locksMap[lkID]; !hasKey {
t.Errorf("Cannot find lock for lockID: %s", lkID)
} else if cnt := atomic.LoadInt64(&itmLock.cnt); cnt != 1 {
t.Errorf("Unexpected counter: %d for itmLock with id %s", cnt, lkID)
}
for _, lkID := range lockIDs {
if itmLock, hasKey := Guardian.locksMap[lkID]; !hasKey {
t.Errorf("Cannot find lock for lockID: %s", lkID)
} else if cnt := atomic.LoadInt64(&itmLock.cnt); cnt != 1 {
t.Errorf("Unexpected counter: %d for itmLock with id %s", cnt, lkID)
}
*/
}
Guardian.RUnlock()
Guardian.UnguardIDs(lockIDs...)
time.Sleep(time.Duration(50) * time.Millisecond)