diff --git a/tobiko/openstack/stacks/_ubuntu.py b/tobiko/openstack/stacks/_ubuntu.py index d95b2606a..16537b14b 100644 --- a/tobiko/openstack/stacks/_ubuntu.py +++ b/tobiko/openstack/stacks/_ubuntu.py @@ -13,12 +13,14 @@ # under the License. from __future__ import absolute_import +import typing + import tobiko from tobiko import config from tobiko.openstack import glance -from tobiko.openstack import nova from tobiko.openstack.stacks import _nova + CONF = config.CONF UBUNTU_IMAGE_VERSION = 'focal' @@ -49,12 +51,26 @@ class UbuntuImageFixture(UbuntuMinimalImageFixture, The server has additional commands compared to the minimal one: iperf3 ping + ncat + nginx + + The image will also have a running HTTPD server listening on + TCP port 80 """ - install_packages = ['iperf3', - 'iputils-ping', - 'ncat', - 'nginx'] + @property + def firstboot_commands(self) -> typing.List[str]: + return super().firstboot_commands + [ + 'sh -c "hostname > /var/www/html/id"'] + + @property + def install_packages(self) -> typing.List[str]: + return super().install_packages + ['iperf3', + 'iputils-ping', + 'ncat', + 'nginx'] + + http_port = 80 class UbuntuFlavorStackFixture(_nova.FlavorStackFixture): @@ -83,13 +99,9 @@ class UbuntuServerStackFixture(UbuntuMinimalServerStackFixture): image_fixture = tobiko.required_setup_fixture(UbuntuImageFixture) # port of running HTTP server - http_port = 80 - @property - def cloud_config(self): - return nova.cloud_config( - super().cloud_config, - runcmd=["sh -c 'hostname > /var/www/html/id'"]) + def http_port(self) -> int: + return self.image_fixture.http_port class UbuntuExternalServerStackFixture(UbuntuServerStackFixture, diff --git a/tobiko/tests/functional/shell/test_curl.py b/tobiko/tests/functional/shell/test_curl.py index 1c2c5bd82..843a50014 100644 --- a/tobiko/tests/functional/shell/test_curl.py +++ b/tobiko/tests/functional/shell/test_curl.py @@ -23,10 +23,11 @@ import testtools import tobiko from tobiko.shell import curl from tobiko.shell import ssh +from tobiko.openstack import keystone from tobiko.openstack import stacks -@tobiko.skip("Flaky test case") +@keystone.skip_unless_has_keystone_credentials() class TestCurl(testtools.TestCase): stack = tobiko.required_setup_fixture(stacks.UbuntuServerStackFixture)