Fix test_hostnames test

This test should not try to obtain the node hostnames via ssh when there
is no ssh_client available for the node.

Change-Id: I999ceac724ccbbedf305f5b0550a49798952d627
This commit is contained in:
Eduardo Olivares 2024-03-01 17:48:58 +01:00
parent a0ca923161
commit 6fb2680a18
1 changed files with 7 additions and 0 deletions

View File

@ -14,6 +14,7 @@
# under the License.
from __future__ import absolute_import
from oslo_log import log
import pytest
import testtools
@ -24,6 +25,9 @@ from tobiko.shell import sh
from tobiko.openstack import topology
LOG = log.getLogger(__name__)
@pytest.mark.minimal
class OpenstackNodesTest(testtools.TestCase):
@ -42,6 +46,9 @@ class OpenstackNodesTest(testtools.TestCase):
def test_hostnames(self):
hostnames = dict()
for node in self.topology.nodes:
if node.ssh_client is None:
LOG.debug(f'Node {node.hostname} has no ssh_client')
continue
hostname = sh.get_hostname(ssh_client=node.ssh_client)
self.assertTrue(hostname.startswith(node.name))
other = hostnames.setdefault(hostname, node)