diff options
author | Ostap Batih <o.batih@samsung.com> | 2021-12-30 14:54:31 +0000 |
---|---|---|
committer | Ostap Batih <o.batih@samsung.com> | 2022-01-04 13:47:04 +0000 |
commit | af52518f9b7328ca36433d7de33f15428af96503 (patch) | |
tree | b97bde8a9b9807523c2053a53550b8f2f51be068 | |
parent | 000cd0b8a3075d59f1e93a40c775662a3c2062f7 (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
-rw-r--r-- | ansible/roles/kube-prometheus-stack/molecule/default/tests/test_default.py | 32 |
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 |