Skip to content

Conversation

@ywangd
Copy link
Member

@ywangd ywangd commented Jun 1, 2025

More robust test for closed clients holder. Also changes IllegalStateException to AlreadyClosedException for both closed manager and holder.

Resolves: #128707

More robust test for closed clients holder. Also changes
IllegalStateException to AlreadyClosedException for both closed manager
and holder.

Resolves: elastic#128707
@ywangd ywangd requested a review from DaveCTurner June 1, 2025 05:58
@ywangd ywangd added >test Issues or PRs that are addressing/adding tests :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v9.1.0 labels Jun 1, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Jun 1, 2025
Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM with one small suggestion about a slightly tighter assertion

Comment on lines 209 to 213
final var e = expectThrows(AlreadyClosedException.class, () -> {
var client = clientsHolder.client(createRepositoryMetadata(randomFrom(clientName, anotherClientName)));
client.decRef();
});
assertThat(e.getMessage(), containsString("Project [" + projectId + "] clients holder is closed"));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: doing all of this inside the assertBusy() means that we will still pass the test if we temporarily throw a different exception during shutdown. It'd be better if we just looped until we see some exception, and then asserted that the first-thrown exception is an AlreadyClosedException with the right message.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. See b995e28. Thanks!

@ywangd ywangd added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jun 1, 2025
@elasticsearchmachine elasticsearchmachine merged commit b286748 into elastic:main Jun 1, 2025
18 checks passed
@ywangd ywangd deleted the es-128707-fix branch June 1, 2025 23:54
mridula-s109 pushed a commit that referenced this pull request Jun 2, 2025
More robust test for closed clients holder. Also changes
IllegalStateException to AlreadyClosedException for both closed manager
and holder.

Resolves: #128707
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jun 3, 2025
More robust test for closed clients holder. Also changes
IllegalStateException to AlreadyClosedException for both closed manager
and holder.

Resolves: elastic#128707
joshua-adams-1 pushed a commit to joshua-adams-1/elasticsearch that referenced this pull request Jun 3, 2025
More robust test for closed clients holder. Also changes
IllegalStateException to AlreadyClosedException for both closed manager
and holder.

Resolves: elastic#128707
Samiul-TheSoccerFan pushed a commit to Samiul-TheSoccerFan/elasticsearch that referenced this pull request Jun 5, 2025
More robust test for closed clients holder. Also changes
IllegalStateException to AlreadyClosedException for both closed manager
and holder.

Resolves: elastic#128707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed Coordination Meta label for Distributed Coordination team >test Issues or PRs that are addressing/adding tests v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] S3ClientsManagerTests testClientsLifeCycleForSingleProject failing

3 participants