ci: wait for the collector close bound in TestRun (#2665)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-10 20:58:55 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 05f34fd135
commit 839d32c7d5
+4 -1
View File
@@ -102,10 +102,13 @@ func TestRun(t *testing.T) {
}()
t.Cleanup(func() {
// run closes the collectors before it returns. That takes milliseconds,
// but native teardown (PDH, MI) can stall on a loaded CI runner, so
// wait for the bound closeCollection enforces.
select {
case exitCode := <-exitCodeCh:
require.Equal(t, tc.exitCode, exitCode)
case <-time.After(2 * time.Second):
case <-time.After(collectionCloseTimeout + 5*time.Second):
t.Fatalf("timed out waiting for exit code, want %d", tc.exitCode)
}
})