Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pkgs/mcpx/internal/hooks/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ func TestDeclaredHookFiresOnMatchingKindsOnly(t *testing.T) {
!strings.Contains(string(body), `"hook":"rec"`) {
t.Fatalf("hook stdin payload wrong: %s", body)
}
st := r.Stats()
if len(st) != 1 || st[0].Fired != 1 || st[0].Failed != 0 {
t.Fatalf("stats wrong: %+v", st)
}
// The stats counter is recorded asynchronously after the hook
// process finishes; asserting it immediately races the recording
// under load (the second #2609 flake, seen in the full-system
// build). Poll the real postcondition.
waitFor(t, "hook stats to record the firing", func() bool {
st := r.Stats()
return len(st) == 1 && st[0].Fired == 1 && st[0].Failed == 0
})
}

func TestPythonModuleHookRuns(t *testing.T) {
Expand Down
Loading