Skip to content

Commit bff56e1

Browse files
authored
TSDB: More tests (#78208)
This adds more tests copied from the our original TSDB prototype in PR #75638 that are still applicable time series mode indices. There are a bunch of disabled assertions because we are not yet generating `_tsid` but the non-disabled assertions are useful. And we will soon be generating the `_tsid` so we can re-enable those assertions.
1 parent bfb5218 commit bff56e1

File tree

5 files changed

+878
-0
lines changed

5 files changed

+878
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
setup:
2+
- skip:
3+
version: " - 7.99.99"
4+
reason: introduced in 8.0.0
5+
6+
- do:
7+
indices.create:
8+
index: test
9+
body:
10+
settings:
11+
index:
12+
mode: time_series
13+
mappings:
14+
properties:
15+
"@timestamp":
16+
type: date
17+
metricset:
18+
type: keyword
19+
time_series_dimension: true
20+
k8s:
21+
properties:
22+
pod:
23+
properties:
24+
uid:
25+
type: keyword
26+
time_series_dimension: true
27+
name:
28+
type: keyword
29+
ip:
30+
type: ip
31+
network:
32+
properties:
33+
tx:
34+
type: long
35+
rx:
36+
type: long
37+
- do:
38+
bulk:
39+
refresh: true
40+
index: test
41+
body:
42+
- '{"index": {}}'
43+
- '{"@timestamp": "2021-04-28T18:50:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
44+
- '{"index": {}}'
45+
- '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2005177954, "rx": 801479970}}}}'
46+
- '{"index": {}}'
47+
- '{"@timestamp": "2021-04-28T18:50:44.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2006223737, "rx": 802337279}}}}'
48+
- '{"index": {}}'
49+
- '{"@timestamp": "2021-04-28T18:51:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.2", "network": {"tx": 2012916202, "rx": 803685721}}}}'
50+
- '{"index": {}}'
51+
- '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434521831, "rx": 530575198}}}}'
52+
- '{"index": {}}'
53+
- '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434577921, "rx": 530600088}}}}'
54+
- '{"index": {}}'
55+
- '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434587694, "rx": 530604797}}}}'
56+
- '{"index": {}}'
57+
- '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}'
58+
59+
---
60+
query a dimension:
61+
- skip:
62+
version: " - 7.99.99"
63+
reason: introduced in 8.0.0
64+
65+
- do:
66+
search:
67+
index: test
68+
body:
69+
query:
70+
match:
71+
k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507
72+
73+
- match: {hits.total.value: 4}
74+
75+
---
76+
query a metric:
77+
- skip:
78+
version: " - 7.99.99"
79+
reason: introduced in 8.0.0
80+
81+
- do:
82+
search:
83+
index: test
84+
body:
85+
query:
86+
range:
87+
k8s.pod.network.tx:
88+
gt: 2006223737
89+
90+
- match: {hits.total.value: 1}
91+
92+
# TODO add test showing that quering _tsid fails
93+
94+
---
95+
fetch a dimension:
96+
- skip:
97+
version: " - 7.99.99"
98+
reason: introduced in 8.0.0
99+
100+
- do:
101+
search:
102+
index: test
103+
body:
104+
fields:
105+
- field: k8s.pod.uid
106+
query:
107+
query_string:
108+
query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat'
109+
110+
- match: {hits.total.value: 1}
111+
- match: {hits.hits.0.fields.k8s\.pod\.uid: [947e4ced-1786-4e53-9e0c-5c447e959507]}
112+
113+
---
114+
fetch a metric:
115+
- skip:
116+
version: " - 7.99.99"
117+
reason: introduced in 8.0.0
118+
119+
- do:
120+
search:
121+
index: test
122+
body:
123+
fields:
124+
- field: k8s.pod.network.tx
125+
query:
126+
query_string:
127+
query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat'
128+
129+
- match: {hits.total.value: 1}
130+
- match: {hits.hits.0.fields.k8s\.pod\.network\.tx: [2012916202]}
131+
- is_false: hits.hits.0.fields._tsid # tsid isn't fetched by default
132+
133+
---
134+
fetch a tag:
135+
- skip:
136+
version: " - 7.99.99"
137+
reason: introduced in 8.0.0
138+
139+
- do:
140+
search:
141+
index: test
142+
body:
143+
fields:
144+
- field: k8s.pod.ip
145+
query:
146+
query_string:
147+
query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat'
148+
149+
- match: {hits.total.value: 1}
150+
- match: {hits.hits.0.fields.k8s\.pod\.ip: ['10.10.55.2']}
151+
- is_false: hits.hits.0.fields._tsid # tsid isn't fetched by default
152+
153+
# TODO add test to fetch the tsid
154+
155+
---
156+
aggregate a dimension:
157+
- skip:
158+
version: " - 7.99.99"
159+
reason: introduced in 8.0.0
160+
161+
- do:
162+
search:
163+
index: test
164+
body:
165+
size: 0
166+
aggs:
167+
uids:
168+
terms:
169+
field: k8s.pod.uid
170+
171+
- match: {hits.total.value: 8}
172+
- match: {aggregations.uids.buckets.0.key: 947e4ced-1786-4e53-9e0c-5c447e959507}
173+
- match: {aggregations.uids.buckets.0.doc_count: 4}
174+
- match: {aggregations.uids.buckets.1.key: df3145b3-0563-4d3b-a0f7-897eb2876ea9}
175+
- match: {aggregations.uids.buckets.1.doc_count: 4}
176+
177+
---
178+
aggregate a metric:
179+
- skip:
180+
version: " - 7.99.99"
181+
reason: introduced in 8.0.0
182+
183+
- do:
184+
search:
185+
index: test
186+
body:
187+
size: 0
188+
aggs:
189+
uids:
190+
terms:
191+
field: k8s.pod.uid
192+
aggs:
193+
max_rx:
194+
max:
195+
field: k8s.pod.network.rx
196+
197+
- match: {hits.total.value: 8}
198+
- match: {aggregations.uids.buckets.0.key: 947e4ced-1786-4e53-9e0c-5c447e959507}
199+
- match: {aggregations.uids.buckets.0.doc_count: 4}
200+
- match: {aggregations.uids.buckets.0.max_rx.value: 803685721}
201+
- match: {aggregations.uids.buckets.1.key: df3145b3-0563-4d3b-a0f7-897eb2876ea9}
202+
- match: {aggregations.uids.buckets.1.doc_count: 4}
203+
- match: {aggregations.uids.buckets.1.max_rx.value: 530605511}
204+
205+
---
206+
aggregate a tag:
207+
- skip:
208+
version: " - 7.99.99"
209+
reason: introduced in 8.0.0
210+
211+
- do:
212+
search:
213+
index: test
214+
body:
215+
size: 0
216+
aggs:
217+
ips:
218+
terms:
219+
field: k8s.pod.ip
220+
order:
221+
_key: asc
222+
223+
- match: {hits.total.value: 8}
224+
- match: {aggregations.ips.buckets.0.key: 10.10.55.1}
225+
- match: {aggregations.ips.buckets.0.doc_count: 3}
226+
- match: {aggregations.ips.buckets.1.key: 10.10.55.2}
227+
- match: {aggregations.ips.buckets.1.doc_count: 1}
228+
- match: {aggregations.ips.buckets.2.key: 10.10.55.3}
229+
- match: {aggregations.ips.buckets.2.doc_count: 4}
230+
231+
232+
# TODO add a test aggregating the _tsid
233+
234+
---
235+
field capabilities:
236+
- skip:
237+
version: " - 7.99.99"
238+
reason: introduced in 8.0.0
239+
240+
- do:
241+
field_caps:
242+
index: test
243+
fields: [k8s.pod.uid, k8s.pod.network.rx, k8s.pod.ip, _tsid]
244+
245+
# TODO assert time_series_metric and time_series_dimension
246+
- match: {fields.k8s\.pod\.uid.keyword.searchable: true}
247+
- match: {fields.k8s\.pod\.uid.keyword.aggregatable: true}
248+
- is_false: fields.k8s\.pod\.uid.keyword.indices
249+
- is_false: fields.k8s\.pod\.uid.keyword.non_searchable_indices
250+
- is_false: fields.k8s\.pod\.uid.keyword.non_aggregatable_indices
251+
- match: {fields.k8s\.pod\.network\.rx.long.searchable: true}
252+
- match: {fields.k8s\.pod\.network\.rx.long.aggregatable: true}
253+
- is_false: fields.k8s\.pod\.network\.rx.long.indices
254+
- is_false: fields.k8s\.pod\.network\.rx.long.non_searchable_indices
255+
- is_false: fields.k8s\.pod\.network\.rx.long.non_aggregatable_indices
256+
- match: {fields.k8s\.pod\.ip.ip.searchable: true}
257+
- match: {fields.k8s\.pod\.ip.ip.aggregatable: true}
258+
- is_false: fields.k8s\.pod\.ip.ip.indices
259+
- is_false: fields.k8s\.pod\.ip.ip.non_searchable_indices
260+
- is_false: fields.k8s\.pod\.ip.ip.non_aggregatable_indices
261+
# TODO assert tsid once we build it:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
setup:
2+
- skip:
3+
version: " - 7.99.99"
4+
reason: introduced in 8.0.0
5+
6+
- do:
7+
indices.create:
8+
index: test
9+
body:
10+
settings:
11+
index:
12+
mode: time_series
13+
mappings:
14+
properties:
15+
"@timestamp":
16+
type: date
17+
metricset:
18+
type: keyword
19+
time_series_dimension: true
20+
k8s:
21+
properties:
22+
pod:
23+
properties:
24+
uid:
25+
type: keyword
26+
time_series_dimension: true
27+
name:
28+
type: keyword
29+
ip:
30+
type: ip
31+
network:
32+
properties:
33+
tx:
34+
type: long
35+
rx:
36+
type: long
37+
- do:
38+
bulk:
39+
refresh: true
40+
index: test
41+
body:
42+
- '{"index": {}}'
43+
- '{"@timestamp": "2021-04-28T18:50:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
44+
- '{"index": {}}'
45+
- '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2005177954, "rx": 801479970}}}}'
46+
- '{"index": {}}'
47+
- '{"@timestamp": "2021-04-28T18:50:44.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2006223737, "rx": 802337279}}}}'
48+
- '{"index": {}}'
49+
- '{"@timestamp": "2021-04-28T18:51:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.2", "network": {"tx": 2012916202, "rx": 803685721}}}}'
50+
- '{"index": {}}'
51+
- '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434521831, "rx": 530575198}}}}'
52+
- '{"index": {}}'
53+
- '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434577921, "rx": 530600088}}}}'
54+
- '{"index": {}}'
55+
- '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434587694, "rx": 530604797}}}}'
56+
- '{"index": {}}'
57+
- '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}'
58+
59+
# TODO search on _tsid in an alias
60+
61+
---
62+
index into alias:
63+
- skip:
64+
version: " - 7.99.99"
65+
reason: introduced in 8.0.0
66+
67+
- do:
68+
indices.put_alias:
69+
index: test
70+
name: test_alias
71+
72+
- do:
73+
bulk:
74+
refresh: true
75+
index: test_alias
76+
body:
77+
- '{"index": {}}'
78+
- '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434521831, "rx": 530575198}}}}'
79+
- '{"index": {}}'
80+
- '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434577921, "rx": 530600088}}}}'
81+
- '{"index": {}}'
82+
- '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434587694, "rx": 530604797}}}}'
83+
- '{"index": {}}'
84+
- '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434595272, "rx": 530605511}}}}'
85+
- match: {errors: false}
86+
87+
# TODO search on tsid once we generate it

0 commit comments

Comments
 (0)