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
Encapsulate IndexShard/IndexService closing in tests #107974
Encapsulate IndexShard/IndexService closing in tests #107974
Conversation
Closing an `IndexShard` or an `IndexService` requires some parameters that are not really important in tests. This commit encapsulates these calls into utility methods to populate those parameters with sensible values. Moreover it reduces some unnecessary noise in a follow-up PR which will make this closing process a little more complicated in production code without affecting all these tests. Relates elastic#107952
Pinging @elastic/es-distributed (Team:Distributed) |
Extracted from #107952 to reduce noise in that PR for easier reviewing. |
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.
LGTM
@@ -363,7 +363,7 @@ public void testTranslogRecoveryWorksWithIMC() throws IOException { | |||
for (int i = 0; i < 100; i++) { | |||
indexDoc(shard, Integer.toString(i), "{\"foo\" : \"bar\"}", XContentType.JSON, null); | |||
} | |||
shard.close("simon says", false); |
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.
Bah I wish we could have preserved this great reason! :)
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's still there in org.elasticsearch.indices.IndicesLifecycleListenerSingleNodeTests
:)
Closing an
IndexShard
or anIndexService
requires some parametersthat are not really important in tests. This commit encapsulates these
calls into utility methods to populate those parameters with sensible
values. Moreover it reduces some unnecessary noise in a follow-up PR
which will make this closing process a little more complicated in
production code without affecting all these tests.
Relates #107952