Skip to content

Commit

Permalink
test:clone: more namespace checks
Browse files Browse the repository at this point in the history
[ Upstream main 87ec91c ]

Signed-off-by: Djalal Harouni <[email protected]>
  • Loading branch information
tixxdz committed Jul 19, 2024
1 parent f5ddcc7 commit 6fd95c3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/sensors/tracing/kprobe_threads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
sm "github.com/cilium/tetragon/pkg/matchers/stringmatcher"
"github.com/cilium/tetragon/pkg/observer/observertesthelper"
"github.com/cilium/tetragon/pkg/reader/caps"
"github.com/cilium/tetragon/pkg/reader/namespace"
"github.com/cilium/tetragon/pkg/testutils"
tus "github.com/cilium/tetragon/pkg/testutils/sensors"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -92,12 +93,14 @@ spec:
cti.AssertPidsTids(t)

myCaps := ec.NewCapabilitiesChecker().FromCapabilities(caps.GetCurrentCapabilities())
myNs := ec.NewNamespacesChecker().FromNamespaces(namespace.GetCurrentNamespace())

parentCheck := ec.NewProcessChecker().
WithBinary(sm.Suffix("threads-tester")).
WithPid(cti.ParentPid).
WithTid(cti.ParentTid).
WithCap(myCaps)
WithCap(myCaps).
WithNs(myNs)

execCheck := ec.NewProcessExecChecker("").
WithProcess(parentCheck)
Expand All @@ -109,7 +112,8 @@ spec:
WithBinary(sm.Suffix("threads-tester")).
WithPid(cti.Child1Pid).
WithTid(cti.Child1Tid).
WithCap(myCaps)
WithCap(myCaps).
WithNs(myNs)

child1KpChecker := ec.NewProcessKprobeChecker("").
WithProcess(child1Checker).WithParent(parentCheck)
Expand All @@ -118,7 +122,8 @@ spec:
WithBinary(sm.Suffix("threads-tester")).
WithPid(cti.Thread1Pid).
WithTid(cti.Thread1Tid).
WithCap(myCaps)
WithCap(myCaps).
WithNs(myNs)

thread1KpChecker := ec.NewProcessKprobeChecker("").
WithProcess(thread1Checker).WithParent(parentCheck)
Expand Down

0 comments on commit 6fd95c3

Please sign in to comment.