Skip to content

Commit

Permalink
Remove duplicated assertions (#90031)
Browse files Browse the repository at this point in the history
  • Loading branch information
idegtiarenko committed Sep 15, 2022
1 parent f5d61fb commit 115f400
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public void testFailPrimaryStartedCheckReplicaElected() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(1));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(
Expand All @@ -208,7 +207,6 @@ public void testFailPrimaryStartedCheckReplicaElected() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(1));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(
Expand Down Expand Up @@ -273,7 +271,6 @@ public void testFirstAllocationFailureSingleNode() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(1));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(INITIALIZING));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().currentNodeId(), equalTo("node1"));
Expand All @@ -289,7 +286,6 @@ public void testFirstAllocationFailureSingleNode() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(1));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(UNASSIGNED));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().currentNodeId(), nullValue());
Expand Down Expand Up @@ -395,7 +391,6 @@ public void testFirstAllocationFailureTwoNodes() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(1));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(INITIALIZING));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().currentNodeId(), equalTo(nodeHoldingPrimary));
Expand All @@ -414,7 +409,6 @@ public void testFirstAllocationFailureTwoNodes() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(1));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(INITIALIZING));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().currentNodeId(), not(equalTo(nodeHoldingPrimary)));
Expand Down Expand Up @@ -457,7 +451,6 @@ public void testRebalanceFailure() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(2));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(
Expand All @@ -479,7 +472,6 @@ public void testRebalanceFailure() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(2));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public void testBalanceAllNodesStarted() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).shard(0).state(), equalTo(UNASSIGNED));
assertThat(clusterState.routingTable().index("test").shard(i).shard(1).state(), equalTo(UNASSIGNED));
Expand All @@ -69,7 +68,6 @@ public void testBalanceAllNodesStarted() {

assertThat(clusterState.routingTable().index("test1").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test1").size(); i++) {
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).shard(0).state(), equalTo(UNASSIGNED));
assertThat(clusterState.routingTable().index("test1").shard(i).shard(1).state(), equalTo(UNASSIGNED));
Expand All @@ -88,7 +86,6 @@ public void testBalanceAllNodesStarted() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(INITIALIZING));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -106,7 +103,6 @@ public void testBalanceAllNodesStarted() {
clusterState = newState;
assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -128,15 +124,13 @@ public void testBalanceAllNodesStarted() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().get(0).state(), equalTo(STARTED));
}
assertThat(clusterState.routingTable().index("test1").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test1").size(); i++) {
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test1").shard(i).replicaShards().size(), equalTo(1));
Expand Down Expand Up @@ -184,7 +178,6 @@ public void testBalanceIncrementallyStartNodes() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).shard(0).state(), equalTo(UNASSIGNED));
assertThat(clusterState.routingTable().index("test").shard(i).shard(1).state(), equalTo(UNASSIGNED));
Expand All @@ -194,7 +187,6 @@ public void testBalanceIncrementallyStartNodes() {

assertThat(clusterState.routingTable().index("test1").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test1").size(); i++) {
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).shard(0).state(), equalTo(UNASSIGNED));
assertThat(clusterState.routingTable().index("test1").shard(i).shard(1).state(), equalTo(UNASSIGNED));
Expand All @@ -210,7 +202,6 @@ public void testBalanceIncrementallyStartNodes() {
clusterState = newState;
assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(INITIALIZING));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -229,7 +220,6 @@ public void testBalanceIncrementallyStartNodes() {
clusterState = newState;
assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -250,15 +240,13 @@ public void testBalanceIncrementallyStartNodes() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().get(0).state(), equalTo(STARTED));
}
assertThat(clusterState.routingTable().index("test1").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test1").size(); i++) {
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test1").shard(i).replicaShards().size(), equalTo(1));
Expand Down Expand Up @@ -309,7 +297,6 @@ public void testBalanceAllNodesStartedAddIndex() {

assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).shard(0).state(), equalTo(UNASSIGNED));
assertThat(clusterState.routingTable().index("test").shard(i).shard(1).state(), equalTo(UNASSIGNED));
Expand All @@ -327,7 +314,6 @@ public void testBalanceAllNodesStartedAddIndex() {
clusterState = newState;
assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(INITIALIZING));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -345,7 +331,6 @@ public void testBalanceAllNodesStartedAddIndex() {
clusterState = newState;
assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -366,7 +351,6 @@ public void testBalanceAllNodesStartedAddIndex() {
RoutingNodes routingNodes = clusterState.getRoutingNodes();
assertThat(clusterState.routingTable().index("test").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test").size(); i++) {
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test").shard(i).replicaShards().size(), equalTo(1));
Expand Down Expand Up @@ -402,7 +386,6 @@ public void testBalanceAllNodesStartedAddIndex() {
clusterState = newState;
assertThat(clusterState.routingTable().index("test1").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test1").size(); i++) {
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).primaryShard().state(), equalTo(INITIALIZING));
assertThat(clusterState.routingTable().index("test1").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -420,7 +403,6 @@ public void testBalanceAllNodesStartedAddIndex() {
clusterState = newState;
assertThat(clusterState.routingTable().index("test1").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test1").size(); i++) {
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test1").shard(i).replicaShards().size(), equalTo(1));
Expand All @@ -441,7 +423,6 @@ public void testBalanceAllNodesStartedAddIndex() {
routingNodes = clusterState.getRoutingNodes();
assertThat(clusterState.routingTable().index("test1").size(), equalTo(3));
for (int i = 0; i < clusterState.routingTable().index("test1").size(); i++) {
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).size(), equalTo(2));
assertThat(clusterState.routingTable().index("test1").shard(i).primaryShard().state(), equalTo(STARTED));
assertThat(clusterState.routingTable().index("test1").shard(i).replicaShards().size(), equalTo(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public void testBackupIsAllocatedAfterPrimary() {

assertThat(routingTable.index("test").size(), equalTo(1));
assertThat(routingTable.index("test").shard(0).size(), equalTo(2));
assertThat(routingTable.index("test").shard(0).size(), equalTo(2));
assertThat(routingTable.index("test").shard(0).shard(0).state(), equalTo(UNASSIGNED));
assertThat(routingTable.index("test").shard(0).shard(1).state(), equalTo(UNASSIGNED));
assertThat(routingTable.index("test").shard(0).shard(0).currentNodeId(), nullValue());
Expand All @@ -68,7 +67,6 @@ public void testBackupIsAllocatedAfterPrimary() {
assertThat(prevRoutingTable != routingTable, equalTo(true));
assertThat(routingTable.index("test").size(), equalTo(1));
assertThat(routingTable.index("test").shard(0).size(), equalTo(2));
assertThat(routingTable.index("test").shard(0).size(), equalTo(2));
assertThat(routingTable.index("test").shard(0).primaryShard().state(), equalTo(INITIALIZING));
assertThat(routingTable.index("test").shard(0).primaryShard().currentNodeId(), equalTo(nodeHoldingPrimary));
assertThat(routingTable.index("test").shard(0).replicaShards().size(), equalTo(1));
Expand All @@ -84,7 +82,6 @@ public void testBackupIsAllocatedAfterPrimary() {
assertThat(prevRoutingTable != routingTable, equalTo(true));
assertThat(routingTable.index("test").size(), equalTo(1));
assertThat(routingTable.index("test").shard(0).size(), equalTo(2));
assertThat(routingTable.index("test").shard(0).size(), equalTo(2));
assertThat(routingTable.index("test").shard(0).primaryShard().state(), equalTo(STARTED));
assertThat(routingTable.index("test").shard(0).primaryShard().currentNodeId(), equalTo(nodeHoldingPrimary));
assertThat(routingTable.index("test").shard(0).replicaShards().size(), equalTo(1));
Expand Down

0 comments on commit 115f400

Please sign in to comment.