1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

localrpc test: Don't call t.Fatal from a goroutine

The testing package does not allow t.Fatal to be called from a different
goroutine; however, we do that if the testing server fails listen or
accept connections.

Since that is unexpected and rare, this patch turns those calls into
panics.
This commit is contained in:
Alberto Bertogli
2023-10-03 23:30:17 +01:00
parent 74e7c96031
commit d57037273c

View File

@@ -15,13 +15,13 @@ func NewFakeServer(t *testing.T, path, output string) {
t.Helper()
lis, err := net.Listen("unix", path)
if err != nil {
t.Fatal(err)
panic(err)
}
for {
conn, err := lis.Accept()
if err != nil {
t.Fatal(err)
panic(err)
}
t.Logf("FakeServer %v: accepted ", conn)