blob: 54ed76efd495c4789fe2a24f269e165670f5e2f3 [file] [log] [blame]
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03001import pytest
2
3
Oleksii Zhurba23c18332019-05-09 18:53:40 -05004@pytest.mark.sl_dup
5@pytest.mark.full
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03006@pytest.mark.usefixtures('check_openstack')
7def 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 Zhurba23c18332019-05-09 18:53:40 -050017@pytest.mark.smoke
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +030018@pytest.mark.usefixtures('check_openstack')
19def 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)