-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add test for Grafana dashboard discovery
- Loading branch information
Showing
5 changed files
with
204 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bats | ||
|
||
setup() { | ||
load "../common/lib" | ||
|
||
common_setup | ||
} | ||
|
||
grafana_sc_dashboard_logs() { | ||
kubectl -n monitoring logs "deployment/${1}" grafana-sc-dashboard | sed -rn 's#\{"time": ".+", "msg": "Writing /tmp/dashboards/(.+) \(ascii\)", "level": "INFO"\}#- \1#p' | sort -u | ||
} | ||
|
||
grafana_logs() { | ||
kubectl -n monitoring logs "deployment/${1}" grafana | grep 'level=error' | sed -rn 's#.*dashboards/(.+) error="(.+)"#error: \1: \2#p' | sort -u | ||
} | ||
|
||
@test "grafana admin dashboard discovery" { | ||
with_kubeconfig "sc" | ||
|
||
run grafana_sc_dashboard_logs ops-grafana | ||
|
||
while read -r line; do | ||
assert_line "${line}" | ||
done < "${ROOT}/tests/end-to-end/grafana-dashboards-admin.yaml" | ||
} | ||
|
||
@test "grafana dev dashboard discovery" { | ||
with_kubeconfig "sc" | ||
|
||
run grafana_sc_dashboard_logs user-grafana | ||
|
||
while read -r line; do | ||
assert_line "${line}" | ||
done < "${ROOT}/tests/end-to-end/grafana-dashboards-dev.yaml" | ||
} | ||
|
||
@test "grafana admin dashboard load without error" { | ||
with_kubeconfig "sc" | ||
|
||
run grafana_logs ops-grafana | ||
|
||
refute_output | ||
} | ||
|
||
|
||
@test "grafana dev dashboard load without error" { | ||
with_kubeconfig "sc" | ||
|
||
run grafana_logs user-grafana | ||
|
||
refute_output | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
- alertmanager-overview-dashboard.json | ||
- apiserver-dashboard.json | ||
- backup-dashboard.json | ||
- calicofelix-dashboard.json | ||
- ciskubernetesbenchmark-dashboard.json | ||
- cluster-api-dashboard.json | ||
- cluster-total-dashboard.json | ||
- clustercompliancereport-dashboard.json | ||
- daily-dashboard.json | ||
- etcd-dashboard.json | ||
- falco-dashboard.json | ||
- fluentd-dashboard.json | ||
- gatekeeper-dashboard.json | ||
- grafana-overview-dashboard.json | ||
- harbor-dashboard.json | ||
- hnc-dashboard.json | ||
- k8s-coredns-dashboard.json | ||
- k8s-resources-cluster-dashboard.json | ||
- k8s-resources-namespace-dashboard.json | ||
- k8s-resources-node-dashboard.json | ||
- k8s-resources-pod-dashboard.json | ||
- k8s-resources-workload-dashboard.json | ||
- k8s-resources-workloads-namespace-dashboard.json | ||
- kubelet-dashboard.json | ||
- kubernetesstatus-dashboard.json | ||
- namespace-by-pod-dashboard.json | ||
- namespace-by-workload-dashboard.json | ||
- networkpolicy-dashboard.json | ||
- nginx-dashboard.json | ||
- node-cluster-rsrc-use-dashboard.json | ||
- node-exporter-full-dashboard.json | ||
- node-local-dns-dashboard.json | ||
- node-rsrc-use-dashboard.json | ||
- node-spread-dashboard.json | ||
- nodes-dashboard.json | ||
- opensearch-dashboard.json | ||
- persistentvolumesusage-dashboard.json | ||
- pod-total-dashboard.json | ||
- prometheus-blackbox-exporter-dashboard.json | ||
- prometheus-dashboard.json | ||
- prometheus-timeseries-dashboard.json | ||
- proxy-dashboard.json | ||
- thanos-compact-dashboard.json | ||
- thanos-overview-dashboard.json | ||
- thanos-query-dashboard.json | ||
- thanos-query-frontend-dashboard.json | ||
- thanos-receive-dashboard.json | ||
- thanos-rule-dashboard.json | ||
- thanos-store-dashboard.json | ||
- trivy-operator-dashboard.json | ||
- uptime-dashboard.json | ||
- velero-dashboard.json | ||
- welcome-dashboard.json | ||
- workload-total-dashboard.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
- alertmanager-overview-dashboard.json | ||
- apiserver-dashboard.json | ||
- backup-dashboard.json | ||
- ciskubernetesbenchmark-dashboard.json | ||
- cluster-total-dashboard.json | ||
- clustercompliancereport-dashboard.json | ||
- etcd-dashboard.json | ||
- falco-dashboard.json | ||
- fluentd-dashboard.json | ||
- gatekeeper-dashboard.json | ||
- grafana-overview-dashboard.json | ||
- harbor-dashboard.json | ||
- k8s-coredns-dashboard.json | ||
- k8s-resources-cluster-dashboard.json | ||
- k8s-resources-namespace-dashboard.json | ||
- k8s-resources-node-dashboard.json | ||
- k8s-resources-pod-dashboard.json | ||
- k8s-resources-workload-dashboard.json | ||
- k8s-resources-workloads-namespace-dashboard.json | ||
- kubelet-dashboard.json | ||
- kubernetesstatus-dashboard.json | ||
- namespace-by-pod-dashboard.json | ||
- namespace-by-workload-dashboard.json | ||
- networkpolicy-dashboard.json | ||
- nginx-dashboard.json | ||
- node-cluster-rsrc-use-dashboard.json | ||
- node-exporter-full-dashboard.json | ||
- node-local-dns-dashboard.json | ||
- node-rsrc-use-dashboard.json | ||
- node-spread-dashboard.json | ||
- nodes-dashboard.json | ||
- opensearch-dashboard.json | ||
- persistentvolumesusage-dashboard.json | ||
- pod-total-dashboard.json | ||
- prometheus-blackbox-exporter-dashboard.json | ||
- prometheus-dashboard.json | ||
- proxy-dashboard.json | ||
- thanos-compact-dashboard.json | ||
- thanos-overview-dashboard.json | ||
- thanos-query-dashboard.json | ||
- thanos-query-frontend-dashboard.json | ||
- thanos-receive-dashboard.json | ||
- thanos-rule-dashboard.json | ||
- thanos-store-dashboard.json | ||
- trivy-operator-dashboard.json | ||
- uptime-dashboard.json | ||
- welcome-dashboard.json | ||
- workload-total-dashboard.json |