Skip to content
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

tetragon: Cleanup tgids array before another round of events iteration #1581

Merged
merged 1 commit into from
Oct 11, 2023
Merged
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
15 changes: 14 additions & 1 deletion pkg/sensors/exec/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,22 @@ func TestEventExitThreads(t *testing.T) {
}
}

var seenAll bool

finalCheck := func(l *logrus.Logger) error {
// Make sure we saw all pids
for pid, used := range tgids {
assert.True(t, used, "did not see exit event for pid %d", pid)
if !used {
t.Logf("Did not see exit event for pid %d", pid)

// Cleanup the 'seen' tgids for one more events iteration
for pid := range tgids {
tgids[pid] = false
}
return fmt.Errorf("final check failed")
}
}
seenAll = true
return nil
}

Expand All @@ -226,6 +237,8 @@ func TestEventExitThreads(t *testing.T) {

err = jsonchecker.JsonTestCheck(t, checker)
assert.NoError(t, err)

assert.True(t, seenAll, "did not see all exit events")
}

func TestEventExecve(t *testing.T) {
Expand Down