Skip to content

Commit

Permalink
test: add test for event net_tcp_connect
Browse files Browse the repository at this point in the history
  • Loading branch information
rscampos committed Feb 4, 2025
1 parent 9536f42 commit a04682f
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/integration/event_filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,50 @@ func Test_EventFilters(t *testing.T) {
coolDown: 0,
test: ExpectAllInOrderSequentially,
},
{
name: "comm: event: trace events from nc command for net_tcp_connect event",
policyFiles: []testutils.PolicyFileWithID{
{
Id: 1,
PolicyFile: v1beta1.PolicyFile{
Metadata: v1beta1.Metadata{
Name: "net-event-1",
},
Spec: k8s.PolicySpec{
Scope: []string{
"comm=nc",
},
DefaultActions: []string{"log"},
Rules: []k8s.Rule{
{
Event: "net_tcp_connect",
Filters: []string{},
},
},
},
},
},
},
cmdEvents: []cmdEvents{
newCmdEvents(
"nc 127.0.0.1 7777",
100*time.Millisecond,
1*time.Second,
[]trace.Event{
expectEvent(
anyHost, "nc", testutils.CPUForTests, anyPID, 0,
events.NetTCPConnect, orPolNames("net-event-1"), orPolIDs(1),
expectArg("dst", "127.0.0.1"),
expectArg("dst_port", int32(7777)),
),
},
[]string{},
),
},
useSyscaller: false,
coolDown: 0,
test: ExpectAtLeastOneForEach,
},
{
name: "comm: trace only events from from ls and who commands in multiple policies",
policyFiles: []testutils.PolicyFileWithID{
Expand Down

0 comments on commit a04682f

Please sign in to comment.