From d57037273c14a99cb27d0a4af55d3e1da1415626 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Tue, 3 Oct 2023 23:30:17 +0100 Subject: [PATCH] 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. --- internal/localrpc/client_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/localrpc/client_test.go b/internal/localrpc/client_test.go index 055bccb..e704a52 100644 --- a/internal/localrpc/client_test.go +++ b/internal/localrpc/client_test.go @@ -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)