-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[Test] Ensure latest cluster info is used in tests #116908
Conversation
DesiredBalanceMetrics#updateMetrics is called on reroute which is frequent but not guaranteed. It can also takes some time to complete. This PR adds an explicit reroute to ensure the latest cluster info is picked up. Resolves: elastic#116870
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
@@ -68,6 +69,7 @@ public void testDesiredBalanceMetrics() { | |||
final var infoService = (InternalClusterInfoService) internalCluster().getCurrentMasterNodeInstance(ClusterInfoService.class); | |||
ClusterInfoServiceUtils.setUpdateFrequency(infoService, TimeValue.timeValueMillis(200)); | |||
assertNotNull("info should not be null", ClusterInfoServiceUtils.refresh(infoService)); |
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.
It seems to me that the asyncRefresh for clusterInfo can also pause which makes the refresh
call here to get back a stale result since the newRefresh is short-circuited if there is already one running. If that does happen, it might also lead to test failure. But in practice, I was not able to make it happen, probably due to the short update interval of 200ms. So I am leaving it as is.
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.
Thanks! Let me know if this fails again, I can simplify/improve the test.
DesiredBalanceMetrics#updateMetrics is called on reroute which is frequent but not guaranteed. It can also take some time to complete. This PR adds an explicit reroute to ensure the latest cluster info is picked up. Resolves: elastic#116870
DesiredBalanceMetrics#updateMetrics is called on reroute which is frequent but not guaranteed. It can also take some time to complete. This PR adds an explicit reroute to ensure the latest cluster info is picked up. Resolves: elastic#116870
DesiredBalanceMetrics#updateMetrics is called on reroute which is frequent but not guaranteed. It can also takes some time to complete. This PR adds an explicit reroute to ensure the latest cluster info is picked up.
Resolves: #116870