summaryrefslogtreecommitdiff
path: root/integrationtests/open_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrationtests/open_test.go')
-rw-r--r--integrationtests/open_test.go56
1 files changed, 56 insertions, 0 deletions
diff --git a/integrationtests/open_test.go b/integrationtests/open_test.go
index 917ce79..8dfbba6 100644
--- a/integrationtests/open_test.go
+++ b/integrationtests/open_test.go
@@ -34,3 +34,59 @@ func TestOpenByHandleAt(t *testing.T) {
},
})
}
+
+func TestOpenEnoent(t *testing.T) {
+ runScenario(t, "open-enoent", []ExpectedEvent{
+ {
+ PathContains: "enoentfile.txt",
+ Tracepoint: "enter_openat",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+}
+
+func TestOpenRdonlyWrite(t *testing.T) {
+ runScenario(t, "open-rdonly-write", []ExpectedEvent{
+ {
+ PathContains: "rdonlyfile.txt",
+ Tracepoint: "enter_openat",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ {
+ PathContains: "rdonlyfile.txt",
+ Tracepoint: "enter_write",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+}
+
+func TestOpenPidFilter(t *testing.T) {
+ h := newTestHarness(t)
+ result, pid, err := h.Run("open-pid-filter", defaultDuration)
+ if err != nil {
+ t.Fatalf("run scenario open-pid-filter: %v", err)
+ }
+
+ AssertNoUnexpectedPID(t, result, pid)
+ AssertNoUnexpectedComm(t, result, "ioworkload")
+
+ // Parent's file should be captured.
+ AssertEventsPresent(t, result, []ExpectedEvent{
+ {
+ PathContains: "parentfile.txt",
+ Tracepoint: "enter_openat",
+ Comm: "ioworkload",
+ MinCount: 1,
+ },
+ })
+
+ // Child's file should NOT be captured (different PID).
+ AssertEventsAbsent(t, result, []ExpectedEvent{
+ {
+ PathContains: "childfile.txt",
+ },
+ })
+}