Add additional error checking for server startup

This commit is contained in:
David Dworken 2023-11-19 06:36:49 -08:00
parent 30b5478104
commit b928ff642f
No known key found for this signature in database

View File

@ -271,6 +271,10 @@ func RunTestServer() func() {
go func() {
_ = cmd.Wait()
}()
expectedSuffix := "Listening on :8080\n"
if !strings.HasSuffix(stdout.String(), expectedSuffix) {
panic(fmt.Errorf("expected server stdout to end with %#v, but it doesn't: %#v", expectedSuffix, stdout.String()))
}
return func() {
err := cmd.Process.Kill()
if err != nil && err.Error() != "os: process already finished" {