Skip to content

Commit ec6e2dc

Browse files
committed
ignore server test if the error is EADDRINUSE
Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
1 parent eaf5d13 commit ec6e2dc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmds/cpud/serve_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ func TestListen(t *testing.T) {
6060
// e.g. no ipv4 or vsock
6161
continue
6262
}
63-
t.Errorf("Listen(%v, %v): err != nil", tt.network, tt.port)
63+
// If it is in use, not a lot to do.
64+
if errors.As(err, &sysErr) && sysErr.Err == syscall.EADDRINUSE {
65+
t.Logf("%s:%s is in use, so can not test; continuing", tt.network, tt.port)
66+
// e.g. no ipv4 or vsock
67+
continue
68+
}
69+
t.Errorf("Listen(%v, %v): got %v, want nil", tt.network, tt.port, err)
6470
continue
6571
}
6672
if ln == nil {

0 commit comments

Comments
 (0)