Skip to content

Commit fce04d5

Browse files
committed
Add REST YAML test
1 parent 7cd62b0 commit fce04d5

File tree

2 files changed

+145
-1
lines changed

2 files changed

+145
-1
lines changed

server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public class RestClusterStatsAction extends BaseRestHandler {
3333
"human-readable-total-docs-size",
3434
"verbose-dense-vector-mapping-stats",
3535
"ccs-stats",
36-
"retrievers-usage-stats"
36+
"retrievers-usage-stats",
37+
"esql-stats"
3738
);
3839
private static final Set<String> SUPPORTED_QUERY_PARAMETERS = Set.of("include_remotes", "nodeId", REST_TIMEOUT_PARAM);
3940

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
"cross-cluster query stats basic":
3+
- requires:
4+
test_runner_features: [ capabilities ]
5+
capabilities:
6+
- method: GET
7+
path: /_cluster/stats
8+
capabilities:
9+
- "esql-stats"
10+
reason: "Capability required to run test"
11+
12+
- do:
13+
cluster.stats: { }
14+
15+
- is_true: ccs
16+
- is_true: ccs._esql
17+
- is_false: ccs.clusters # no ccs clusters configured
18+
- exists: ccs._esql.total
19+
- exists: ccs._esql.success
20+
- exists: ccs._esql.skipped
21+
- is_true: ccs._esql.took
22+
- exists: ccs._esql.remotes_per_search_max
23+
- exists: ccs._esql.remotes_per_search_avg
24+
- exists: ccs._esql.failure_reasons
25+
- exists: ccs._esql.features
26+
- exists: ccs._esql.clients
27+
- exists: ccs._esql.clusters
28+
29+
---
30+
"cross-cluster stats after query":
31+
- requires:
32+
test_runner_features: [ capabilities ]
33+
capabilities:
34+
- method: GET
35+
path: /_cluster/stats
36+
capabilities:
37+
- "esql-stats"
38+
reason: "Capability required to run test"
39+
40+
- do:
41+
cluster.state: {}
42+
- set: { master_node: master }
43+
- do:
44+
nodes.info:
45+
metric: [ http, transport ]
46+
- set: {nodes.$master.http.publish_address: host}
47+
- set: {nodes.$master.transport.publish_address: transport_host}
48+
49+
- do:
50+
cluster.put_settings:
51+
body:
52+
persistent:
53+
cluster:
54+
remote:
55+
cluster_one:
56+
seeds:
57+
- "${transport_host}"
58+
skip_unavailable: true
59+
cluster_two:
60+
seeds:
61+
- "${transport_host}"
62+
skip_unavailable: false
63+
- is_true: persistent.cluster.remote.cluster_one
64+
65+
- do:
66+
indices.create:
67+
index: test
68+
body:
69+
settings:
70+
number_of_replicas: 0
71+
store.stats_refresh_interval: 0ms
72+
73+
- do:
74+
index:
75+
index: test
76+
id: "1"
77+
refresh: true
78+
body:
79+
foo: bar
80+
81+
- do:
82+
indices.flush:
83+
index: test
84+
85+
- do:
86+
cluster.health:
87+
wait_for_status: green
88+
89+
- do:
90+
esql.query:
91+
body:
92+
query: 'from *,*:*'
93+
94+
- do:
95+
cluster.stats: {}
96+
- is_true: ccs
97+
- is_true: ccs._esql
98+
- is_false: ccs.clusters # Still no remotes since include_remotes is not set
99+
100+
- do:
101+
cluster.stats:
102+
include_remotes: true
103+
- is_true: ccs
104+
- is_true: ccs._esql
105+
- is_true: ccs.clusters # Now we have remotes
106+
- is_true: ccs.clusters.cluster_one
107+
- is_true: ccs.clusters.cluster_two
108+
- is_true: ccs.clusters.cluster_one.cluster_uuid
109+
- match: { ccs.clusters.cluster_one.mode: sniff }
110+
- match: { ccs.clusters.cluster_one.skip_unavailable: true }
111+
- match: { ccs.clusters.cluster_two.skip_unavailable: false }
112+
- is_true: ccs.clusters.cluster_one.version
113+
- match: { ccs.clusters.cluster_one.status: green }
114+
- match: { ccs.clusters.cluster_two.status: green }
115+
- is_true: ccs.clusters.cluster_one.nodes_count
116+
- is_true: ccs.clusters.cluster_one.shards_count
117+
- is_true: ccs.clusters.cluster_one.indices_count
118+
- is_true: ccs.clusters.cluster_one.indices_total_size_in_bytes
119+
- is_true: ccs.clusters.cluster_one.max_heap_in_bytes
120+
- is_true: ccs.clusters.cluster_one.mem_total_in_bytes
121+
- is_true: ccs._esql.total
122+
- is_true: ccs._esql.success
123+
- exists: ccs._esql.skipped
124+
- exists: ccs._esql.took
125+
- exists: ccs._esql.took.max
126+
- exists: ccs._esql.took.avg
127+
- exists: ccs._esql.took.p90
128+
- match: { ccs._esql.remotes_per_search_max: 2 }
129+
- match: { ccs._esql.remotes_per_search_avg: 2.0 }
130+
- exists: ccs._esql.failure_reasons
131+
- exists: ccs._esql.features
132+
- exists: ccs._esql.clients
133+
- is_true: ccs._esql.clusters
134+
- is_true: ccs._esql.clusters.cluster_one
135+
- is_true: ccs._esql.clusters.cluster_two
136+
- gte: {ccs._esql.clusters.cluster_one.total: 1}
137+
- gte: {ccs._esql.clusters.cluster_two.total: 1}
138+
- exists: ccs._esql.clusters.cluster_one.skipped
139+
- exists: ccs._esql.clusters.cluster_two.skipped
140+
- exists: ccs._esql.clusters.cluster_one.took
141+
- exists: ccs._esql.clusters.cluster_one.took.max
142+
- exists: ccs._esql.clusters.cluster_one.took.avg
143+
- exists: ccs._esql.clusters.cluster_one.took.p90

0 commit comments

Comments
 (0)