
This only covers that happy path of the feature. We agreed that the error paths are hard to cover here and we rely on the nova functional test instead. There are two new config options: * [compute_feature_enable]stable_compute_uuid_supported defaulted to False to skip the tests for old deployments not having the feature. * [whitebox-nova-compute]state_path defaulted to /var/lib/nova, to allow running the tests in deployments that are using a non default nova state path configuration (like devstack) The devstack plugin is modified to set [whitebox-nova-compute]state_path according to the devstack nova configuration. Change-Id: I520bd61b6ab479a36098586f7296822703a24fb0
53 lines
2.0 KiB
Python
53 lines
2.0 KiB
Python
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import os
|
|
|
|
from tempest import config
|
|
|
|
from whitebox_tempest_plugin.api.compute import base
|
|
from whitebox_tempest_plugin.services import clients
|
|
|
|
CONF = config.CONF
|
|
|
|
|
|
class TestStableCpuId(base.BaseWhiteboxComputeTest):
|
|
"""Test nova-compute generates a proper compute_id at startup.
|
|
"""
|
|
min_microversion = '2.53'
|
|
|
|
@classmethod
|
|
def skip_checks(cls):
|
|
super(TestStableCpuId, cls).skip_checks()
|
|
if not CONF.compute_feature_enabled.stable_compute_uuid_supported:
|
|
raise cls.skipException(
|
|
'Deployment requires support for stable compute UUID feature. '
|
|
'Set [compute-feature-enabled]stable_compute_uuid_supported '
|
|
'to True to enable these tests.')
|
|
|
|
def test_compute_id_file_match_db_state(self):
|
|
compute_id_path = os.path.join(
|
|
CONF.whitebox_nova_compute.state_path, "compute_id")
|
|
hypervisors = self.os_admin.hypervisor_client.list_hypervisors(
|
|
)["hypervisors"]
|
|
for hypervisor in hypervisors:
|
|
name = hypervisor['hypervisor_hostname']
|
|
ssh_client = clients.SSHClient(name)
|
|
uuid_on_disk = ssh_client.execute(f'cat {compute_id_path}')
|
|
self.assertEqual(
|
|
hypervisor['id'],
|
|
uuid_on_disk,
|
|
f"Compute UUID does not match on {name}: "
|
|
f"on disk: {uuid_on_disk}, in DB: {hypervisor['id']}",
|
|
)
|