From 533d89a241fa4c300d00553601098971e0f01b4c Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Fri, 7 Jun 2019 12:16:43 +0200 Subject: [PATCH] Verify shared stack hostname Change-Id: If1b689bb9321b64183c8cd32d51ae93087787165 --- .../tests/functional/openstack/test_stacks.py | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tobiko/tests/functional/openstack/test_stacks.py b/tobiko/tests/functional/openstack/test_stacks.py index e303a6044..2b20d88a3 100644 --- a/tobiko/tests/functional/openstack/test_stacks.py +++ b/tobiko/tests/functional/openstack/test_stacks.py @@ -20,19 +20,36 @@ import testtools import tobiko from tobiko.openstack import stacks from tobiko.shell import ping +from tobiko.shell import sh -class FloatingIPTest(testtools.TestCase): +class FloatingIpServerTest(testtools.TestCase): """Tests connectivity to Nova instances via floating IPs""" - floating_ip_stack = tobiko.required_setup_fixture( + stack = tobiko.required_setup_fixture( stacks.FloatingIpServerStackFixture) @property def floating_ip_address(self): """Floating IP address""" - return self.floating_ip_stack.outputs.floating_ip_address + return self.stack.outputs.floating_ip_address + + @property + def ssh_client(self): + """Floating IP address""" + return self.stack.ssh_client + + @property + def server_name(self): + """Floating IP address""" + return self.stack.outputs.server_name def test_ping(self): """Test connectivity to floating IP address""" ping.ping_until_received(self.floating_ip_address).assert_replied() + + def test_hostname(self): + """Test that hostname of instance server matches Nova server name""" + result = sh.execute('hostname', ssh_client=self.ssh_client) + hostname, = str(result.stdout).splitlines() + self.assertEqual(hostname, self.server_name)