Skip to content

Commit

Permalink
Added tests for /_cluster/reroute.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Aug 30, 2024
1 parent 94104dd commit 55e85cd
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 27 deletions.
9 changes: 0 additions & 9 deletions tests/routing/cluster/decommission/awareness.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ $schema: ../../../../json_schemas/test_story.schema.yaml
description: Test cluster routing settings.
version: '>= 2.16'
prologues:
- path: /_cluster/settings
method: PUT
request:
payload:
transient:
cluster.routing.allocation.awareness.attributes: zone
cluster.routing.allocation.awareness.force.zone.values:
- zoneA
- zoneB
- id: weights
path: /_cluster/routing/awareness/zone/weights
method: GET
Expand Down
9 changes: 0 additions & 9 deletions tests/routing/cluster/decommission/status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ $schema: ../../../../json_schemas/test_story.schema.yaml
description: Test cluster routing settings.
version: '>= 2.16'
prologues:
- path: /_cluster/settings
method: PUT
request:
payload:
transient:
cluster.routing.allocation.awareness.attributes: zone
cluster.routing.allocation.awareness.force.zone.values:
- zoneA
- zoneB
- id: weights
path: /_cluster/routing/awareness/zone/weights
method: GET
Expand Down
55 changes: 55 additions & 0 deletions tests/routing/cluster/reroute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test changes to allocation of shards in a cluster.
prologues:
- path: /movies
method: PUT
request:
payload:
settings:
index.number_of_shards: 1
index.number_of_replicas: 0
- path: /_bulk
method: POST
parameters:
refresh: 'true'
request:
content_type: application/x-ndjson
payload:
- {create: {_index: movies}}
- {director: Bennett Miller, title: Moneyball, year: 2011}
- {create: {_index: movies}}
- {director: Nicolas Winding Refn, title: Drive, year: 1960}
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
chapters:
- synopsis: Shows the allocation of shards in a cluster.
path: /_cluster/reroute
method: POST
response:
status: 200
- synopsis: Shows the allocation of shards in a cluster with parameters.
path: /_cluster/reroute
method: POST
parameters:
dry_run: true
explain: true
metric: nodes
retry_failed: false
response:
status: 200
- synopsis: Reroute an index shard between nodes.
path: /_cluster/reroute
method: POST
request:
payload:
commands:
- move:
index: movies
shard: 0
from_node: opensearch-node1
to_node: opensearch-node2
response:
status: 200
9 changes: 0 additions & 9 deletions tests/routing/cluster/routing/awareness/weights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ $schema: ../../../../../json_schemas/test_story.schema.yaml

description: Test cluster routing settings.
version: '>= 2.16'
prologues:
- path: /_cluster/settings
method: PUT
request:
payload:
transient:
cluster.routing.allocation.awareness.attributes: zone
cluster.routing.allocation.awareness.force.zone.values:
- zoneA
epilogues:
- id: epilogue_weights
path: /_cluster/routing/awareness/zone/weights
Expand Down
4 changes: 4 additions & 0 deletions tests/routing/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services:
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2
- cluster.name=opensearch-cluster
- cluster.routing.allocation.awareness.attributes=zone
- cluster.routing.allocation.awareness.force.zone.values=zoneA,zoneB
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- node.attr.zone=zoneA
- node.name=opensearch-node1
Expand All @@ -27,6 +29,8 @@ services:
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2
- cluster.name=opensearch-cluster
- cluster.routing.allocation.awareness.attributes=zone
- cluster.routing.allocation.awareness.force.zone.values=zoneA,zoneB
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- node.attr.zone=zoneB
- node.name=opensearch-node2
Expand Down

0 comments on commit 55e85cd

Please sign in to comment.