8000 fix: overridden tests displayed as failing by M4tteoP · Pull Request #340 · coreruleset/go-ftw · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: overridden tests displayed as failing #340

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

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

M4tteoP
Copy link
Member
@M4tteoP M4tteoP commented Aug 3, 2024

Summary:

Overridden results were added to the stats twice: once by the overridden logic that was correctly setting them as overridden tests, and once by RunTest that was adding the overridden test using the result of the previous run.

Full story:

Bumped into the following output where 920290-1 was displayed as both an ignored and failed.

--- FAIL: TestFTW (14.27s)
    coreruleset_test.go:284: 7 ignored tests: [920100-5 920100-8 920270-4 920290-1 920290-4 920430-8 930110-7]
    coreruleset_test.go:288: 8 failed tests: [920274-1 920280-3 920290-1 920430-3 920430-5 920430-9 920610-2 920620-1]

When an overridden test was detected in RunStage, the result addition was not delegated to the RunTest function, but directly called there (addResultToStats). Once returned, addResultToStats was executed once again, storing the value of runContext.Result which, in case of an overridden test, contained the result of the previous run.

All the other overrides were anticipated by a successful test, therefore they did not show the bug.

@M4tteoP M4tteoP marked this pull request as ready for review August 3, 2024 15:39
Copy link
Member
@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

Nice find!

@M4tteoP
Copy link
Member Author
M4tteoP commented Aug 3, 2024

Ops, rebased, and signed the commit ✍️

Signed-off-by: Matteo Pace <pace.matteo96@gmail.com>
@theseion theseion merged commit f8169f0 into coreruleset:main Aug 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0