-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
We discussed recently that the cluster state API should be considered "internal" and therefore our usual cast-iron stability guarantees do not hold for this API. However, there are a good number of REST tests that try to identify the master node. Today they call `GET /_cluster/state` API and extract the master node ID from the response. In fact many of these tests just want an arbitary node ID (or perhaps a data node ID) so an alternative is to call `GET _nodes` or `GET _nodes/data:true` and obtain a node ID from the keys of the `nodes` map in the response. This change adds the ability for YAML-based REST tests to extract an arbitrary key from a map so that they can obtain a node ID from the nodes info API instead of using the master node ID from the cluster state API. Relates #40047.
- Loading branch information
1 parent
23395a9
commit 5a2ba34
Showing
18 changed files
with
406 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
rest-api-spec/src/main/resources/rest-api-spec/test/nodes.info/10_basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
setup: | ||
- skip: | ||
features: [arbitrary_key] | ||
--- | ||
"node_info test": | ||
- do: | ||
cluster.state: {} | ||
|
||
# Get master node id | ||
- set: { master_node: master } | ||
|
||
- do: | ||
nodes.info: {} | ||
- set: | ||
nodes._arbitrary_key_: node_id | ||
|
||
- is_true: nodes | ||
- is_true: cluster_name | ||
- is_true: nodes.$master.roles | ||
- is_true: nodes.$node_id.roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
rest-api-spec/src/main/resources/rest-api-spec/test/nodes.info/30_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
--- | ||
"node_info test flat_settings": | ||
- do: | ||
cluster.state: {} | ||
- skip: | ||
features: [arbitrary_key] | ||
|
||
- set: { master_node: master } | ||
- do: | ||
nodes.info: {} | ||
- set: | ||
nodes._arbitrary_key_: node_id | ||
|
||
- do: | ||
nodes.info: | ||
metric: [ settings ] | ||
|
||
- match : { nodes.$master.settings.client.type: node } | ||
- match : { nodes.$node_id.settings.client.type: node } | ||
|
||
- do: | ||
nodes.info: | ||
metric: [ settings ] | ||
flat_settings: true | ||
|
||
- match : { nodes.$master.settings.client\.type: node } | ||
- match : { nodes.$node_id.settings.client\.type: node } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.