Fixed skip messages to match pillars
Change-Id: I5bdbaf7a2c6d59f68a37cb2213b8c31f64e742d3
diff --git a/cvp_checks/tests/test_cinder_services.py b/cvp_checks/tests/test_cinder_services.py
index 20bd17d..f6aaf4a 100644
--- a/cvp_checks/tests/test_cinder_services.py
+++ b/cvp_checks/tests/test_cinder_services.py
@@ -8,7 +8,8 @@
['cinder:controller:backend'],
expr_form='pillar')
if not cinder_backends_info:
- pytest.skip("Cinder is not found on this environment")
+ pytest.skip("Cinder service or cinder:controller pillar \
+ are not found on this environment.")
service_down = local_salt_client.cmd(
'keystone:server',
'cmd.run',
diff --git a/cvp_checks/tests/test_galera_cluster.py b/cvp_checks/tests/test_galera_cluster.py
index 5a74bdd..676f09b 100644
--- a/cvp_checks/tests/test_galera_cluster.py
+++ b/cvp_checks/tests/test_galera_cluster.py
@@ -9,7 +9,8 @@
expr_form='pillar')
if not gs:
- pytest.skip("Galera is not found on this environment")
+ pytest.skip("Galera service or galera:* pillar \
+ are not found on this environment.")
size_cluster = []
amount = len(gs)
diff --git a/cvp_checks/tests/test_nova_services.py b/cvp_checks/tests/test_nova_services.py
index 7332a49..84ca19b 100644
--- a/cvp_checks/tests/test_nova_services.py
+++ b/cvp_checks/tests/test_nova_services.py
@@ -1,8 +1,16 @@
+import pytest
+
+
def test_nova_services_status(local_salt_client):
result = local_salt_client.cmd(
'keystone:server',
'cmd.run',
['. /root/keystonerc; nova service-list | grep "down\|disabled" | grep -v "Forced down"'],
expr_form='pillar')
+
+ if not result:
+ pytest.skip("Nova service or keystone:server pillar \
+ are not found on this environment.")
+
assert result[result.keys()[0]] == '', \
'''Some nova services are in wrong state'''
diff --git a/cvp_checks/tests/test_stacklight.py b/cvp_checks/tests/test_stacklight.py
index f63b233..80917f1 100644
--- a/cvp_checks/tests/test_stacklight.py
+++ b/cvp_checks/tests/test_stacklight.py
@@ -1,6 +1,7 @@
import json
import requests
import datetime
+import pytest
from cvp_checks import utils
@@ -10,6 +11,11 @@
'pillar.get',
['_param:haproxy_elasticsearch_bind_host'],
expr_form='pillar')
+
+ if not salt_output:
+ pytest.skip("Kibana service or kibana:server pillar \
+ are not found on this environment.")
+
proxies = {"http": None, "https": None}
for node in salt_output.keys():
IP = salt_output[node]
@@ -44,6 +50,11 @@
'pillar.get',
['_param:haproxy_elasticsearch_bind_host'],
expr_form='pillar')
+
+ if not salt_output:
+ pytest.skip("Kibana service or kibana:server pillar \
+ are not found on this environment.")
+
IP = salt_output.values()[0]
proxies = {"http": None, "https": None}
resp = json.loads(requests.post('http://{0}:9200/log-{1}/_search?pretty'.
@@ -77,6 +88,12 @@
'cmd.run',
['docker service ls'],
expr_form='pillar')
+
+ if not salt_output:
+ pytest.skip("Docker replicas or \
+ docker:client:stack:monitoring pillar \
+ are not found on this environment.")
+
wrong_items = []
for line in salt_output[salt_output.keys()[0]].split('\n'):
if line[line.find('/') - 1] != line[line.find('/') + 1] \
@@ -98,6 +115,11 @@
['curl -s http://{}:15010/alerts | grep icon-chevron-down | '
'grep -v "0 active"'.format(IP)],
expr_form='pillar')
+
+ if not nodes_info:
+ pytest.skip("Prometheus server url or keystone:server \
+ pillar are not found on this environment.")
+
result = nodes_info[nodes_info.keys()[0]].replace('</td>', '').replace(
'<td><i class="icon-chevron-down"></i> <b>', '').replace('</b>', '')
assert result == '', 'AlertManager page has some alerts! {}'.format(
@@ -110,6 +132,11 @@
'cmd.run',
['docker service ps $(docker stack services -q monitoring)'],
expr_form='pillar')
+
+ if not salt_output:
+ pytest.skip("Docker or docker:swarm:role:master \
+ pillar are not found on this environment.")
+
result = {}
# for old reclass models, docker:swarm:role:master can return
# 2 nodes instead of one. Here is temporary fix.
@@ -136,8 +163,13 @@
'service.status',
'telegraf',
expr_form='pillar')
+
+ if not salt_output:
+ pytest.skip("Telegraf or telegraf:agent \
+ pillar are not found on this environment.")
+
result = [{node: status} for node, status
in salt_output.items()
if status is False]
assert result == [], 'Telegraf service is not running ' \
- 'on following nodes:'.format(result)
+ 'on following nodes: {}'.format(result)