Skip to content

Commit 51e0cfb

Browse files
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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ static-analysis.datadog.yml
2828
coverage-*.txt
2929

3030
# Editors and Agents
31+
/.codex/
3132
/.cursor
3233
/.vscode
3334
/.claude/*

0 commit comments

Comments
 (0)