Monitoring: Check for source_node only for assigned shard in test

Original commit: elastic/x-pack-elasticsearch@f0d5bccecd
This commit is contained in:
Tanguy Leroux 2016-04-01 10:34:40 +02:00
parent 2c1dbf3eb6
commit 1d72eb2b61
1 changed files with 7 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
public class ShardsCollectorTests extends AbstractCollectorTestCase {
@ -132,11 +133,16 @@ public class ShardsCollectorTests extends AbstractCollectorTestCase {
assertThat(shardDoc.getMonitoringVersion(), equalTo(Version.CURRENT.toString()));
assertThat(shardDoc.getClusterUUID(), equalTo(clusterState.metaData().clusterUUID()));
assertThat(shardDoc.getTimestamp(), greaterThan(0L));
assertThat(shardDoc.getSourceNode(), notNullValue());
assertThat(shardDoc.getClusterStateUUID(), equalTo(clusterState.stateUUID()));
ShardRouting shardRouting = shardDoc.getShardRouting();
assertNotNull(shardRouting);
if (shardRouting.assignedToNode()) {
assertThat(shardDoc.getSourceNode(), notNullValue());
} else {
assertThat(shardDoc.getSourceNode(), nullValue());
}
}
// Checks that a correct number of ShardMarvelDoc documents has been created for each index