Skip to content

Commit

Permalink
tetragon: Cleanup tgids array before another round of events iteration
Browse files Browse the repository at this point in the history
We might not get all events immediately on the first events iteration,
so there needs to be another round.

In that case we need to zero tgids array and return an error, so the
checker knows we failed and starts another events iteration.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
olsajiri committed Oct 11, 2023
1 parent 08b79a9 commit 312becd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/sensors/exec/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,13 @@ func TestEventExitThreads(t *testing.T) {
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 !assert.True(t, used, "did not see exit event for pid %d", pid) {
// Cleanup the 'seen' tgids, because we are starting over
for pid := range tgids {
tgids[pid] = false
}
return fmt.Errorf("final check failed")
}
}
return nil
}
Expand Down

0 comments on commit 312becd

Please sign in to comment.