Fix test_cinder_services
Related-PROD: PROD-21985
Change-Id: I9cdd1508cbb1aaf78b2e9dd622cfc522c163ada2
diff --git a/cvp_checks/tests/test_cinder_services.py b/cvp_checks/tests/test_cinder_services.py
index 2117f6f..20bd17d 100644
--- a/cvp_checks/tests/test_cinder_services.py
+++ b/cvp_checks/tests/test_cinder_services.py
@@ -2,19 +2,28 @@
def test_cinder_services(local_salt_client):
- service_down = local_salt_client.cmd(
+ cinder_backends_info = local_salt_client.cmd(
'cinder:controller',
+ 'pillar.get',
+ ['cinder:controller:backend'],
+ expr_form='pillar')
+ if not cinder_backends_info:
+ pytest.skip("Cinder is not found on this environment")
+ service_down = local_salt_client.cmd(
+ 'keystone:server',
'cmd.run',
['. /root/keystonerc; cinder service-list | grep "down\|disabled"'],
expr_form='pillar')
- if not service_down:
- pytest.skip("Cinder is not found on this environment")
cinder_volume = local_salt_client.cmd(
'keystone:server',
'cmd.run',
- ['. /root/keystonerc; cinder service-list | grep "volume" | wc -l'],
+ ['. /root/keystonerc; cinder service-list | grep -c "volume"'],
expr_form='pillar')
+ backends_cinder = cinder_backends_info[cinder_backends_info.keys()[0]]
+ backends_num = len(backends_cinder.keys())
assert service_down[service_down.keys()[0]] == '', \
'''Some cinder services are in wrong state'''
- assert cinder_volume[cinder_volume.keys()[0]] == '1', \
- '''There are more than 1 host/backend for cinder'''
+ assert cinder_volume[cinder_volume.keys()[0]] == str(backends_num), \
+ 'Number of cinder-volume services ({0}) does not match ' \
+ 'number of volume backends ({1})'.format(
+ cinder_volume[cinder_volume.keys()[0]], str(backends_num))