Adjust assertions for sequence numbers BWC tests
This commit adjusts the assertions for the sequence number BWC tests to account for the fact that sometimes these tests are run in mixed-clusters with 5.6 nodes (that do not understand sequence numbers), and sometimes these tests are run in mixed-cluster with 6.0+ nodes (that all understood sequence numbers). Relates #27251
This commit is contained in:
parent
0f21262b36
commit
8b4a92fbb7
|
@ -192,8 +192,8 @@ public class IndexingIT extends ESRestTestCase {
|
||||||
int numDocs = 0;
|
int numDocs = 0;
|
||||||
final int numberOfInitialDocs = 1 + randomInt(5);
|
final int numberOfInitialDocs = 1 + randomInt(5);
|
||||||
logger.info("indexing [{}] docs initially", numberOfInitialDocs);
|
logger.info("indexing [{}] docs initially", numberOfInitialDocs);
|
||||||
numDocs += indexDocs(index, numDocs, numberOfInitialDocs);
|
numDocs += indexDocs(index, 0, numberOfInitialDocs);
|
||||||
assertSeqNoOnShards(index, nodes, numDocs, newNodeClient);
|
assertSeqNoOnShards(index, nodes, nodes.getBWCVersion().major >= 6 ? numDocs : 0, newNodeClient);
|
||||||
logger.info("allowing shards on all nodes");
|
logger.info("allowing shards on all nodes");
|
||||||
updateIndexSetting(index, Settings.builder().putNull("index.routing.allocation.include._name"));
|
updateIndexSetting(index, Settings.builder().putNull("index.routing.allocation.include._name"));
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
@ -204,7 +204,7 @@ public class IndexingIT extends ESRestTestCase {
|
||||||
final int numberOfDocsAfterAllowingShardsOnAllNodes = 1 + randomInt(5);
|
final int numberOfDocsAfterAllowingShardsOnAllNodes = 1 + randomInt(5);
|
||||||
logger.info("indexing [{}] docs after allowing shards on all nodes", numberOfDocsAfterAllowingShardsOnAllNodes);
|
logger.info("indexing [{}] docs after allowing shards on all nodes", numberOfDocsAfterAllowingShardsOnAllNodes);
|
||||||
numDocs += indexDocs(index, numDocs, numberOfDocsAfterAllowingShardsOnAllNodes);
|
numDocs += indexDocs(index, numDocs, numberOfDocsAfterAllowingShardsOnAllNodes);
|
||||||
assertSeqNoOnShards(index, nodes, numDocs, newNodeClient);
|
assertSeqNoOnShards(index, nodes, nodes.getBWCVersion().major >= 6 ? numDocs : 0, newNodeClient);
|
||||||
Shard primary = buildShards(index, nodes, newNodeClient).stream().filter(Shard::isPrimary).findFirst().get();
|
Shard primary = buildShards(index, nodes, newNodeClient).stream().filter(Shard::isPrimary).findFirst().get();
|
||||||
logger.info("moving primary to new node by excluding {}", primary.getNode().getNodeName());
|
logger.info("moving primary to new node by excluding {}", primary.getNode().getNodeName());
|
||||||
updateIndexSetting(index, Settings.builder().put("index.routing.allocation.exclude._name", primary.getNode().getNodeName()));
|
updateIndexSetting(index, Settings.builder().put("index.routing.allocation.exclude._name", primary.getNode().getNodeName()));
|
||||||
|
@ -214,7 +214,7 @@ public class IndexingIT extends ESRestTestCase {
|
||||||
logger.info("indexing [{}] docs after moving primary", numberOfDocsAfterMovingPrimary);
|
logger.info("indexing [{}] docs after moving primary", numberOfDocsAfterMovingPrimary);
|
||||||
numDocsOnNewPrimary += indexDocs(index, numDocs, numberOfDocsAfterMovingPrimary);
|
numDocsOnNewPrimary += indexDocs(index, numDocs, numberOfDocsAfterMovingPrimary);
|
||||||
numDocs += numberOfDocsAfterMovingPrimary;
|
numDocs += numberOfDocsAfterMovingPrimary;
|
||||||
assertSeqNoOnShards(index, nodes, numDocs, newNodeClient);
|
assertSeqNoOnShards(index, nodes, nodes.getBWCVersion().major >= 6 ? numDocs : numDocsOnNewPrimary, newNodeClient);
|
||||||
/*
|
/*
|
||||||
* Dropping the number of replicas to zero, and then increasing it to one triggers a recovery thus exercising any BWC-logic in
|
* Dropping the number of replicas to zero, and then increasing it to one triggers a recovery thus exercising any BWC-logic in
|
||||||
* the recovery code.
|
* the recovery code.
|
||||||
|
@ -233,7 +233,7 @@ public class IndexingIT extends ESRestTestCase {
|
||||||
for (Shard shard : buildShards(index, nodes, newNodeClient)) {
|
for (Shard shard : buildShards(index, nodes, newNodeClient)) {
|
||||||
assertCount(index, "_only_nodes:" + shard.node.nodeName, numDocs);
|
assertCount(index, "_only_nodes:" + shard.node.nodeName, numDocs);
|
||||||
}
|
}
|
||||||
assertSeqNoOnShards(index, nodes, numDocs, newNodeClient);
|
assertSeqNoOnShards(index, nodes, nodes.getBWCVersion().major >= 6 ? numDocs : numDocsOnNewPrimary, newNodeClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue