-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API specs for voting config exclusions (#55760)
Closes #48131
- Loading branch information
1 parent
0cb54ae
commit 498fc66
Showing
4 changed files
with
147 additions
and
0 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
26 changes: 26 additions & 0 deletions
26
...pi-spec/src/main/resources/rest-api-spec/api/cluster.delete_voting_config_exclusions.json
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"cluster.delete_voting_config_exclusions":{ | ||
"documentation":{ | ||
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html", | ||
"description":"Clears cluster voting config exclusions." | ||
}, | ||
"stability":"stable", | ||
"url":{ | ||
"paths":[ | ||
{ | ||
"path":"/_cluster/voting_config_exclusions", | ||
"methods":[ | ||
"DELETE" | ||
] | ||
} | ||
] | ||
}, | ||
"params":{ | ||
"wait_for_removal": { | ||
"type":"boolean", | ||
"description":"Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list.", | ||
"default":true | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...-api-spec/src/main/resources/rest-api-spec/api/cluster.post_voting_config_exclusions.json
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"cluster.post_voting_config_exclusions":{ | ||
"documentation":{ | ||
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html", | ||
"description":"Updates the cluster voting config exclusions by node ids or node names." | ||
}, | ||
"stability":"stable", | ||
"url":{ | ||
"paths":[ | ||
{ | ||
"path":"/_cluster/voting_config_exclusions", | ||
"methods":[ | ||
"POST" | ||
] | ||
} | ||
] | ||
}, | ||
"params":{ | ||
"node_ids":{ | ||
"type":"string", | ||
"description":"A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names." | ||
}, | ||
"node_names":{ | ||
"type":"string", | ||
"description":"A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids." | ||
}, | ||
"timeout":{ | ||
"type":"time", | ||
"description":"Explicit operation timeout", | ||
"default":"30s" | ||
} | ||
} | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
...-spec/src/main/resources/rest-api-spec/test/cluster.voting_config_exclusions/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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
teardown: | ||
- do: | ||
cluster.delete_voting_config_exclusions: {} | ||
|
||
--- | ||
"Get cluster state without voting config exclusions": | ||
- do: | ||
cluster.state: {} | ||
|
||
- length: { metadata.cluster_coordination.voting_config_exclusions: 0 } | ||
|
||
--- | ||
"Add voting config exclusion by unknown node Id": | ||
- do: | ||
cluster.post_voting_config_exclusions: | ||
node_ids: nodeId | ||
|
||
- do: | ||
cluster.state: {} | ||
|
||
- length: { metadata.cluster_coordination.voting_config_exclusions: 1 } | ||
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_id: "nodeId" } | ||
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_name: "_absent_" } | ||
|
||
--- | ||
"Add voting config exclusion by unknown node Ids": | ||
- skip: | ||
reason: "contains is a newly added assertion" | ||
features: contains | ||
|
||
- do: | ||
cluster.post_voting_config_exclusions: | ||
node_ids: nodeId1,nodeId2 | ||
|
||
- do: | ||
cluster.state: {} | ||
|
||
- length: { metadata.cluster_coordination.voting_config_exclusions: 2 } | ||
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "nodeId1", node_name: "_absent_"} } | ||
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "nodeId2", node_name: "_absent_"} } | ||
|
||
--- | ||
"Add voting config exclusion by unknown node name": | ||
- do: | ||
cluster.post_voting_config_exclusions: | ||
node_names: nodeName | ||
|
||
- do: | ||
cluster.state: {} | ||
|
||
- length: { metadata.cluster_coordination.voting_config_exclusions: 1 } | ||
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_id: "_absent_" } | ||
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_name: "nodeName" } | ||
|
||
--- | ||
"Add voting config exclusion by unknown node names": | ||
- skip: | ||
reason: "contains is a newly added assertion" | ||
features: contains | ||
|
||
- do: | ||
cluster.post_voting_config_exclusions: | ||
node_names: nodeName1,nodeName2 | ||
|
||
- do: | ||
cluster.state: {} | ||
|
||
- length: { metadata.cluster_coordination.voting_config_exclusions: 2 } | ||
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "_absent_", node_name: "nodeName1"} } | ||
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "_absent_", node_name: "nodeName2"} } | ||
|
||
--- | ||
"Throw exception when adding voting config exclusion without specifying nodes": | ||
- do: | ||
catch: /You must set \[node_names\] or \[node_ids\] but not both/ | ||
cluster.post_voting_config_exclusions: {} | ||
|
||
--- | ||
"Throw exception when adding voting config exclusion and specifying both node_ids and node_names": | ||
- do: | ||
catch: /You must set \[node_names\] or \[node_ids\] but not both/ | ||
cluster.post_voting_config_exclusions: | ||
node_ids: nodeId | ||
node_names: nodeName | ||
|