Fixed skip messages to match pillars
Change-Id: I5bdbaf7a2c6d59f68a37cb2213b8c31f64e742d3
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)