Skip to content

Conversation

@kevsecurity
Copy link
Contributor

The test infrastructure that monitors the ring buffers and handles events during tests does not mirror how tetragon does this in production. When monitoring events for real, we have an event cache channel that the ring buffer monitors write to, and the event handler reads from. This means that events are handled sequentially.

In the test infrastructure, the ring buffer monitors handle the events directly, resulting in two events able to be handle concurrently, which causes problems. This commit introduces an event cache to the test infrastructure and uses that to handle events sequentially, avoiding the problem.

@kevsecurity kevsecurity added the release-note/misc This PR makes changes that have no direct user impact. label Nov 4, 2025
@netlify
Copy link

netlify bot commented Nov 4, 2025

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 68c069e
🔍 Latest deploy log https://app.netlify.com/projects/tetragon/deploys/690a36e488e6cc00085a5421
😎 Deploy Preview https://deploy-preview-4291--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

The test infrastructure that monitors the ring buffers and handles
events during tests does not mirror how tetragon does this in
production. When monitoring events for real, we have an event cache
channel that the ring buffer monitors write to, and the event handler
reads from. This means that events are handled sequentially.

In the test infrastructure, the ring buffer monitors handle the events
directly, resulting in two events able to be handle concurrently, which
causes problems. This commit introduces an event cache to the test
infrastructure and uses that to handle events sequentially, avoiding the
problem.

Signed-off-by: Kevin Sheldrake <[email protected]>
@kevsecurity kevsecurity force-pushed the pr/kevsecurity/handle-test-events-sequentially branch from e7ab737 to 68c069e Compare November 4, 2025 17:24
@kevsecurity kevsecurity marked this pull request as ready for review November 4, 2025 18:20
@kevsecurity kevsecurity requested a review from a team as a code owner November 4, 2025 18:20
@kevsecurity
Copy link
Contributor Author

ARM failure is a known issue.

errChan <- fmt.Errorf("error loop event function returned: %w", err)
break
}
if complChecker.Done() || ctxPerfRing.Err() != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there is a ctxPerfRing error? Do we propagate it to the test somehow?
The benefit of having t *testing.T is that we can just fail the test, but we do not seem to be doing that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use ctxPerfRing only to indicate that we are done. I don't think we need to propagate any errors. What errors did you have in mind?

errChan <- fmt.Errorf("error loop event function returned: %w", err)
break
}
if complChecker.Done() || ctxBPFRing.Err() != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly for this error here.

@kevsecurity kevsecurity requested a review from kkourt November 18, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants