Skip to content

Commit 2d3eb0a

Browse files
author
Aaron Schlesinger
committed
fix(pkg/sshd/server_test.go): create and use convenience vars
1 parent 29153ef commit 2d3eb0a

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

pkg/sshd/server_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,22 @@ func TestConcurrentPushSameRepo(t *testing.T) {
172172
for i := 0; i < numPushers; i++ {
173173
select {
174174
case sessOut := <-outCh:
175-
if sessOut.outStr != multiPushLine && sessOut.outStr != "OK" {
176-
t.Fatalf("expected 'OK' or '%s', but got '%s' (error '%s')", multiPushLine, sessOut.outStr, sessOut.err)
175+
output := sessOut.outStr
176+
err := sessOut.err
177+
if output != multiPushLine && output != "OK" {
178+
t.Fatalf("expected 'OK' or '%s', but got '%s' (error '%s')", multiPushLine, output, err)
177179
}
178180

179-
if sessOut.outStr == "OK" && sessOut.err != nil {
180-
t.Fatalf("found 'OK' output with an error %s", err)
181+
if sessOut.err != nil {
182+
t.Fatalf("found '%s' output with an error '%s'", output, err)
181183
}
182184

183-
if !foundOK && sessOut.outStr == "OK" {
185+
if !foundOK && output == "OK" {
184186
foundOK = true
185-
} else if sessOut.outStr == "OK" {
186-
t.Fatalf("found second OK when shouldn't have")
187+
} else if output == "OK" {
188+
t.Fatalf("found second 'OK' when shouldn't have")
187189
}
190+
188191
case <-time.After(to):
189192
t.Fatalf("didn't receive an output within %s", to)
190193
}

0 commit comments

Comments
 (0)