Skip to content
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

[Backport 2.x] Prevent message collection from being updated after message count has been received (#2180) #3035

Conversation

DarshitChanpura
Copy link
Member

@DarshitChanpura DarshitChanpura commented Jul 19, 2023

Backports ba9d82e from #2180

Manual backport is required because of:

  1. Conflicts between HTTP5 vs HTTP4 in the files in main vs 2.x.
  2. Some code refactoring in TestAuditLogImpl file

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By 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.

… 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)
@DarshitChanpura
Copy link
Member Author

Build is broken due to opensearch-project/OpenSearch#8782

@DarshitChanpura
Copy link
Member Author

Ci should be fixed once #3036 is merged.

} catch (final IOException e) {
throw ExceptionsHelper.convertToOpenSearchException(e);
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks weirdly formatted here, but that is not the case.

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #3035 (458bce7) into 2.x (a0ac52b) will decrease coverage by 2.53%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##                2.x    #3035      +/-   ##
============================================
- Coverage     62.31%   59.79%   -2.53%     
+ Complexity     3312     3204     -108     
============================================
  Files           264      264              
  Lines         19468    19471       +3     
  Branches       3326     3326              
============================================
- Hits          12132    11642     -490     
- Misses         5710     6215     +505     
+ Partials       1626     1614      -12     
Impacted Files Coverage Δ
...pensearch/security/auditlog/impl/AuditMessage.java 74.00% <100.00%> (+0.39%) ⬆️

... and 34 files with indirect coverage changes

@cwperks
Copy link
Member

cwperks commented Jul 21, 2023

Looks like there's still a failing test. I can help take a look.

Tests with failures:
 - org.opensearch.security.auditlog.integration.BasicAuditlogTest.testSSLPlainText
 - org.opensearch.security.auditlog.integration.BasicAuditlogTest.testSSLPlainText

@cwperks
Copy link
Member

cwperks commented Jul 21, 2023

@DarshitChanpura FYI the assertion for the failing test was changed on main to only check for 1 message: https://github.com/opensearch-project/security/blob/main/src/test/java/org/opensearch/security/auditlog/integration/BasicAuditlogTest.java#L145C47-L145C47

The test can be updated in this backport with the same assertion.

Edit: The assertion for that changed was changed on this PR

Second Edit: I had to set the expected number of messages to 4 to get this more stable. The assertion was previously at 4. There are retries happening that are making the test hard to follow - I'm seeing what is best now to make this the most stable.

@cwperks
Copy link
Member

cwperks commented Jul 21, 2023

@DarshitChanpura I see why the assertion on main was set to 1. On main the RestHelper has automatic retries disabled. See https://github.com/opensearch-project/security/pull/2367/files#diff-8a5f07d4e22f127c17298eeebe6ea7bb6b49dd7b2ebd14398b7298627d8ed6d7R401

I think we can disable automatic retries on 2.x and set the assertion in BasicAuditlogTests.testSSLPlainText to check for 1 message

@DarshitChanpura DarshitChanpura merged commit 89df7b4 into opensearch-project:2.x Jul 21, 2023
51 of 52 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.

4 participants