mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-17 01:59:04 +02:00
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:
co-authored by
Claude Opus 5.5
parent
05f34fd135
commit
839d32c7d5
@@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user