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

Prevent flaky behavior when determining if an request will be executed on the current node. #3066

Conversation

DarshitChanpura
Copy link
Member

@DarshitChanpura DarshitChanpura commented Jul 28, 2023

Description

Remove static reference/initialization of localNode variable inside security plugin, to fix No user found.. errors caused due to mismatching localNode values in test.

Solve CI flakiness introduced in: #2765

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.

@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #3066 (871c58f) into main (08d1734) will decrease coverage by 0.18%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main    #3066      +/-   ##
============================================
- Coverage     62.54%   62.36%   -0.18%     
+ Complexity     3361     3347      -14     
============================================
  Files           254      254              
  Lines         19744    19741       -3     
  Branches       3334     3334              
============================================
- Hits          12349    12312      -37     
- Misses         5768     5793      +25     
- Partials       1627     1636       +9     
Files Changed Coverage Δ
.../opensearch/security/OpenSearchSecurityPlugin.java 84.34% <100.00%> (-0.36%) ⬇️
...search/security/transport/SecurityInterceptor.java 72.07% <100.00%> (-0.83%) ⬇️

... and 11 files with indirect coverage changes

@DarshitChanpura DarshitChanpura self-assigned this Jul 28, 2023
@DarshitChanpura DarshitChanpura added the backport 2.x backport to 2.x branch label Jul 31, 2023
@peternied peternied force-pushed the remove-static-localnode-reference branch from a286662 to 871c58f Compare July 31, 2023 18:04
@@ -130,7 +130,8 @@ public <T extends TransportResponse> void sendRequestDecorate(
String action,
TransportRequest request,
TransportRequestOptions options,
TransportResponseHandler<T> handler
TransportResponseHandler<T> handler,
DiscoveryNode localNode
Copy link
Member

Choose a reason for hiding this comment

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

Making this a parameter for sendRequestDecorate makes more sense IMO

@@ -165,7 +162,7 @@ public void testSendRequestDecorate() {
assertEquals(threadPool.getThreadContext().getHeader(ConfigConstants.OPENDISTRO_SECURITY_USER_HEADER), null);

// isSameNodeRequest = false
securityInterceptor.sendRequestDecorate(sender, connection2, action, request, options, handler);
securityInterceptor.sendRequestDecorate(sender, connection2, action, request, options, handler, otherNode);
Copy link
Member

Choose a reason for hiding this comment

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

This check is now fully deterministic 👍

@peternied peternied merged commit cca77be into opensearch-project:main Jul 31, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 31, 2023
### Description
Remove static reference/initialization of localNode variable inside
security plugin, to fix `No user found..` errors caused due to
mismatching localNode values in test.

Signed-off-by: Peter Nied <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
(cherry picked from commit cca77be)
willyborankin pushed a commit that referenced this pull request Jul 31, 2023
@cwperks cwperks added the backport 2.9 Backport to 2.9 branch label Aug 8, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 8, 2023
### Description
Remove static reference/initialization of localNode variable inside
security plugin, to fix `No user found..` errors caused due to
mismatching localNode values in test.

Signed-off-by: Peter Nied <[email protected]>
Co-authored-by: Peter Nied <[email protected]>
(cherry picked from commit cca77be)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
DarshitChanpura pushed a commit that referenced this pull request Aug 9, 2023
Backport cca77be from #3066.

Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Peter Nied <[email protected]>
@peternied peternied changed the title Remove static local-node reference Prevent flaky behavior when determining if an request will be executed on the current node. Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch backport 2.9 Backport to 2.9 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants