Skip to content

pkg/sensors/tracing: fix LSM open tests #2698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions pkg/sensors/tracing/enforcer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func testSecurity(t *testing.T, tracingPolicy, tempFile string) {
}
}

func enforcerSecurityTempFile(t *testing.T) string {
func directWriteTempFile(t *testing.T) string {
// We can't use t.TempDir as it writes into /tmp by default.
// The direct-write-tester.c program opens and writes using the O_DIRECT
// flag that is unsupported and return EINVAL on tmpfs, while it works on a
Expand Down Expand Up @@ -341,7 +341,7 @@ func TestEnforcerSecuritySigKill(t *testing.T) {
t.Skip("Older kernels do not support matchArgs for more than one arguments")
}

tempFile := enforcerSecurityTempFile(t)
tempFile := directWriteTempFile(t)

tracingPolicy := `
apiVersion: cilium.io/v1alpha1
Expand Down Expand Up @@ -428,7 +428,7 @@ func TestEnforcerSecurityNotifyEnforcer(t *testing.T) {
t.Skip("Older kernels do not support matchArgs for more than one arguments")
}

tempFile := enforcerSecurityTempFile(t)
tempFile := directWriteTempFile(t)

tracingPolicy := `
apiVersion: cilium.io/v1alpha1
Expand Down
2 changes: 1 addition & 1 deletion pkg/sensors/tracing/lsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestLSMOpenFile(t *testing.T) {
defer cancel()

testBin := testutils.RepoRootPath("contrib/tester-progs/direct-write-tester")
tempFile := t.TempDir() + "/test"
tempFile := directWriteTempFile(t)

configHook := `
apiVersion: cilium.io/v1alpha1
Expand Down
Loading