When there is a timeout, we try to generate a timeout report by printing what timed out. There is a race in this logic which sometimes results in CI failures like this:
--- FAIL: TestAppStart/Timeout (0.01s)
9 app_test.go:905:
10 Error Trace: app_test.go:905
11 Error: "OnStart hook added by failed: context deadline exceeded" does not contain "OnStart hook added by go.uber.org/fx_test.TestAppStart.func1.1 failed: context deadline exceeded"
12 Test: TestAppStart/Timeout
13 FAIL
We can actually repro this pretty easily by changing the timeout in TestAppStart/Timeout to 1 nanosecond:
context.WithTimeout(context.Background(), time.Nanosecond)
fx ➤ make test git:master*
--- FAIL: TestAppStart (0.00s)
--- FAIL: TestAppStart/Timeout (0.00s)
app_test.go:905:
Error Trace: app_test.go:905
Error: "OnStart hook added by failed: context deadline exceeded" does not contain "OnStart hook added by go.uber.org/fx_test.TestAppStart.func1.1 failed: context deadline exceeded"
Test: TestAppStart/Timeout
When there is a timeout, we try to generate a timeout report by printing what timed out. There is a race in this logic which sometimes results in CI failures like this:
We can actually repro this pretty easily by changing the timeout in TestAppStart/Timeout to 1 nanosecond: