Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 1 | import pytest |
| 2 | |
| 3 | |
Oleksii Zhurba | 23c1833 | 2019-05-09 18:53:40 -0500 | [diff] [blame] | 4 | @pytest.mark.sl_dup |
| 5 | @pytest.mark.full |
Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 6 | @pytest.mark.usefixtures('check_openstack') |
| 7 | def test_nova_services_status(local_salt_client): |
| 8 | result = local_salt_client.cmd_any( |
| 9 | tgt='keystone:server', |
| 10 | param='. /root/keystonercv3;' |
| 11 | 'nova service-list | grep "down\|disabled" | grep -v "Forced down"') |
| 12 | |
| 13 | assert result == '', \ |
| 14 | '''Some nova services are in wrong state''' |
| 15 | |
| 16 | |
Oleksii Zhurba | 23c1833 | 2019-05-09 18:53:40 -0500 | [diff] [blame] | 17 | @pytest.mark.smoke |
Hanna Arhipova | e6ed8e4 | 2019-05-15 16:27:08 +0300 | [diff] [blame] | 18 | @pytest.mark.usefixtures('check_openstack') |
| 19 | def test_nova_hosts_consistent(local_salt_client): |
| 20 | all_cmp_services = local_salt_client.cmd_any( |
| 21 | tgt='keystone:server', |
| 22 | param='. /root/keystonercv3;' |
| 23 | 'nova service-list | grep "nova-compute" | wc -l') |
| 24 | enabled_cmp_services = local_salt_client.cmd_any( |
| 25 | tgt='keystone:server', |
| 26 | param='. /root/keystonercv3;' |
| 27 | 'nova service-list | grep "nova-compute" | grep "enabled" | wc -l') |
| 28 | hosts = local_salt_client.cmd_any( |
| 29 | tgt='keystone:server', |
| 30 | param='. /root/keystonercv3;' |
| 31 | 'openstack host list | grep "compute" | wc -l') |
| 32 | hypervisors = local_salt_client.cmd_any( |
| 33 | tgt='keystone:server', |
| 34 | param='. /root/keystonercv3;' |
| 35 | 'openstack hypervisor list | egrep -v "\-----|ID" | wc -l') |
| 36 | |
| 37 | assert all_cmp_services == hypervisors, \ |
| 38 | "Number of nova-compute services ({}) does not match number of " \ |
| 39 | "hypervisors ({}).".format(all_cmp_services, hypervisors) |
| 40 | assert enabled_cmp_services == hosts, \ |
| 41 | "Number of enabled nova-compute services ({}) does not match number \ |
| 42 | of hosts ({}).".format(enabled_cmp_services, hosts) |