Get group fix,flake8 errors fix,readme and config fix
diff --git a/cvp_checks/tests/ceph/test_ceph_haproxy.py b/cvp_checks/tests/ceph/test_ceph_haproxy.py
index 7bff15b..d6c8e49 100644
--- a/cvp_checks/tests/ceph/test_ceph_haproxy.py
+++ b/cvp_checks/tests/ceph/test_ceph_haproxy.py
@@ -8,9 +8,9 @@
monitor_info = local_salt_client.cmd(
'ceph:mon',
'cmd.run',
- ["echo 'show stat' | nc -U "
- "/var/run/haproxy/admin.sock | "
- "grep ceph_mon_radosgw_cluster"],
+ ["echo 'show stat' | nc -U "
+ "/var/run/haproxy/admin.sock | "
+ "grep ceph_mon_radosgw_cluster"],
expr_form='pillar')
if not monitor_info:
pytest.skip("Ceph is not found on this environment")
diff --git a/cvp_checks/tests/test_contrail.py b/cvp_checks/tests/test_contrail.py
index a469976..b8955f0 100644
--- a/cvp_checks/tests/test_contrail.py
+++ b/cvp_checks/tests/test_contrail.py
@@ -1,6 +1,7 @@
import pytest
import json
+
def test_contrail_compute_status(local_salt_client):
probe = local_salt_client.cmd(
'opencontrail:control', 'cmd.run',
@@ -51,7 +52,7 @@
if 'crashes/core.java.' not in line:
name, status = line.split(None, 1)
else:
- name, status = line,'FATAL'
+ name, status = line, 'FATAL'
if status not in {'active', 'backup'}:
err_msg = "{node}:{service} - {status}".format(
node=node, service=name, status=status)
diff --git a/cvp_checks/tests/test_galera_cluster.py b/cvp_checks/tests/test_galera_cluster.py
index 003b0d6..5a74bdd 100644
--- a/cvp_checks/tests/test_galera_cluster.py
+++ b/cvp_checks/tests/test_galera_cluster.py
@@ -1,3 +1,6 @@
+import pytest
+
+
def test_galera_cluster_status(local_salt_client):
gs = local_salt_client.cmd(
'galera:*',
diff --git a/cvp_checks/tests/test_k8s.py b/cvp_checks/tests/test_k8s.py
index d7aed4b..2ff3383 100644
--- a/cvp_checks/tests/test_k8s.py
+++ b/cvp_checks/tests/test_k8s.py
@@ -1,6 +1,7 @@
import pytest
import json
+
def test_k8s_get_cs_status(local_salt_client):
result = local_salt_client.cmd(
'etcd:server', 'cmd.run',
@@ -17,11 +18,11 @@
continue
else:
if 'Healthy' not in line:
- errors.append (line)
+ errors.append(line)
break
assert not errors, 'k8s is not healthy: {}'.format(json.dumps(
- errors,
- indent=4))
+ errors,
+ indent=4))
def test_k8s_get_nodes_status(local_salt_client):
@@ -40,8 +41,8 @@
continue
else:
if 'Ready' not in line:
- errors.append (line)
+ errors.append(line)
break
assert not errors, 'k8s is not healthy: {}'.format(json.dumps(
- errors,
- indent=4))
+ errors,
+ indent=4))
diff --git a/cvp_checks/tests/test_mtu.py b/cvp_checks/tests/test_mtu.py
index be17237..8d76cef 100644
--- a/cvp_checks/tests/test_mtu.py
+++ b/cvp_checks/tests/test_mtu.py
@@ -9,10 +9,12 @@
utils.get_groups(os.path.basename(__file__))
)
def test_mtu(local_salt_client, group):
+ testname = os.path.basename(__file__).split('.')[0]
if "skipped" in group:
pytest.skip("skipped in config")
config = utils.get_configuration()
- skipped_ifaces = config["skipped_ifaces"]
+ skipped_ifaces = config.get(testname)["skipped_ifaces"] or \
+ ["bonding_masters", "lo", "veth", "tap", "cali"]
total = {}
network_info = local_salt_client.cmd(
group, 'cmd.run', ['ls /sys/class/net/'], expr_form='pcre')
@@ -68,4 +70,3 @@
assert len(mtu_data) == 0, \
"Several problems found for {0} group: {1}".format(
group, json.dumps(mtu_data, indent=4))
-
diff --git a/cvp_checks/tests/test_ntp_sync.py b/cvp_checks/tests/test_ntp_sync.py
index b900e12..09b323f 100644
--- a/cvp_checks/tests/test_ntp_sync.py
+++ b/cvp_checks/tests/test_ntp_sync.py
@@ -17,9 +17,10 @@
'cmd.run',
['date +%s'],
expr_form='compound')
+ diff = config.get(testname)["time_deviation"] or 30
for node, time in nodes_time.iteritems():
- if (int(time) - saltmaster_time) > config.get(testname)["time_deviation"] or \
- (int(time) - saltmaster_time) < -config.get(testname)["time_deviation"]:
+ if (int(time) - saltmaster_time) > diff or \
+ (int(time) - saltmaster_time) < -diff:
fail[node] = time
assert not fail, 'SaltMaster time: {}\n' \
diff --git a/cvp_checks/tests/test_rabbit_cluster.py b/cvp_checks/tests/test_rabbit_cluster.py
index 94de975..acd4a96 100644
--- a/cvp_checks/tests/test_rabbit_cluster.py
+++ b/cvp_checks/tests/test_rabbit_cluster.py
@@ -1,6 +1,3 @@
-import re
-
-
def test_checking_rabbitmq_cluster(local_salt_client):
# disable config for this test
# it may be reintroduced in future
diff --git a/cvp_checks/tests/test_repo_list.py b/cvp_checks/tests/test_repo_list.py
index bd3214c..07f16d0 100644
--- a/cvp_checks/tests/test_repo_list.py
+++ b/cvp_checks/tests/test_repo_list.py
@@ -19,9 +19,10 @@
['cat /etc/apt/sources.list.d/*;'
'cat /etc/apt/sources.list|grep deb|grep -v "#"'],
expr_form='pcre')
- actual_repo_list = [item.replace('/ ', ' ').replace('[arch=amd64] ','')
+ actual_repo_list = [item.replace('/ ', ' ').replace('[arch=amd64] ', '')
for item in raw_actual_info.values()[0].split('\n')]
- expected_salt_data = [repo['source'].replace('/ ', ' ').replace('[arch=amd64] ','')
+ expected_salt_data = [repo['source'].replace('/ ', ' ')
+ .replace('[arch=amd64] ', '')
for repo in info_salt.values()[0]
['linux:system:repo'].values()]
@@ -44,6 +45,6 @@
diff[repo] = rows
assert fail_counter == 0, \
"Several problems found for {0} group: {1}".format(
- group, json.dumps(diff, indent=4))
+ group, json.dumps(diff, indent=4))
if fail_counter == 0 and len(diff) > 0:
print "\nWarning: nodes contain more repos than reclass"