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 <petern@amazon.com>
| 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.
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.
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.
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 <petern@amazon.com>
|
Fixed the following tests that these changes exposed issued with:
|
Signed-off-by: Peter Nied <petern@amazon.com>
Signed-off-by: Peter Nied <petern@amazon.com>
|
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.
Thank you @peternied, I like the addition of the missedMessages section here. It gives more context when running these tests.
| TestAuditlogImpl.messages = messages; | ||
| final CountDownLatch latch = resetAuditStorage(expectedCount, messages); | ||
|
|
||
| try { |
There was a problem hiding this comment.
Thoughts on surrounding this all with one try block?
There was a problem hiding this comment.
Seems like a good nit, if I make any more changes I'll include this in with it - sounds fair?
DarshitChanpura
left a comment
There was a problem hiding this comment.
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.
Should this replaced with Matcher's assertTrue?
There was a problem hiding this comment.
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.
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 <petern@amazon.com> Signed-off-by: Stephen Crawford <steecraw@amazon.com>
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 <petern@amazon.com> Signed-off-by: Stephen Crawford <steecraw@amazon.com> Signed-off-by: Stephen Crawford <65832608+scrawfor99@users.noreply.github.com> Co-authored-by: Stephen Crawford <65832608+scrawfor99@users.noreply.github.com>
|
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.xThen, 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 <petern@amazon.com> (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 <petern@amazon.com> (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 <petern@amazon.com> (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 <petern@amazon.com> (cherry picked from commit ba9d82e) * Fixes failing citest task Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes spotlessChecks Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes test assertions to reflect correct number Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Co-authored-by: Peter Nied <petern@amazon.com> Co-authored-by: Craig Perkins <cwperx@amazon.com>
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
testSSLPlainTextwas 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.