Add unit tests for ShardStateAction's ShardStartedClusterStateTaskExecutor#37756
Conversation
|
Pinging @elastic/es-distributed |
|
@elasticmachine run elasticsearch-ci/2 |
0652c60 to
144c726
Compare
|
@elasticmachine run elasticsearch-ci/1 |
144c726 to
407113d
Compare
|
@original-brownbear can you have a look here too? Thank you |
|
Sure, on it today :) |
original-brownbear
left a comment
There was a problem hiding this comment.
Looks good, a few (optional) style suggestions, but I'd fix the way we handle the test's setUp method in one spot.
...er/src/test/java/org/elasticsearch/action/support/replication/ClusterStateCreationUtils.java
Outdated
Show resolved
Hide resolved
...t/java/org/elasticsearch/cluster/action/shard/ShardStartedClusterStateTaskExecutorTests.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Just a suggestion:
You could just make this
Exception await() throws Interrupted {
latch.await();
return failure.get();
}
=> You could save the two getters `isSuccessful` and `getFailure` and could just shorten the code a bit in users.There was a problem hiding this comment.
We can save the 2 getters but I'm not a big fan of having the await() method doing 2 different things. I updated the code a bit to not use getters, let me know what you think.
There was a problem hiding this comment.
I guess you could argue, that it leaves less wiggle room for mistakes if it's just one method.
The way it was and still is, I have to wait for and then check the result. But if I check before I waited, I simply get the wrong result without any indication that I'm doing something wrong.
=> It's a bit of a test instability waiting to happen for some the failure without waiting :D
- I guess you could also just name the method
resultorgetand it would be pretty clear/ergonomic like aFuture.
But no big deal imo :)
server/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java
Outdated
Show resolved
Hide resolved
...t/java/org/elasticsearch/cluster/action/shard/ShardStartedClusterStateTaskExecutorTests.java
Outdated
Show resolved
Hide resolved
|
@original-brownbear Thanks! Code is updated, can you have another look please? |
|
@elasticmachine run elasticsearch-ci/2 |
|
@elasticmachine run elasticsearch-ci/default-distro |
0046ed7 to
0d3442a
Compare
|
Thanks @original-brownbear ! |
* elastic/master: (68 commits) Fix potential IllegalCapacityException in LLRC when selecting nodes (elastic#37821) Mute CcrRepositoryIT#testFollowerMappingIsUpdated Fix S3 Repository ITs When Docker is not Available (elastic#37878) Pass distribution type through to docs tests (elastic#37885) Mute SharedClusterSnapshotRestoreIT#testSnapshotCanceledOnRemovedShard SQL: Fix casting from date to numeric type to use millis (elastic#37869) Migrate o.e.i.r.RecoveryState to Writeable (elastic#37380) ML: removing unnecessary upgrade code (elastic#37879) Relax cluster metadata version check (elastic#37834) Mute TransformIntegrationTests#testSearchTransform Refactored GeoHashGrid unit tests (elastic#37832) Fixes for a few randomized agg tests that fail hasValue() checks Geo: replace intermediate geo objects with libs/geo (elastic#37721) Remove NOREPLACE for /etc/elasticsearch in rpm and deb (elastic#37839) Remove "reinstall" packaging tests (elastic#37851) Add unit tests for ShardStateAction's ShardStartedClusterStateTaskExecutor (elastic#37756) Exit batch files explictly using ERRORLEVEL (elastic#29583) TransportUnfollowAction should increase settings version (elastic#37859) AsyncTwoPhaseIndexerTests race condition fixed (elastic#37830) Do not allow negative variances (elastic#37384) ...
The cluster state task executor in charge of processing shard failed requests (
ShardFailedClusterStateTaskExecutor) has unit tests but the executor that processes shard started request has no unit tests (ShardStartedClusterStateTaskExecutor).This pull request adds unit tests for this executor. It also adds a test for started shard request in ShardStateActionTests and cleans up the tests a bit there.