Skip to content

Commit 670993d

Browse files
authored
fix: ensure conformance test server logs are printed when validation fails (#110)
Shutdown the server on failure before attempting to print errors so that any log flushing that happens during shutdown can be run.
1 parent 1a90e62 commit 670993d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

client/validate.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,20 @@ func (v validator) runValidation() error {
8282
log.Printf("Validating for %s...", *functionType)
8383

8484
shutdown, err := v.funcServer.Start(v.stdoutFile, v.stderrFile, v.functionOutputFile)
85-
if shutdown != nil {
86-
defer shutdown()
87-
}
88-
8985
if err != nil {
9086
return v.errorWithLogsf("unable to start server: %v", err)
9187
}
88+
if shutdown == nil {
89+
shutdown = func() {}
90+
}
9291

9392
if err := v.validate("http://localhost:8080"); err != nil {
93+
// shutdown to ensure all the logs are flushed
94+
shutdown()
9495
return v.errorWithLogsf("validation failure: %v", err)
9596
}
97+
98+
shutdown()
9699
return nil
97100
}
98101

0 commit comments

Comments
 (0)