From 4bdb0505635e66e07aa7edd9d1f842f860aa581c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 23 Feb 2026 13:23:23 +0200 Subject: tests: cover durationToPrev gap semantics --- integrationtests/open_test.go | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'integrationtests/open_test.go') diff --git a/integrationtests/open_test.go b/integrationtests/open_test.go index dae5244..c2a0366 100644 --- a/integrationtests/open_test.go +++ b/integrationtests/open_test.go @@ -1,6 +1,9 @@ package integrationtests -import "testing" +import ( + "strings" + "testing" +) func TestOpenBasic(t *testing.T) { runScenario(t, "open-basic", []ExpectedEvent{ @@ -93,3 +96,32 @@ func TestOpenPidFilter(t *testing.T) { }, }) } + +func TestOpenDurationGap(t *testing.T) { + h := newTestHarness(t) + result, pid, err := h.Run("open-duration-gap", defaultDuration) + if err != nil { + t.Fatalf("run scenario open-duration-gap: %v", err) + } + + AssertNoUnexpectedPID(t, result, pid) + AssertNoUnexpectedComm(t, result, "ioworkload") + + // We intentionally sleep 800ms between first and second openat. + const minGapNs = uint64(500 * 1_000_000) + + for _, rec := range result.Records { + if !strings.Contains(rec.TraceID.String(), "enter_openat") { + continue + } + if !strings.Contains(rec.Path, "gap-second.txt") { + continue + } + if rec.Cnt.DurationToPrev < minGapNs { + t.Fatalf("durationToPrev for second openat = %d ns, want >= %d ns", rec.Cnt.DurationToPrev, minGapNs) + } + return + } + + t.Fatalf("did not find second openat record for gap-second.txt") +} -- cgit v1.2.3