blob: e6b8c8eedd3fab055f730d501b526ef76f48cf48 [file] [log] [blame]
Oleksii Zhurbae592ed12018-06-21 18:01:09 -05001import pytest
2
3
Oleksii Zhurbab9bf5452018-03-26 14:27:41 -05004def test_cinder_services(local_salt_client):
Oleksii Zhurbae502d662018-08-07 16:46:14 -05005 cinder_backends_info = local_salt_client.cmd(
Oleksii Zhurbae592ed12018-06-21 18:01:09 -05006 'cinder:controller',
Oleksii Zhurbae502d662018-08-07 16:46:14 -05007 'pillar.get',
8 ['cinder:controller:backend'],
9 expr_form='pillar')
10 if not cinder_backends_info:
Oleksii Zhurba9848e212018-09-05 10:53:51 -050011 pytest.skip("Cinder service or cinder:controller pillar \
12 are not found on this environment.")
Oleksii Zhurbae502d662018-08-07 16:46:14 -050013 service_down = local_salt_client.cmd(
14 'keystone:server',
Oleksii Zhurbab9bf5452018-03-26 14:27:41 -050015 'cmd.run',
Oleksii Zhurba5c56c242018-12-05 16:46:17 -060016 ['. /root/keystonercv3; cinder service-list | grep "down\|disabled"'],
Oleksii Zhurbab9bf5452018-03-26 14:27:41 -050017 expr_form='pillar')
18 cinder_volume = local_salt_client.cmd(
19 'keystone:server',
20 'cmd.run',
Oleksii Zhurba5c56c242018-12-05 16:46:17 -060021 ['. /root/keystonercv3; cinder service-list | grep -c "volume"'],
Oleksii Zhurbab9bf5452018-03-26 14:27:41 -050022 expr_form='pillar')
Oleksii Zhurbae502d662018-08-07 16:46:14 -050023 backends_cinder = cinder_backends_info[cinder_backends_info.keys()[0]]
24 backends_num = len(backends_cinder.keys())
Oleksii Zhurbab9bf5452018-03-26 14:27:41 -050025 assert service_down[service_down.keys()[0]] == '', \
26 '''Some cinder services are in wrong state'''
Oleksii Zhurbae502d662018-08-07 16:46:14 -050027 assert cinder_volume[cinder_volume.keys()[0]] == str(backends_num), \
28 'Number of cinder-volume services ({0}) does not match ' \
29 'number of volume backends ({1})'.format(
30 cinder_volume[cinder_volume.keys()[0]], str(backends_num))