[TEST] only check node decisions if not in the AWAITING_INFO state

This commit is contained in:
Ali Beyad 2017-01-03 11:39:40 -05:00
parent ee4dde46d3
commit 6f242920d3
1 changed files with 17 additions and 14 deletions

View File

@ -122,21 +122,24 @@ public final class ClusterAllocationExplainIT extends ESIntegTestCase {
assertNull(allocateDecision.getTargetNode()); assertNull(allocateDecision.getTargetNode());
assertEquals(0L, allocateDecision.getConfiguredDelayInMillis()); assertEquals(0L, allocateDecision.getConfiguredDelayInMillis());
assertEquals(0L, allocateDecision.getRemainingDelayInMillis()); assertEquals(0L, allocateDecision.getRemainingDelayInMillis());
assertEquals(0, allocateDecision.getNodeDecisions().size());
// verify JSON output if (allocateDecision.getAllocationDecision() == AllocationDecision.NO_VALID_SHARD_COPY) {
try (XContentParser parser = getParser(explanation)) { assertEquals(0, allocateDecision.getNodeDecisions().size());
verifyShardInfo(parser, true, includeDiskInfo, ShardRoutingState.UNASSIGNED);
parser.nextToken(); // verify JSON output
assertEquals("can_allocate", parser.currentName()); try (XContentParser parser = getParser(explanation)) {
parser.nextToken(); verifyShardInfo(parser, true, includeDiskInfo, ShardRoutingState.UNASSIGNED);
assertEquals(AllocationDecision.NO_VALID_SHARD_COPY.toString(), parser.text()); parser.nextToken();
parser.nextToken(); assertEquals("can_allocate", parser.currentName());
assertEquals("allocate_explanation", parser.currentName()); parser.nextToken();
parser.nextToken(); assertEquals(AllocationDecision.NO_VALID_SHARD_COPY.toString(), parser.text());
assertEquals("cannot allocate because a previous copy of the primary shard existed but can no longer be found " + parser.nextToken();
"on the nodes in the cluster", parser.text()); assertEquals("allocate_explanation", parser.currentName());
assertEquals(Token.END_OBJECT, parser.nextToken()); parser.nextToken();
assertEquals("cannot allocate because a previous copy of the primary shard existed but can no longer be found " +
"on the nodes in the cluster", parser.text());
assertEquals(Token.END_OBJECT, parser.nextToken());
}
} }
} }