test: fetch `SeqNoStats` inside try-catch block

Relates to #33457
This commit is contained in:
Martijn van Groningen 2018-09-06 11:48:51 +02:00
parent 0849b98f60
commit cdd82bb203
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 3 additions and 1 deletions

View File

@ -43,6 +43,7 @@ import java.util.function.Consumer;
import java.util.function.LongConsumer; import java.util.function.LongConsumer;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTestCase { public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTestCase {
@ -121,6 +122,7 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
thread.join(); thread.join();
leaderGroup.assertAllEqual(docCount); leaderGroup.assertAllEqual(docCount);
assertThat(shardFollowTask.getFailure(), nullValue());
assertBusy(() -> followerGroup.assertAllEqual(docCount)); assertBusy(() -> followerGroup.assertAllEqual(docCount));
shardFollowTask.markAsCompleted(); shardFollowTask.markAsCompleted();
assertConsistentHistoryBetweenLeaderAndFollower(leaderGroup, followerGroup); assertConsistentHistoryBetweenLeaderAndFollower(leaderGroup, followerGroup);
@ -205,8 +207,8 @@ public class ShardFollowTaskReplicationTests extends ESIndexLevelReplicationTest
Exception exception = null; Exception exception = null;
for (IndexShard indexShard : indexShards) { for (IndexShard indexShard : indexShards) {
final SeqNoStats seqNoStats = indexShard.seqNoStats();
try { try {
final SeqNoStats seqNoStats = indexShard.seqNoStats();
Translog.Operation[] ops = ShardChangesAction.getOperations(indexShard, seqNoStats.getGlobalCheckpoint(), from, Translog.Operation[] ops = ShardChangesAction.getOperations(indexShard, seqNoStats.getGlobalCheckpoint(), from,
maxOperationCount, params.getMaxBatchSizeInBytes()); maxOperationCount, params.getMaxBatchSizeInBytes());
// hard code mapping version; this is ok, as mapping updates are not tested here // hard code mapping version; this is ok, as mapping updates are not tested here