Skip to content

Commit 4ac8d55

Browse files
authored
Add YAML rest test for /_cat/component_templates (#119920)
We didn't have a YAML test for this API, and we're reusing the YAML tests elsewhere as a smoke test for functionality, so it's helpful to have one for this API.
1 parent 20edf4c commit 4ac8d55

File tree

1 file changed

+122
-0
lines changed
  • rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.component_templates

1 file changed

+122
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
setup:
3+
4+
- do:
5+
cluster.put_component_template:
6+
name: captain_america
7+
body:
8+
template:
9+
settings:
10+
sort:
11+
field: field
12+
mappings:
13+
properties:
14+
field:
15+
type: keyword
16+
aliases:
17+
steve_rogers: {}
18+
19+
- do:
20+
cluster.put_component_template:
21+
name: ms_marvel
22+
body:
23+
template:
24+
settings:
25+
default_pipeline: pipeline_a
26+
final_pipeline: pipeline_b
27+
version: 2
28+
_meta:
29+
data: {}
30+
31+
- do:
32+
cluster.put_component_template:
33+
name: captain_marvel
34+
body:
35+
version: 3
36+
template:
37+
mappings:
38+
properties:
39+
field1:
40+
type: keyword
41+
field2:
42+
type: long
43+
aliases:
44+
carol_danvers: {}
45+
monica_rambeau: {}
46+
47+
48+
---
49+
"Retrieve all":
50+
51+
- do:
52+
cat.component_templates: {}
53+
54+
- match:
55+
$body: >
56+
/
57+
(^|\n)captain_america \s*
58+
1 \s*
59+
1 \s*
60+
1 \s*
61+
0 \s*
62+
\[\]\s*
63+
(\n|$)
64+
/
65+
66+
- match:
67+
$body: >
68+
/
69+
(^|\n)captain_marvel \s+
70+
3 \s+
71+
2 \s+
72+
2 \s+
73+
0 \s+
74+
0 \s+
75+
\[\]\s*
76+
(\n|$)
77+
/
78+
79+
- match:
80+
$body: >
81+
/
82+
(^|\n)ms_marvel \s+
83+
2 \s+
84+
0 \s+
85+
0 \s+
86+
2 \s+
87+
1 \s+
88+
\[\]\s*
89+
(\n|$)
90+
/
91+
92+
---
93+
"Retrieve by name (verbose/headers)":
94+
95+
- do:
96+
cat.component_templates:
97+
name: ms_marvel
98+
v: true
99+
100+
- match:
101+
$body: >
102+
/
103+
^name \s+version \s*alias_count \s*mapping_count \s*settings_count \s*metadata_count \s*included_in\n
104+
ms_marvel \s* 2 \s* 0 \s* 0 \s* 2 \s* 1 \s*\[\]\s*$
105+
/
106+
107+
108+
---
109+
"Retrieve by wildcard (sorted)":
110+
111+
- do:
112+
cat.component_templates:
113+
name: captain_*
114+
s: name
115+
116+
- match:
117+
$body: >
118+
/
119+
^captain_america \s* \s*1 \s*1 \s*1 \s*0 \s*\[\]\s*\n
120+
captain_marvel \s*3 \s*2 \s*2 \s*0 \s*0 \s*\[\]\s*$
121+
/
122+

0 commit comments

Comments
 (0)