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

fix(tests): return SCAP_TIMEOUT instead of an SCAP_EOF #1514

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

Andreagit97
Copy link
Member

What type of PR is this?

/kind bug

Any specific area of the project related to this PR?

/area tests

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

When the engine test doesn't produce any events but receives events from an async plugin the events in the queue are never processed because the test engine in fetch_next_event will always return SCAP_EOF and so the events will be never dequeued...

	int32_t res = SCAP_SUCCESS;
	if (m_delayed_scap_evt.empty())
	{
		res = m_delayed_scap_evt.next(m_h);
	}

	if (res == SCAP_TIMEOUT &&
		!m_async_events_queue.empty() && m_async_events_queue.try_pop(m_async_evt))
	{
		evt = m_async_evt.get();
		if(evt->m_pevt->ts == (uint64_t) -1)
		{
			evt->m_pevt->ts = get_new_ts();
		}
		return SCAP_SUCCESS;
	}

Moreover SCAP_TIMEOUT seems a more reasonable value to return than SCAP_EOF

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Nov 27, 2023

LGTM label has been added.

Git tree hash: ea8897beee951df9cb99310f028818d64e7fcccb

@poiana
Copy link
Contributor

poiana commented Nov 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, FedeDP, jasondellaluce

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Andreagit97,FedeDP,jasondellaluce]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 041477e into falcosecurity:master Nov 27, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants