-
Notifications
You must be signed in to change notification settings - Fork 29
TestRepeatedNetworkFlow checks that number of active connections is in expected range #2642
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
TestRepeatedNetworkFlow checks that number of active connections is in expected range #2642
Conversation
| // connections will be seen by the test. | ||
| ExpectedMinActive: 0, | ||
| ExpectedMaxActive: 2, | ||
| ExpectedInactive: 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that only cases with 4 connections have been observed, but 5 connections are possible. While I believe that the changes in #2641 are an improvement, they increase the chances of seeing 5 connections. That is because the changes made there make it more likely that if the connection is active at a scrape at t=0, it will be active at t=6, since the connections will actually be spaced 2 seconds apart rather than a bit more than 2 seconds.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2642 +/- ##
=======================================
Coverage 27.60% 27.60%
=======================================
Files 95 95
Lines 5422 5422
Branches 2523 2523
=======================================
Hits 1497 1497
Misses 3213 3213
Partials 712 712
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth adding to the commentaries, that the reason for this uncertainty is that we have information from both scraper and signals at the same time, and leave a TODO to add more tests for scraper/signals only without such uncertainty.
I have created a ticket for integration tests that use procfs only or syscalls only as the source of networking events. https://issues.redhat.com/browse/ROX-31753 The ticket explains why this is needed. A TODO with the ticket and this information has been added to |
Description
The TestRepeatedNetworkFlowWithZeroAfterglowPeriod fails frequently with errors such as
This test is currently too strict since the number of observed active connections cannot be guaranteed. While the connection is short lived it is still finite and not instantaneous. Therefore it is possible that the connection will be active during a scrape. This PR checks that the number of active connections observed is in an expected range, whereas currently there is an assert for a specific number of observed active connections.
If the error is that there are four close events reported for the connection, this test will still fail. It is possible that there is a race condition between getting the connection from procfs and syscalls. In one scrape interval the connection might be reported closed because it is obtained from a syscall and in the next scrape interval it might be reported closed, because it is obtained from procfs. The changes here don't fix that issue.
Future work includes tests that use procfs scrape only and syscalls only to get networking events, so that we know that both work independently https://issues.redhat.com/browse/ROX-31753
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
Ran the test locally.