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