mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
[TEST] Fix IndexRecoveryIT.testDisconnectsDuringRecovery
The test currently checks that the recovering shard is not failed when it is not a primary relocation that has moved past the finalization step. Checking if it has moved past that step is done by intercepting the request between the replication source and the target and checking if it has seen then WAIT_FOR_CLUSTERSTATE action as this is the next action that is called after finalization. This action can, however, occur only after the shard was already failed, and thus trip the assertion. This commit changes the check to look out for the FINALIZE action, independently of whether it succeeded or not.
This commit is contained in:
parent
cfc106d721
commit
182e8115de
@ -724,14 +724,14 @@ public class IndexRecoveryIT extends ESIntegTestCase {
|
||||
}
|
||||
});
|
||||
|
||||
final AtomicBoolean seenWaitForClusterState = new AtomicBoolean();
|
||||
final AtomicBoolean finalized = new AtomicBoolean();
|
||||
blueMockTransportService.addDelegate(redMockTransportService, new MockTransportService.DelegateTransport(blueMockTransportService.original()) {
|
||||
@Override
|
||||
protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request,
|
||||
TransportRequestOptions options) throws IOException {
|
||||
logger.info("--> sending request {} on {}", action, connection.getNode());
|
||||
if (action.equals(PeerRecoveryTargetService.Actions.WAIT_CLUSTERSTATE)) {
|
||||
seenWaitForClusterState.set(true);
|
||||
if (action.equals(PeerRecoveryTargetService.Actions.FINALIZE)) {
|
||||
finalized.set(true);
|
||||
}
|
||||
super.sendRequest(connection, requestId, action, request, options);
|
||||
}
|
||||
@ -743,7 +743,7 @@ public class IndexRecoveryIT extends ESIntegTestCase {
|
||||
protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request,
|
||||
TransportRequestOptions options) throws IOException {
|
||||
logger.info("--> sending request {} on {}", action, connection.getNode());
|
||||
if (primaryRelocation == false || seenWaitForClusterState.get() == false) {
|
||||
if ((primaryRelocation && finalized.get()) == false) {
|
||||
assertNotEquals(action, ShardStateAction.SHARD_FAILED_ACTION_NAME);
|
||||
}
|
||||
super.sendRequest(connection, requestId, action, request, options);
|
||||
|
Loading…
x
Reference in New Issue
Block a user