Skip to content

Git designed for AI agents.

praefect tests: a server stopped before it serves is stopped, not failed

Federico Elia5dbd090bb276
diff --git a/internal/praefect/testserver.go b/internal/praefect/testserver.go
index bd13ecf..522574c 100644
--- a/internal/praefect/testserver.go
+++ b/internal/praefect/testserver.go
@@ -295,7 +295,12 @@ func RunPraefectServer(
cancel()
<-replMgrDone
- require.NoError(tb, <-errQ)
+ // A test that stops the server right after starting it may stop it before the goroutine
+ // above calls Serve. Serve then closes the listener and returns ErrServerStopped, the
+ // outcome of the stop, as for newMockDownstream.
+ if err := <-errQ; !errors.Is(err, grpc.ErrServerStopped) {
+ require.NoError(tb, err)
+ }
require.NoError(tb, db.Close())
}