summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
authorOstap Batih <o.batih@samsung.com>2021-12-30 14:54:31 +0000
committerOstap Batih <o.batih@samsung.com>2022-01-03 13:33:58 +0000
commitf864a57ba929011509077564525a4582f4beec4b (patch)
tree20092e9ff7a93b8392c1052703052ca852eb6909 /ansible
parent8de1c4868cf72bd1929dc3088757f3ae1c2593be (diff)
[MOLECULE] Add testinfra tests for kube-prometheus-stack role
Issue-ID: OOM-2889 Signed-off-by: Ostap Batih <o.batih@samsung.com> Change-Id: I64af5aadcc14c864a27806f20d56e0d7007ff33d
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/kube-prometheus-stack/molecule/default/tests/test_default.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/ansible/roles/kube-prometheus-stack/molecule/default/tests/test_default.py b/ansible/roles/kube-prometheus-stack/molecule/default/tests/test_default.py
new file mode 100644
index 00000000..ad2d90c3
--- /dev/null
+++ b/ansible/roles/kube-prometheus-stack/molecule/default/tests/test_default.py
@@ -0,0 +1,32 @@
+import yaml
+
+
+def test_prometheus_helm_package(host):
+ assert host.file('/opt/onap/downloads/'
+ 'kube-prometheus-stack-18.0.4.tgz').exists
+
+
+def test_helm_values_file(host):
+ y = None
+ f = host.file('/opt/onap/kube_prometheus_values.yaml')
+ assert f.exists
+ assert f.is_file
+ try:
+ y = yaml.safe_load(f.content)
+ except yaml.YAMLError:
+ assert False
+ assert y['grafana']['adminPassword'] == 'grafana'
+ assert (y['grafana']['env']['GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH'] ==
+ '/var/lib/grafana/dashboards/grafana_home.json')
+ assert (y['grafana']['persistence']['storageClassName'] ==
+ 'kube-prometheus-grafana')
+ assert (y['prometheus']['prometheusSpec']['storageSpec']
+ ['volumeClaimTemplate']['spec']['storageClassName'] ==
+ 'kube-prometheus-prometheus')
+
+
+def test_grafana_dashboards(host):
+ assert host.file('/nfs/kube-prometheus/kube-prometheus-grafana/'
+ 'dashboards/custom/grafana_dashboard.json').exists
+ assert host.file('/nfs/kube-prometheus/kube-prometheus-grafana/'
+ 'dashboards/grafana_home.json').exists