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:
@@ -15,13 +15,13 @@ func NewFakeServer(t *testing.T, path, output string) {
|
|||||||
t.Helper()
|
t.Helper()
|
||||||
lis, err := net.Listen("unix", path)
|
lis, err := net.Listen("unix", path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
conn, err := lis.Accept()
|
conn, err := lis.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
t.Logf("FakeServer %v: accepted ", conn)
|
t.Logf("FakeServer %v: accepted ", conn)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user