Test: Only run the test that verifies the pending field in the _shards header if the test cluster has two are more data nodes.

This commit is contained in:
Martijn van Groningen 2015-01-12 10:29:23 +01:00
parent 102e7adfad
commit a88dd36df4
3 changed files with 40 additions and 29 deletions

View File

@ -3,33 +3,24 @@
- do:
indices.create:
index: foobar1
index: foobar
body:
settings:
number_of_shards: "1"
number_of_replicas: "0"
- do:
indices.create:
index: foobar2
body:
settings:
number_of_shards: "1"
number_of_replicas: "1"
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: foobar1
index: foobar
type: baz
id: 1
body: { foo: bar }
- match: { _index: foobar1 }
- match: { _index: foobar }
- match: { _type: baz }
- match: { _id: "1"}
- match: { _version: 1}
@ -37,20 +28,3 @@
- match: { _shards.successful: 1}
- match: { _shards.failed: 0}
- is_false: _shards.pending
- do:
index:
index: foobar2
type: baz
id: 1
replication: async
body: { foo: bar }
- match: { _index: foobar2 }
- match: { _type: baz }
- match: { _id: "1"}
- match: { _version: 1}
- match: { _shards.total: 2}
- match: { _shards.successful: 1}
- match: { _shards.failed: 0}
- match: { _shards.pending: 1}

View File

@ -0,0 +1,34 @@
---
"Index check shard header pending field":
- skip:
features: "requires_replica"
- do:
indices.create:
index: foobar
body:
settings:
number_of_shards: "1"
number_of_replicas: "1"
- do:
cluster.health:
wait_for_status: green
- do:
index:
index: foobar
type: baz
id: 1
replication: async
body: { foo: bar }
- match: { _index: foobar }
- match: { _type: baz }
- match: { _id: "1"}
- match: { _version: 1}
- match: { _shards.total: 2}
- match: { _shards.successful: 1}
- match: { _shards.failed: 0}
- match: { _shards.pending: 1}

View File

@ -48,6 +48,9 @@ public final class Features {
if ("benchmark".equals(feature) && ElasticsearchIntegrationTest.cluster().numBenchNodes() > 0) {
continue;
}
if ("requires_replica".equals(feature) && ElasticsearchIntegrationTest.cluster().numDataNodes() >= 2) {
continue;
}
if (!SUPPORTED.contains(feature)) {
return false;
}