Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 1 | import pytest |
Hanna Arhipova | 1eef831 | 2019-05-06 20:14:18 +0300 | [diff] [blame^] | 2 | import logging |
Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 3 | |
| 4 | |
Oleksii Zhurba | 23c1833 | 2019-05-09 18:53:40 -0500 | [diff] [blame] | 5 | @pytest.mark.sl_dup |
| 6 | #CinderServiceDown, CinderServicesDownMinor |
| 7 | @pytest.mark.full |
Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 8 | def 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 Zhurba | 23c1833 | 2019-05-09 18:53:40 -0500 | [diff] [blame] | 19 | @pytest.mark.full |
Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 20 | def 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 Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 32 | 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 Zhurba | 23c1833 | 2019-05-09 18:53:40 -0500 | [diff] [blame] | 36 | cinder_volume, str(backends_num)) |