diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/base.py b/whitebox_neutron_tempest_plugin/tests/scenario/base.py index 859c766..1488867 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/base.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/base.py @@ -361,10 +361,10 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase): (node['is_controller'] or node['is_compute'])] @classmethod - def is_setup_single_node(cls): + def is_setup_single_compute(cls): if not hasattr(cls, 'nodes'): cls.discover_nodes() - return len(cls.nodes) == 1 + return len([node for node in cls.nodes if node['is_compute']]) == 1 def get_node_setting(self, node_name, setting): for node in self.nodes: diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/test_security_group_logging.py b/whitebox_neutron_tempest_plugin/tests/scenario/test_security_group_logging.py index 88ab8bf..2370282 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/test_security_group_logging.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/test_security_group_logging.py @@ -346,7 +346,7 @@ class BaseSecGroupLoggingTest( event='ALL', description='', enabled=True, - add_cleanup=True): + fail_if_deleted=True): _log = self.create_log( name=name or data_utils.rand_name('{}-test-log'.format( self.__class__.__name__)), @@ -354,8 +354,12 @@ class BaseSecGroupLoggingTest( resource_id=resource_id or self.secgrp['id'], event=event, enabled=enabled) - if add_cleanup: + if fail_if_deleted: self.addCleanup(self.admin_client.delete_log, _log['id']) + else: + self.addCleanup(test_utils.call_and_ignore_notfound_exc, + self.admin_client.delete_log, _log['id']) + return _log def verify_meter_and_band_amounts(self, meter_range, meter_band_range): @@ -650,13 +654,12 @@ class BaseSecGroupLoggingTest( round((1 + offset) * long_test_target)), limits_fail_msg) + self._verify_duplicate_entries(vm_a) # NOTE(mblue): skip multi-compute test when setup is single node - for vms_same_compute in (True, False): - if self.is_setup_single_node() and not vms_same_compute: - continue - self._verify_duplicate_entries(vms_same_compute, vm_a) + if not self.is_setup_single_compute(): + self._verify_duplicate_entries(vm_a, same_compute=False) - def _verify_duplicate_entries(self, same_compute, vm_a): + def _verify_duplicate_entries(self, vm_a, same_compute=True): # 18) create second VM on the same/different compute node compute_hint_str = 'same' if same_compute else 'different' vm_b = self._create_server( @@ -744,7 +747,7 @@ class BaseSecGroupLoggingTest( else: rotate_prefix = 'sudo podman exec logrotate_crond ' # 1) enable logging for "all" events - local_log = self._create_log(event='ALL', add_cleanup=False) + local_log = self._create_log(event='ALL', fail_if_deleted=False) # 2) attempt ssh to VM from undercloud ("drop" event), # this ensures an initial log entry exists, with needed count value. self.try_ssh_traffic(vm_a['ssh_client'])