Skip to content
Snippets Groups Projects
Commit 8ff88f52 authored by Lukas Braun's avatar Lukas Braun
Browse files

goatherd_test: Check if userlocks entry exists before (un-)locked

parent 2708e349
No related branches found
No related tags found
No related merge requests found
...@@ -278,8 +278,8 @@ func handleConnT(t *testing.T) { ...@@ -278,8 +278,8 @@ func handleConnT(t *testing.T) {
if answer != "" { if answer != "" {
t.Error("answer:", answer) t.Error("answer:", answer)
} }
if faildelay.userlocks["dummy user"] != nil { if _, ok := faildelay.userlocks["dummy user"]; ok {
t.Error("userlock created for dummy user") t.Error("userlock entry created for dummy user")
} }
}) })
...@@ -296,8 +296,10 @@ func handleConnT(t *testing.T) { ...@@ -296,8 +296,10 @@ func handleConnT(t *testing.T) {
if answer != "FAIL" { if answer != "FAIL" {
t.Error("answer:", answer) t.Error("answer:", answer)
} }
if faildelay.userlocks[username] == nil { if ul, ok := faildelay.userlocks[username]; !ok {
t.Error("userlock not in map") t.Error("no entry in userlocks")
} else if ul != delay {
t.Error("entry in userlocks is not the returned lock")
} }
}) })
...@@ -311,7 +313,9 @@ func handleConnT(t *testing.T) { ...@@ -311,7 +313,9 @@ func handleConnT(t *testing.T) {
if delay != nil { if delay != nil {
t.Fail() t.Fail()
} }
if *faildelay.userlocks[username] != unlocked { if ul, ok := faildelay.userlocks[username]; !ok {
t.Error("no entry in userlocks")
} else if *ul != unlocked {
t.Error("userlock not unlocked") t.Error("userlock not unlocked")
} }
if answer != "OK" { if answer != "OK" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment