-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Add unit test for TransportReloadRemoteClusterCredentialsAction
#139414
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
Add unit test for TransportReloadRemoteClusterCredentialsAction
#139414
Conversation
Adds a new unit test class for TransportReloadRemoteClusterCredentialsAction. This is a follow up from elastic#135491, where a significant chunk of code was moved from RemoteClusterService into TransportReloadRemoteClusterCredentialsAction. This also verifies code touched recently in elastic#139012. Resolves: ES-13161
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
ywangd
left a comment
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
| clusterService.getClusterApplierService() | ||
| .setInitialState(new ClusterState.Builder(clusterService.getClusterName()).blocks(blocks).build()); | ||
| Consumer<ActionListener<ActionResponse.Empty>> consumer = listener -> action.execute(task, request, listener); | ||
| expectThrows(ClusterBlockException.class, () -> { throw safeAwaitFailure(consumer); }); |
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.
Seems unnecessary to throw it again?
| expectThrows(ClusterBlockException.class, () -> { throw safeAwaitFailure(consumer); }); | |
| assertThat(safeAwaitFailure(consumer), instanceOf(ClusterBlockException.class)); |
or we can inline the consumer with
safeAwaitFailure(ClusterBlockException.class, ActionResponse.Empty.class, l -> action.execute(task, request, l));| .put("cluster.remote.foo.proxy_address", remoteNode.getAddress().toString()) | ||
| .setSecureSettings(toSecureSettings("foo", randomAlphaOfLength(10))) |
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 better if the test does not change the proxy_address so that we can verify the behaviour with just the credentials update.
…astic#139414) Adds a new unit test class for TransportReloadRemoteClusterCredentialsAction. This is a follow up from elastic#135491, where a significant chunk of code was moved from RemoteClusterService into TransportReloadRemoteClusterCredentialsAction. This also verifies code touched recently in elastic#139012. Resolves: ES-13161
Adds a new unit test class for
TransportReloadRemoteClusterCredentialsAction. This is a follow up from #135491, where a significant chunk of code was moved fromRemoteClusterServiceintoTransportReloadRemoteClusterCredentialsAction. This also verifies code touched recently in #139012.Resolves: ES-13161