Commit 51e0cfb
authored
fix(ci-visibility): avoid Go FailNow teardown (#4717)
### What does this PR do?
Prevents Go CI Visibility from shutting down the tracer when a test or benchmark calls `FailNow`.
`testing.T.FailNow` and `testing.B.FailNow` stop the current test goroutine via `runtime.Goexit`; they do not end the whole test process. The previous CI Visibility wrappers and Orchestrion advice called `ExitCiVisibility()` from those paths, which could close the span pipeline mid-package and drop later test spans, retry attempts, and cleanup-created spans.
This PR removes the premature teardown from:
- `gotesting.T.FailNow`
- `gotesting.B.FailNow`
- Orchestrion instrumentation of `testing.common.FailNow`
The real process teardown paths are left unchanged: `M.Run`, signal handling, panic/re-panic paths, benchmark panic finalization, retry re-panic, and close actions still call `ExitCiVisibility()`.
It also adds regression coverage for direct wrappers and Orchestrion-instrumented tests, including fatal assertions, retries, benchmarks, and cleanup spans created after `FailNow`. No new dependency is introduced; module files are unchanged.
### Motivation
A customer reported that when any Go test called `FailNow`, `Fatal`, `Fatalf`, or `require.*`, subsequent tests in the package were silently missing from CI Visibility and ATR retry spans were not reported.
The root cause was that CI Visibility treated `FailNow` like a process exit, but Go only stops the current test or benchmark. Closing CI Visibility there loses spans that are created later in the same process.
### Testing
- [x] `go test ./internal/civisibility/integrations/gotesting/failnow -count=1`
- [x] `go test ./internal/civisibility/integrations/gotesting/... -count=1`
- [x] `cd internal/orchestrion/_integration && go run github.com/DataDog/orchestrion go test ./civisibility -count=1`
- [x] `cd internal/orchestrion/_integration && go run github.com/DataDog/orchestrion go test ./civisibility_failnow -count=1`
- [x] `cd internal/orchestrion/_integration && go run github.com/DataDog/orchestrion go test ./civisibility_failnow_retry -count=1`
- [x] `cd internal/orchestrion/_integration && go run github.com/DataDog/orchestrion go test ./civisibility_failnow_benchmark -run '^$' -bench . -benchtime=1x -count=1`
- [x] `go test ./internal/orchestrion/_integration/civisibilitytest`
- [x] `git diff --check`
- [x] Verified `go.mod` and `go.sum` are unchanged in both the root module and Orchestrion integration module.
Co-authored-by: tony.redondo <[email protected]>1 parent 86c0f03 commit 51e0cfb
9 files changed
Lines changed: 941 additions & 11 deletions
File tree
- internal
- civisibility/integrations/gotesting
- failnow
- orchestrion/_integration
- civisibility_failnow_benchmark
- civisibility_failnow_retry
- civisibility_failnow
- civisibilitytest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
0 commit comments