Skip to content

Commit 5ca5116

Browse files
Add API specs for voting config exclusions (#55919)
Closes #48131 Backport of #55760 Co-authored-by: zacharymorn <[email protected]>
1 parent 767836c commit 5ca5116

File tree

4 files changed

+169
-0
lines changed

4 files changed

+169
-0
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,8 @@ public void testApiNamingConventions() throws Exception {
869869
"cluster.reroute",
870870
"cluster.state",
871871
"cluster.stats",
872+
"cluster.post_voting_config_exclusions",
873+
"cluster.delete_voting_config_exclusions",
872874
"indices.shard_stores",
873875
"indices.upgrade",
874876
"indices.recovery",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"cluster.delete_voting_config_exclusions":{
3+
"documentation":{
4+
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html",
5+
"description":"Clears cluster voting config exclusions."
6+
},
7+
"stability":"stable",
8+
"url":{
9+
"paths":[
10+
{
11+
"path":"/_cluster/voting_config_exclusions",
12+
"methods":[
13+
"DELETE"
14+
]
15+
}
16+
]
17+
},
18+
"params":{
19+
"wait_for_removal": {
20+
"type":"boolean",
21+
"description":"Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list.",
22+
"default":true
23+
}
24+
}
25+
}
26+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"cluster.post_voting_config_exclusions":{
3+
"documentation":{
4+
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html",
5+
"description":"Updates the cluster voting config exclusions by node ids or node names."
6+
},
7+
"stability":"stable",
8+
"url":{
9+
"paths":[
10+
{
11+
"path":"/_cluster/voting_config_exclusions",
12+
"methods":[
13+
"POST"
14+
]
15+
}
16+
]
17+
},
18+
"params":{
19+
"node_ids":{
20+
"type":"string",
21+
"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."
22+
},
23+
"node_names":{
24+
"type":"string",
25+
"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."
26+
},
27+
"timeout":{
28+
"type":"time",
29+
"description":"Explicit operation timeout",
30+
"default":"30s"
31+
}
32+
}
33+
}
34+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
teardown:
2+
- do:
3+
cluster.delete_voting_config_exclusions: {}
4+
5+
---
6+
"Get cluster state without voting config exclusions":
7+
- skip:
8+
version: " - 6.99.99"
9+
reason: Voting config exclusions were introduced in 7.0.0
10+
11+
- do:
12+
cluster.state: {}
13+
14+
- length: { metadata.cluster_coordination.voting_config_exclusions: 0 }
15+
16+
---
17+
"Add voting config exclusion by unknown node Id":
18+
- skip:
19+
version: " - 7.7.99"
20+
reason: Tests the new voting config exclusions API introduced in 7.8.0
21+
22+
- do:
23+
cluster.post_voting_config_exclusions:
24+
node_ids: nodeId
25+
26+
- do:
27+
cluster.state: {}
28+
29+
- length: { metadata.cluster_coordination.voting_config_exclusions: 1 }
30+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_id: "nodeId" }
31+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_name: "_absent_" }
32+
33+
---
34+
"Add voting config exclusion by unknown node Ids":
35+
- skip:
36+
version: " - 7.7.99"
37+
features: contains
38+
reason: "contains is a newly added assertion, and this tests the new voting config exclusions API introduced in 7.8.0"
39+
40+
- do:
41+
cluster.post_voting_config_exclusions:
42+
node_ids: nodeId1,nodeId2
43+
44+
- do:
45+
cluster.state: {}
46+
47+
- length: { metadata.cluster_coordination.voting_config_exclusions: 2 }
48+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "nodeId1", node_name: "_absent_"} }
49+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "nodeId2", node_name: "_absent_"} }
50+
51+
---
52+
"Add voting config exclusion by unknown node name":
53+
- skip:
54+
version: " - 7.7.99"
55+
reason: Tests the new voting config exclusions API introduced in 7.8.0
56+
57+
- do:
58+
cluster.post_voting_config_exclusions:
59+
node_names: nodeName
60+
61+
- do:
62+
cluster.state: {}
63+
64+
- length: { metadata.cluster_coordination.voting_config_exclusions: 1 }
65+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_id: "_absent_" }
66+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_name: "nodeName" }
67+
68+
---
69+
"Add voting config exclusion by unknown node names":
70+
- skip:
71+
version: " - 7.7.99"
72+
features: contains
73+
reason: "contains is a newly added assertion, and this tests the new voting config exclusions API introduced in 7.8.0"
74+
75+
- do:
76+
cluster.post_voting_config_exclusions:
77+
node_names: nodeName1,nodeName2
78+
79+
- do:
80+
cluster.state: {}
81+
82+
- length: { metadata.cluster_coordination.voting_config_exclusions: 2 }
83+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "_absent_", node_name: "nodeName1"} }
84+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "_absent_", node_name: "nodeName2"} }
85+
86+
---
87+
"Throw exception when adding voting config exclusion without specifying nodes":
88+
- skip:
89+
version: " - 7.7.99"
90+
reason: Tests the new voting config exclusions API introduced in 7.8.0
91+
92+
- do:
93+
catch: /Please set node identifiers correctly. One and only one of \[node_name\], \[node_names\] and \[node_ids\] has to be set/
94+
cluster.post_voting_config_exclusions: {}
95+
96+
---
97+
"Throw exception when adding voting config exclusion and specifying both node_ids and node_names":
98+
- skip:
99+
version: " - 7.7.99"
100+
reason: Tests the new voting config exclusions API introduced in 7.8.0
101+
102+
- do:
103+
catch: /Please set node identifiers correctly. One and only one of \[node_name\], \[node_names\] and \[node_ids\] has to be set/
104+
cluster.post_voting_config_exclusions:
105+
node_ids: nodeId
106+
node_names: nodeName
107+

0 commit comments

Comments
 (0)