Skip to content

Commit 93dc2b9

Browse files
test: unit test config
Part of #206
1 parent a5e2290 commit 93dc2b9

File tree

2 files changed

+482
-0
lines changed

2 files changed

+482
-0
lines changed

tests/unit/config.jsonnet

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Can't test negative cases here since jsonnet do not have error catch
2+
// https://github.com/google/jsonnet/issues/415
3+
4+
local config = import 'dashboard/build/config.libsonnet';
5+
local config_example = importstr 'config.yml';
6+
7+
{
8+
default_prometheus: config.prepare({
9+
type: 'prometheus',
10+
}),
11+
12+
default_influxdb: config.prepare({
13+
type: 'influxdb',
14+
}),
15+
16+
example_basic: config.prepare(std.parseYaml(config_example)),
17+
18+
example_prometheus_dashboard_with_template_variables: config.prepare(std.parseYaml(|||
19+
type: prometheus
20+
datasource: '$prometheus'
21+
filters: {
22+
job: ['=~', '$job'],
23+
alias: ['=~', '$alias'],
24+
}
25+
|||)),
26+
27+
example_prometheus_static_dashboard: config.prepare(std.parseYaml(|||
28+
type: prometheus
29+
datasource: MyPrometheusWithTarantoolMetrics
30+
filters: {
31+
job: ['=', 'MyJobWithTarantoolMetrics'],
32+
}
33+
|||)),
34+
35+
example_prometheus_static_dashboard_with_additional_labels: config.prepare(std.parseYaml(|||
36+
type: prometheus
37+
datasource: MyPrometheusWithTarantoolMetrics
38+
filters: {
39+
job: ['=', 'MyJobWithTarantoolMetrics'],
40+
vendor_app_tag: ['=', 'MyCacheApplication'],
41+
}
42+
|||)),
43+
44+
example_prometheus_static_dashboard_with_specific_sections: config.prepare(std.parseYaml(|||
45+
type: prometheus
46+
datasource: MyPrometheusWithTarantoolMetrics
47+
filters: {
48+
job: ['=', 'MyJobWithTarantoolMetrics'],
49+
}
50+
sections:
51+
- cluster
52+
- replication
53+
- http
54+
- net
55+
- slab
56+
- space
57+
- runtime
58+
- luajit
59+
- operations
60+
|||)),
61+
62+
example_prometheus_static_TDG_dashboard: config.prepare(std.parseYaml(|||
63+
type: prometheus
64+
title: Tarantool Data Grid dashboard
65+
grafana_tags: [tarantool, TDG]
66+
datasource: MyPrometheusWithTDGMetrics
67+
filters: {
68+
job: ['=', 'MyJobWithTDGMetrics'],
69+
}
70+
sections:
71+
- cluster
72+
- replication
73+
- http
74+
- net
75+
- slab
76+
- mvcc
77+
- space
78+
- vinyl
79+
- cpu_extended
80+
- runtime
81+
- luajit
82+
- operations
83+
- crud
84+
- tdg_kafka_common
85+
- tdg_kafka_brokers
86+
- tdg_kafka_topics
87+
- tdg_kafka_consumer
88+
- tdg_kafka_producer
89+
- expirationd
90+
- tdg_tuples
91+
- tdg_file_connectors
92+
- tdg_graphql
93+
- tdg_iproto
94+
- tdg_rest_api
95+
- tdg_tasks
96+
|||)),
97+
98+
example_influxdb_dashboard_with_template_variables: config.prepare(std.parseYaml(|||
99+
type: influxdb
100+
datasource: '$influxdb'
101+
policy: '$policy'
102+
measurement: '$measurement'
103+
filters: {
104+
label_pairs_alias: ['=~', '/^$label_pairs_alias$/'],
105+
}
106+
|||)),
107+
108+
example_influxdb_static_dashboard: config.prepare(std.parseYaml(|||
109+
type: influxdb
110+
datasource: MyInfluxDBWithTarantoolMetrics
111+
policy: default
112+
measurement: MyMeasurementWithTarantoolMetrics
113+
|||)),
114+
115+
filters_truncating: config.prepare({
116+
type: 'influxdb',
117+
filters: {
118+
job: null,
119+
},
120+
}),
121+
}

0 commit comments

Comments
 (0)