-
Notifications
You must be signed in to change notification settings - Fork 416
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
Possible bug in Test_EventFilters when a case has many cmdEvent
and each cmdEvent
has different number of expectEvent
.
#4255
Comments
@canoriz thanks, I'm going to check your suggestion. |
geyslan
added a commit
to geyslan/tracee
that referenced
this issue
Sep 17, 2024
ExpectAllInOrderSequentially might try to access an index out of range depending on the number of events that are being checked. More about in issue aquasecurity#4255.
geyslan
added a commit
to geyslan/tracee
that referenced
this issue
Sep 25, 2024
ExpectAllInOrderSequentially might try to access an index out of range depending on the number of events that are being checked. More about in issue aquasecurity#4255.
geyslan
added a commit
to geyslan/tracee
that referenced
this issue
Sep 25, 2024
ExpectAllInOrderSequentially might try to access an index out of range depending on the number of events that are being checked. More about in issue aquasecurity#4255.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
This is not an existing bug but a possible bug. I am developing a feature (a new kind of event), when adding a test for my feature, I encountered a bug in integration-tests. My test case looks like this, after running
ping
, tracee should emitevents.SchedProcessExec
andevents.MyDevelopingEvent
.Line 2482 calculates index of
actEvtsCopy
, the expressioncmdIdx*len(cmd.expectedEvents)+evtIdx
will produce wrong index whencmd
incmdEvents
have different number ofexpectedEvents
. Take my test case as an example, when comparing output ofrunCmd("ping")
, the correct index should be 1 and 2, but the expression gives 2 and 3 becauselen(cmd.expectedEvents)
of"ping"
is 2 andlen(cmd.expectedEvent)
of"who"
is 1.tracee/tests/integration/event_filters_test.go
Lines 2473 to 2482 in a325d64
Output of
tracee version
:I think
main
branch also have this possible bug. I give version v0.21.0 here.Output of
uname -a
:Additional details
I suggest changing code to below.
The text was updated successfully, but these errors were encountered: