next.js
10f370c1 - test: stabilize OpenTelemetry collector lifecycle (#98427)

Commit
2 days ago
test: stabilize OpenTelemetry collector lifecycle (#98427) ## What? Stabilize the OpenTelemetry instrumentation e2e suite by keeping its local span collector available for each application's full lifetime. Reset collected span state between tests without closing the collector, and cover continuity across a test boundary. ## Why? The suite kept Next.js and custom-server exporters alive across tests while closing and rebinding their collector port after every test. Exports during that gap failed with closed/reset/refused socket errors before trace assertions timed out or observed incomplete trees. Aligning the collector lifetime with the exporter removes that race instead of masking it with retries, longer timeouts, or weaker assertions. ## How? - Start the collector before starting each managed application. - Keep the listener bound until application teardown, while clearing only buffered spans in `beforeEach`. - Replace per-test collector reconnects across the affected suites and remove the disabled-fetch suite's fixed teardown delay. - Assert that one collector remains connected, resets its state, and receives a fresh trace across sequential tests. ## Verification - Webpack dev / React 18.3.1: 5 consecutive focused runs, 54 tests passed per run - Webpack start / React 18.3.1: 5 consecutive focused runs, 97 passed and 13 existing skips per run - `pnpm test-types` - Prettier and ESLint on the changed files <!-- NEXT_JS_LLM --> <!-- fleet c7f6c6e4-56b2-4648-bc2d-88b2f256bb7a --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading