You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Darling tests: a test-only read route leaks into other test classes running at the same time #4782
Dev CI failed at d85dc2f, in the Darling PG tests (2) job. One test failed: DarlingCustomViewsTests.CatalogDescriptors_Keys_EqualTheReadDispatchKeys, with "reads with no catalog descriptor: __test_statement_timeout" (DarlingCustomViewsTests.cs:169). That route name belongs to another test class. It is not a real read.
Why
DarlingWebEndpoints.s_testOnlyExtraDispatchEntry (DarlingWebEndpoints.cs:88) is a plain static field. BuildReadDispatch adds its entry whenever it is set (DarlingWebEndpoints.cs:3551).
ReadLatencyWebRecordingTests.ADispatchEntryThatThrowsA57014PostgresException_RecordsOneWebSample_WithOutcomeTimeout sets it while the test runs. That class is in the live-postgres collection, so this only happens on the PostgreSQL CI jobs.
About ten other test classes call BuildReadDispatch() and are not in that collection, so they can run at the same time. Any of them can see the extra entry. DarlingCustomViewsTests compares the dispatch keys with the Custom Views catalog, so it fails when that happens.
Fix
Make the field an AsyncLocal, so only the test that sets it, and the code that test awaits, sees the extra entry. The test builds its web server inside the scope that sets the entry, so its own server still gets the entry. This fixes every reader at once, with no change to test collections. Keep every assertion in both classes.
Test that must fail first
A test sets the entry, then calls BuildReadDispatch() from a flow that does not inherit it (under ExecutionContext.SuppressFlow()), and asserts that the entry is absent. With the plain static field, the test fails.
Activity
Darling tests: a test-only read route no longer leaks into other test…
Tests: keep the seat-census comment's older lines as they were when a…
Read latency: each web server records into its own accumulator, and r…