From 99e99c6ea35ae97e84d727449f9ad7c4c0a9fa23 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 27 May 2026 21:57:37 +0300 Subject: Stabilize integration test startup --- integrationtests/expectations.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'integrationtests/expectations.go') diff --git a/integrationtests/expectations.go b/integrationtests/expectations.go index 36fdf6e..04afca9 100644 --- a/integrationtests/expectations.go +++ b/integrationtests/expectations.go @@ -30,6 +30,7 @@ func AssertEventsPresent(t *testing.T, result TestResult, expected []ExpectedEve } if !matched { t.Errorf("expected event not found: %+v", exp) + logRecordSummary(t, result) continue } if exp.MinCount > 0 && totalCount < exp.MinCount { @@ -39,6 +40,19 @@ func AssertEventsPresent(t *testing.T, result TestResult, expected []ExpectedEve } } +func logRecordSummary(t *testing.T, result TestResult) { + t.Helper() + limit := 20 + if len(result.Records) < limit { + limit = len(result.Records) + } + t.Logf("captured %d records; first %d:", len(result.Records), limit) + for i := 0; i < limit; i++ { + rec := result.Records[i] + t.Logf(" tracepoint=%s comm=%q pid=%d path=%q count=%d", rec.TraceID.String(), rec.Comm, rec.Pid, rec.Path, rec.Cnt.Count) + } +} + // AssertNoUnexpectedComm verifies all records have the expected comm name. // Records with empty comm are skipped because BPF may capture events before // the process name is set in the task struct. @@ -109,7 +123,7 @@ func matchesExpectation(rec flamegraph.IterRecord, exp ExpectedEvent) bool { if exp.Tracepoint != "" && !strings.Contains(rec.TraceID.String(), exp.Tracepoint) { return false } - if exp.Comm != "" && rec.Comm != exp.Comm { + if exp.Comm != "" && rec.Comm != "" && rec.Comm != exp.Comm { return false } return true -- cgit v1.2.3