Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 1 | import pytest |
| 2 | |
| 3 | |
Oleksii Zhurba | b9bf545 | 2018-03-26 14:27:41 -0500 | [diff] [blame] | 4 | def test_cinder_services(local_salt_client): |
Oleksii Zhurba | e502d66 | 2018-08-07 16:46:14 -0500 | [diff] [blame^] | 5 | cinder_backends_info = local_salt_client.cmd( |
Oleksii Zhurba | e592ed1 | 2018-06-21 18:01:09 -0500 | [diff] [blame] | 6 | 'cinder:controller', |
Oleksii Zhurba | e502d66 | 2018-08-07 16:46:14 -0500 | [diff] [blame^] | 7 | 'pillar.get', |
| 8 | ['cinder:controller:backend'], |
| 9 | expr_form='pillar') |
| 10 | if not cinder_backends_info: |
| 11 | pytest.skip("Cinder is not found on this environment") |
| 12 | service_down = local_salt_client.cmd( |
| 13 | 'keystone:server', |
Oleksii Zhurba | b9bf545 | 2018-03-26 14:27:41 -0500 | [diff] [blame] | 14 | 'cmd.run', |
| 15 | ['. /root/keystonerc; cinder service-list | grep "down\|disabled"'], |
| 16 | expr_form='pillar') |
| 17 | cinder_volume = local_salt_client.cmd( |
| 18 | 'keystone:server', |
| 19 | 'cmd.run', |
Oleksii Zhurba | e502d66 | 2018-08-07 16:46:14 -0500 | [diff] [blame^] | 20 | ['. /root/keystonerc; cinder service-list | grep -c "volume"'], |
Oleksii Zhurba | b9bf545 | 2018-03-26 14:27:41 -0500 | [diff] [blame] | 21 | expr_form='pillar') |
Oleksii Zhurba | e502d66 | 2018-08-07 16:46:14 -0500 | [diff] [blame^] | 22 | backends_cinder = cinder_backends_info[cinder_backends_info.keys()[0]] |
| 23 | backends_num = len(backends_cinder.keys()) |
Oleksii Zhurba | b9bf545 | 2018-03-26 14:27:41 -0500 | [diff] [blame] | 24 | assert service_down[service_down.keys()[0]] == '', \ |
| 25 | '''Some cinder services are in wrong state''' |
Oleksii Zhurba | e502d66 | 2018-08-07 16:46:14 -0500 | [diff] [blame^] | 26 | assert cinder_volume[cinder_volume.keys()[0]] == str(backends_num), \ |
| 27 | 'Number of cinder-volume services ({0}) does not match ' \ |
| 28 | 'number of volume backends ({1})'.format( |
| 29 | cinder_volume[cinder_volume.keys()[0]], str(backends_num)) |