-
Notifications
You must be signed in to change notification settings - Fork 276
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
Prevent message collection from being updated after message count has been received #2180
Prevent message collection from being updated after message count has been received #2180
Conversation
… been recieved Also added mechanism to detect if messages were missed so tests can be updated to appropriate counts Signed-off-by: Peter Nied <[email protected]>
@@ -39,7 +39,7 @@ jobs: | |||
run: ./gradlew clean build -Dbuild.snapshot=false -x test -x integrationTest | |||
|
|||
- name: Test | |||
run: OPENDISTRO_SECURITY_TEST_OPENSSL_OPT=true ./gradlew test integrationTest -i |
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.
This log is ~27mb which doesn't open in the browser, by disabling info log level it will be easier to look at only failing tests in the GitHub Action UX. Note; the full details can be downloaded by looking for artifacts on the test run
.collect(Collectors.joining("\n"))) | ||
.toString(); | ||
|
||
throw new RuntimeException(missedMessagesErrorMessage); |
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.
This failure should help identify any other tests with the same bug in them, waiting for a full test run before marking this ready for review
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.
Runtime exception new RuntimeException(missedMessagesErrorMessage);
will be always catch be the below } catch (final Exception e) {
but this is probably ok
Thank you @peternied! I had changed the number in this PR (https://github.com/opensearch-project/security/pull/2166/files#r997685463) because this test was failing. |
Signed-off-by: Peter Nied <[email protected]>
Fixed the following tests that these changes exposed issued with:
|
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Restarted the CI as there was a network adapter issue on the GHA runner that caused the failure. |
Codecov Report
@@ Coverage Diff @@
## main #2180 +/- ##
=========================================
Coverage 61.07% 61.08%
- Complexity 3260 3262 +2
=========================================
Files 259 259
Lines 18327 18330 +3
Branches 3249 3249
=========================================
+ Hits 11193 11196 +3
Misses 5539 5539
Partials 1595 1595
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Thank you @peternied, I like the addition of the missedMessages
section here. It gives more context when running these tests.
|
||
TestAuditlogImpl.sb = new StringBuffer(); | ||
TestAuditlogImpl.messages = messages; | ||
final CountDownLatch latch = resetAuditStorage(expectedCount, messages); | ||
|
||
try { |
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.
Thoughts on surrounding this all with one try block?
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.
Seems like a good nit, if I make any more changes I'll include this in with it - sounds fair?
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.
Ty for this PR @peternied ! Added a couple comments.
assertThat(genderMsg.getRequestBody(), containsString("Gender")); | ||
assertThat(genderMsg.getRequestBody(), not(containsString("Salary"))); | ||
|
||
Assert.assertTrue(validateMsgs(messages)); |
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.
Should this replaced with Matcher's assertTrue?
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.
Rather than cleanup this single line; we should really rewrite or remove this statement. I've created [FEATURE] AuditMessage validation in tests should be more useful / removed
#2188 for tracking.
); | ||
}); | ||
|
||
Assert.assertTrue(validateMsgs(messages)); |
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.
same as above
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.
Seems like a nitpick, if we want to invest there are better kinds of improvements we can make see #2188
… been received (opensearch-project#2180) Also adds mechanism to detect if messages were missed so tests can be updated to appropriate counts. Signed-off-by: Peter Nied <[email protected]> Signed-off-by: Stephen Crawford <[email protected]>
Windows build and test support for 1.3 - Use most recent format of CI workflows from main - Backport #2206 - Supply workarounds for JDK8 incompatible APIs for Encoding / Pattern matching (Thanks @cwperks!) - Backport only freeport logic from #1638 - Backport #1758 - All updates to TestAuditlogImpl.java from main - #2180 - #1935 - #1920 - #1914 - #1829 - And Targeted test updates for ComplianceAuditlogTest and BasicAuditlogTest to keep up with TestAuditlogImpl.java updates Signed-off-by: Peter Nied <[email protected]> Signed-off-by: Stephen Crawford <[email protected]> Signed-off-by: Stephen Crawford <[email protected]> Co-authored-by: Stephen Crawford <[email protected]>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-2180-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ba9d82ef6a2c6da137c19fcaaddce6dabcf7160f
# Push it to GitHub
git push --set-upstream origin backport/backport-2180-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
Seeing failures on backport into 2.x - #3032 (review) going to trigger backport
|
Actually my day is looking booked up - @DarshitChanpura could you see able backporting this PR into the 2.x line since you were looking into #3021? |
… been received (opensearch-project#2180) Also adds mechanism to detect if messages were missed so tests can be updated to appropriate counts. Signed-off-by: Peter Nied <[email protected]> (cherry picked from commit ba9d82e)
… been received (opensearch-project#2180) Also adds mechanism to detect if messages were missed so tests can be updated to appropriate counts. Signed-off-by: Peter Nied <[email protected]> (cherry picked from commit ba9d82e)
… been received (opensearch-project#2180) Also adds mechanism to detect if messages were missed so tests can be updated to appropriate counts. Signed-off-by: Peter Nied <[email protected]> (cherry picked from commit ba9d82e)
…ssage count has been received (#2180) (#3035) * Prevent message collection from being updated after message count has been received (#2180) Also adds mechanism to detect if messages were missed so tests can be updated to appropriate counts. Signed-off-by: Peter Nied <[email protected]> (cherry picked from commit ba9d82e) * Fixes failing citest task Signed-off-by: Darshit Chanpura <[email protected]> * Fixes spotlessChecks Signed-off-by: Darshit Chanpura <[email protected]> * Fixes test assertions to reflect correct number Signed-off-by: Darshit Chanpura <[email protected]> --------- Signed-off-by: Darshit Chanpura <[email protected]> Co-authored-by: Peter Nied <[email protected]> Co-authored-by: Craig Perkins <[email protected]>
Description
Prevent message collection from being updated after message count has been received
Also added mechanism to detect if messages were missed so tests can be updated to appropriate counts
Issues Resolved
Saw a failure for PR #2167 which had no code impact, saw the test
testSSLPlainText
was failing, looks like it was exiting early because the test was only looking for a smaller number of messages.Testing
Tested locally, CI should confirm things are working as expected. Also ran the bulk integration test workflow [1], 18 runs with no issues
[1] https://github.com/peternied/security/actions/runs/3291303445/jobs/5425278205
Check List
New functionality has been documentedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.