Skip to content

Commit 498fc66

Browse files
authored
Add API specs for voting config exclusions (#55760)
Closes #48131
1 parent 0cb54ae commit 498fc66

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-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: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
teardown:
2+
- do:
3+
cluster.delete_voting_config_exclusions: {}
4+
5+
---
6+
"Get cluster state without voting config exclusions":
7+
- do:
8+
cluster.state: {}
9+
10+
- length: { metadata.cluster_coordination.voting_config_exclusions: 0 }
11+
12+
---
13+
"Add voting config exclusion by unknown node Id":
14+
- do:
15+
cluster.post_voting_config_exclusions:
16+
node_ids: nodeId
17+
18+
- do:
19+
cluster.state: {}
20+
21+
- length: { metadata.cluster_coordination.voting_config_exclusions: 1 }
22+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_id: "nodeId" }
23+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_name: "_absent_" }
24+
25+
---
26+
"Add voting config exclusion by unknown node Ids":
27+
- skip:
28+
reason: "contains is a newly added assertion"
29+
features: contains
30+
31+
- do:
32+
cluster.post_voting_config_exclusions:
33+
node_ids: nodeId1,nodeId2
34+
35+
- do:
36+
cluster.state: {}
37+
38+
- length: { metadata.cluster_coordination.voting_config_exclusions: 2 }
39+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "nodeId1", node_name: "_absent_"} }
40+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "nodeId2", node_name: "_absent_"} }
41+
42+
---
43+
"Add voting config exclusion by unknown node name":
44+
- do:
45+
cluster.post_voting_config_exclusions:
46+
node_names: nodeName
47+
48+
- do:
49+
cluster.state: {}
50+
51+
- length: { metadata.cluster_coordination.voting_config_exclusions: 1 }
52+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_id: "_absent_" }
53+
- match: { metadata.cluster_coordination.voting_config_exclusions.0.node_name: "nodeName" }
54+
55+
---
56+
"Add voting config exclusion by unknown node names":
57+
- skip:
58+
reason: "contains is a newly added assertion"
59+
features: contains
60+
61+
- do:
62+
cluster.post_voting_config_exclusions:
63+
node_names: nodeName1,nodeName2
64+
65+
- do:
66+
cluster.state: {}
67+
68+
- length: { metadata.cluster_coordination.voting_config_exclusions: 2 }
69+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "_absent_", node_name: "nodeName1"} }
70+
- contains : { metadata.cluster_coordination.voting_config_exclusions: {node_id: "_absent_", node_name: "nodeName2"} }
71+
72+
---
73+
"Throw exception when adding voting config exclusion without specifying nodes":
74+
- do:
75+
catch: /You must set \[node_names\] or \[node_ids\] but not both/
76+
cluster.post_voting_config_exclusions: {}
77+
78+
---
79+
"Throw exception when adding voting config exclusion and specifying both node_ids and node_names":
80+
- do:
81+
catch: /You must set \[node_names\] or \[node_ids\] but not both/
82+
cluster.post_voting_config_exclusions:
83+
node_ids: nodeId
84+
node_names: nodeName
85+

0 commit comments

Comments
 (0)