blob: a612bca9d2d89b3abef3c1cb30fc541f181651b5 [file] [log] [blame]
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03001import pytest
Hanna Arhipova1eef8312019-05-06 20:14:18 +03002import logging
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03003
4
Oleksii Zhurba23c18332019-05-09 18:53:40 -05005@pytest.mark.sl_dup
6#CinderServiceDown, CinderServicesDownMinor
7@pytest.mark.full
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03008def test_cinder_services_are_up(local_salt_client, check_cinder_backends):
9 """
10 # Make sure that cinder backend exists with next command: `salt -C "I@cinder:controller" pillar.get cinder:controller:backend`
11 # Check that all services has 'Up' status in output of `cinder service-list` on keystone:server nodes
12 """
13 service_down = local_salt_client.cmd_any(
14 tgt='keystone:server',
15 param='. /root/keystonercv3; cinder service-list | grep "down\|disabled"')
16 assert service_down == '', \
17 '''Some cinder services are in wrong state'''
18
Oleksii Zhurba23c18332019-05-09 18:53:40 -050019@pytest.mark.full
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030020def test_cinder_services_has_all_backends(local_salt_client, check_cinder_backends):
21 """
22 # Make sure that cinder backend exists with next command: `salt -C "I@cinder:controller" pillar.get cinder:controller:backend`
23 # Check that quantity of backend in cinder:controller:backend pillar is similar to list of volumes in cinder service-list
24 """
25 backends_cinder = local_salt_client.pillar_get(
26 tgt='cinder:controller',
27 param='cinder:controller:backend'
28 )
29 cinder_volume = local_salt_client.cmd_any(
30 tgt='keystone:server',
31 param='. /root/keystonercv3; cinder service-list | grep "volume" |grep -c -v -e "lvm"')
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030032 backends_num = len(backends_cinder.keys())
33 assert cinder_volume == str(backends_num), \
34 'Number of cinder-volume services ({0}) does not match ' \
35 'number of volume backends ({1})'.format(
Oleksii Zhurba23c18332019-05-09 18:53:40 -050036 cinder_volume, str(backends_num))