[Podified] Run test_list_nodes_processes only on compute nodes

When the test test_list_nodes_processes is executed on a Podified
topology, it should only be run on compute nodes (Tobiko is unable to
connect to controllers yet).

Change-Id: I93249cb892a53ef72d49f7c50297cbe6292c81a4
This commit is contained in:
Eduardo Olivares 2024-02-06 18:00:16 +01:00
parent 5460bfd6b2
commit 8776813c4f
4 changed files with 11 additions and 3 deletions

View File

@ -65,3 +65,5 @@ verify_osp_version = _topology.verify_osp_version
get_config_setting = _topology.get_config_setting
node_name_from_hostname = _topology.node_name_from_hostname
remove_duplications = _topology.remove_duplications
OpenstackGroupNamesType = _topology.OpenstackGroupNamesType

View File

@ -45,8 +45,8 @@ LOG = log.getLogger(__name__)
PatternType = type(re.compile(r'.*'))
OpenstackGroupNameType = typing.Union[str, typing.Pattern]
OpenstackGroupNamesType = typing.Union[OpenstackGroupNameType, typing.Iterable[
OpenstackGroupNameType]]
OpenstackGroupNamesType = typing.Optional[typing.Union[
OpenstackGroupNameType, typing.Iterable[OpenstackGroupNameType]]]
HostAddressType = typing.Union[str, netaddr.IPAddress]

View File

@ -37,6 +37,8 @@ PatternType = type(re.compile(r''))
@keystone.skip_unless_has_keystone_credentials()
class OpenStackTopologyTest(testtools.TestCase):
expected_group: topology.OpenstackGroupNamesType = None
@property
def topology(self) -> topology.OpenStackTopology:
return topology.get_openstack_topology()
@ -134,7 +136,8 @@ class OpenStackTopologyTest(testtools.TestCase):
self.assertEqual(expected_nodes, actual_nodes)
def test_list_nodes_processes(self):
node = random.choice(topology.list_openstack_nodes())
node = random.choice(topology.list_openstack_nodes(
group=self.expected_group))
filename = sh.execute(
'mktemp', ssh_client=node.ssh_client).stdout.strip()
self.addCleanup(sh.execute, f"rm -f '{filename}'",

View File

@ -16,6 +16,7 @@
from __future__ import absolute_import
import tobiko
from tobiko.openstack import topology
from tobiko.shell import ping
from tobiko.shell import sh
from tobiko.tests.functional.openstack import test_topology
@ -25,6 +26,8 @@ from tobiko import podified
@podified.skip_if_not_podified
class PodifiedTopologyTest(test_topology.OpenStackTopologyTest):
expected_group: topology.OpenstackGroupNamesType = 'compute'
@property
def topology(self) -> podified.PodifiedTopology:
return tobiko.setup_fixture(podified.PodifiedTopology)