configure_port_test.go: don't panic when error is not what we expected

This commit is contained in:
Adrien Delorme 2019-09-05 15:51:14 +02:00
parent 368d39cadf
commit 7ba91b7d25
1 changed files with 5 additions and 1 deletions

View File

@ -72,7 +72,11 @@ func TestListenRangeConfig_Listen(t *testing.T) {
l.Close()
t.Fatalf("port should be taken, this should timeout.")
}
if p := int(err.(ErrPortFileLocked)); p != lockedListener.Port {
portErr, ok := err.(ErrPortFileLocked)
if !ok {
t.Fatalf("unexpected error: %v", err)
}
if p := int(portErr); p != lockedListener.Port {
t.Fatalf("wrong fileport: %d", p)
}
cancel()