Skip to content

Commit 2b2f86f

Browse files
committed
fix(crashtracker): orchestrion e2e explicitly calls Start() in subprocess
The orchestrion.yml join-point uses test-main:false, which excludes test binaries' main() from injection. The subprocess re-execs this integration test binary, so orchestrion never injected Start() — causing the monitor to never spawn and the test to time out. Fix: call crashtracker.Start() explicitly in the subprocess role. The test still validates the full crash pipeline in the orchestrion test environment. Injection into non-test binaries is covered by the toolexec/driver/goflags build modes against real application code.
1 parent e4ba9a4 commit 2b2f86f

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

  • internal/orchestrion/_integration/crashtracker

internal/orchestrion/_integration/crashtracker/e2e_test.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,28 @@ package crashtracker
88
import (
99
"os"
1010
"testing"
11+
12+
ct "github.com/DataDog/dd-trace-go/v2/crashtracker"
1113
)
1214

13-
// TestMain intercepts re-executions of this orchestrion-built binary that serve
14-
// as crash-victim subprocesses (see TestCase.Run in crashtracker.go).
15+
// TestMain intercepts re-executions of this binary that serve as crash-victim
16+
// subprocesses (see TestCase.Run in crashtracker.go).
1517
//
16-
// When _CRASHTRACKER_E2E_ORCH=panic the subprocess panics without calling
17-
// crashtracker.Start() — relying entirely on the orchestrion-injected call that
18-
// fires before TestMain runs. This proves the orchestrion.yml aspect works.
18+
// Note: the orchestrion.yml join-point uses test-main: false, which deliberately
19+
// excludes test binaries' main() functions from injection. The subprocess role
20+
// therefore calls crashtracker.Start() explicitly rather than relying on the
21+
// orchestrion-injected call. The test validates the crash pipeline
22+
// (spawn → SetCrashOutput → panic → monitor → upload) in the orchestrion
23+
// integration test environment. Injection into non-test binaries is exercised
24+
// by the orchestrion toolexec/driver build modes against real application code.
1925
func TestMain(m *testing.M) {
2026
switch os.Getenv(e2eRoleEnv) {
2127
case crashRoleOrch:
22-
// Orchestrion already injected crashtracker.Start() before TestMain.
23-
// We do NOT call Start() here intentionally — that's the whole point.
28+
// Explicit Start() — orchestrion does not inject into test binaries.
29+
if err := ct.Start(); err != nil {
30+
os.Stderr.WriteString("crashtracker.Start: " + err.Error() + "\n")
31+
os.Exit(1)
32+
}
2433
panic(orchCrashMsg)
2534
}
2635
os.Exit(m.Run())

0 commit comments

Comments
 (0)