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

Fix flakiness for getNodeRoles based tests #7395

Merged
merged 1 commit into from
May 3, 2023

Conversation

kotwanikunal
Copy link
Member

@kotwanikunal kotwanikunal commented May 3, 2023

Description

  • Fixes flakiness for getNodeRoles based tests
  • Calling client() randomizes the clients across nodes and can lead to a difference sequence of node outputs when checking for node roles

Related Issues

Resolves #7327

Ran the tests with offending seeds and it seems to pass now.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@kotwanikunal
Copy link
Member Author

@reta Can you please take a look at this one?

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.indices.replication.SegmentReplicationRelocationIT.testPrimaryRelocation

Copy link
Collaborator

@tlfeng tlfeng left a comment

Choose a reason for hiding this comment

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

Thank you for fixing the test! 👍

@tlfeng
Copy link
Collaborator

tlfeng commented May 3, 2023

Could you tell me why initializing a new Client will keep the sequence of node output consistent?

@kotwanikunal
Copy link
Member Author

kotwanikunal commented May 3, 2023

Could you tell me why initializing a new Client will keep the sequence of node output consistent?

Sure.
Going down the client initialization, you can see if you call the path repeatedly, it will create a randomizing client or a client for a different node.

public static Client client() {
return client(null);
}
public static Client client(@Nullable String node) {
if (node != null) {
return internalCluster().client(node);
}
Client client = cluster().client();
if (frequently()) {
client = new RandomizingClient(client, random());
}
return client;
}

And since the API response is an array, different coordinator nodes will lead to a change in the sequence of returned results for node stats.

@kotwanikunal kotwanikunal added the backport 2.x Backport to 2.x branch label May 10, 2023
@kotwanikunal kotwanikunal deleted the fix-7327 branch May 10, 2023 16:16
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 10, 2023
Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
(cherry picked from commit b65047f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kotwanikunal pushed a commit that referenced this pull request May 10, 2023
(cherry picked from commit b65047f)

Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
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>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
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 skip-changelog
Projects
None yet
2 participants