Replace Ubuntu guest images with Fedora

Tobiko has always used Ubuntu images as advanced guest images to create
VM instances during its tests.
This patch replaces the Ubuntu image with a Fedora image that is
customized to work with Tobiko tests properly.

The different files, config parameters, classes and attributes are
renamed to use the generic "advanced_vm" and "Advanced" prefixes to make
it easier in case another change of guest images is done in the future.

Depends-On: I6015af347dba6b8a587fa3b3811ca4c8cdd41b7a

Change-Id: Ie4ed523eb9646b6e79553341500c2e3314af8c3d
This commit is contained in:
Eduardo Olivares 2024-12-30 13:57:39 +01:00
parent b73f595bad
commit 7b67ccba2e
35 changed files with 203 additions and 169 deletions

View File

@ -253,11 +253,11 @@
# Default SSH key type to login to server instances (string value) # Default SSH key type to login to server instances (string value)
#key_type = ecdsa #key_type = ecdsa
# Timeout (in seconds) for establishing connection to ubuntu (floating point value) # Timeout (in seconds) for establishing connection to advanced vms (floating point value)
#ubuntu_connection_timeout = 1500.0 #advanced_vm_connection_timeout = 1500.0
# Timeout (in seconds) till ubuntu server is reachable (floating point value) # Timeout (in seconds) till advanced vm is reachable (floating point value)
#ubuntu_is_reachable_timeout = 900.0 #advanced_vm_is_reachable_timeout = 900.0
# Timeout (in seconds) till cloud-init based server is reachable (floating point value) # Timeout (in seconds) till cloud-init based server is reachable (floating point value)
#cloudinit_is_reachable_timeout = 600.0 #cloudinit_is_reachable_timeout = 600.0
@ -510,31 +510,31 @@
#overcloud_groups_dict = cmp:compute,ctrl:controller #overcloud_groups_dict = cmp:compute,ctrl:controller
[ubuntu] [advanced_vm]
# #
# From tobiko # From tobiko
# #
# Default ubuntu image name (string value) # Default advanced_vm image name (string value)
#image_name = <None> #image_name = <None>
# Default ubuntu image URL (string value) # Default advanced_vm image URL (string value)
#image_url = <None> #image_url = <None>
# Default ubuntu container format (string value) # Default advanced_vm container format (string value)
#container_format = <None> #container_format = <None>
# Default ubuntu disk format (string value) # Default advanced_vm disk format (string value)
#disk_format = <None> #disk_format = <None>
# Default ubuntu username (string value) # Default advanced_vm username (string value)
#username = <None> #username = <None>
# Default ubuntu password (string value) # Default advanced_vm password (string value)
#password = <None> #password = <None>
# Default ubuntu SSH connection timeout (seconds) (floating point value) # Default advanced_vm SSH connection timeout (seconds) (floating point value)
#connection_timeout = <None> #connection_timeout = <None>
# Allow to disable SSH auth algorithmsin order to SSH to old servers likeCirrOS ones # Allow to disable SSH auth algorithmsin order to SSH to old servers likeCirrOS ones

View File

@ -256,29 +256,25 @@ subparsers:
help: Skip Swift containers healthchecks when CephAdm is deployed help: Skip Swift containers healthchecks when CephAdm is deployed
ansible_variable: ceph_rgw ansible_variable: ceph_rgw
default: False default: False
ubuntu-connection-timeout: advanced-vm-connection-timeout:
type: Value type: Value
help: | help: |
Timeout error is raised if a connection to an ubuntu instance Timeout error is raised if a connection to an advanced_vm instance
is not successful before it expires is not successful before it expires
ansible_variable: ubuntu_connection_timeout ansible_variable: advanced_vm_connection_timeout
ubuntu-is-reachable-timeout: advanced-vm-is-reachable-timeout:
type: Value type: Value
help: | help: |
Timeout error is raised if an ubuntu instance is not reachable Timeout error is raised if an advanced_vm instance is not reachable
before it expires before it expires
ansible_variable: ubuntu_is_reachable_timeout ansible_variable: advanced_vm_is_reachable_timeout
ubuntu-vm-nic-name: customized-fedora-image-url:
type: Value type: Value
help: | help: |
NIC name expected on Ubuntu VM instances. URL to customized fedora image that tobiko ansible roles will
When Openstack spawns these VMs, their NIC (usually they download and will be used to create Advanced VM instances and
only have one NIC and one VLAN on that NIC) name is usually run tests on them.
"ens3", but with some Openstack versions, it is "enp3s0". ansible_variable: customized_fedora_image_url
Defaults to "enp3s0" because it is the value obtained with
Openstack versions that use infrared.
default: "enp3s0"
ansible_variable: ubuntu_nic_name
cleanup-containerlist-file: cleanup-containerlist-file:
type: Bool type: Bool
help: | help: |

View File

@ -54,6 +54,16 @@
- name: "download images" - name: "download images"
include_role: name=tobiko-download-images include_role: name=tobiko-download-images
vars:
fedora_image_override_pattern:
advanced_vm:
customized: true
url: "{{ customized_fedora_image_url | default('') }}"
download_images_override: >-
{{
customized_fedora_image_url is defined |
ternary(fedora_image_override_pattern, {})
}}
- name: "initialize test execution" - name: "initialize test execution"
include_role: name=tobiko-configure include_role: name=tobiko-configure

View File

@ -59,24 +59,30 @@ test_collect_dir: '{{ test_src_dir | realpath }}/{{ test_report_name }}'
# --- download-images options ------------------------------------------------- # --- download-images options -------------------------------------------------
download_images_dir: "{{ ansible_user_dir }}/.downloaded-images" download_images_dir: "{{ ansible_user_dir }}/.downloaded-images"
download_images: download_images_default:
ubuntu-customized: advanced_vm:
type: ubuntu username: fedora
url: "https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img" type: advanced_vm
url: "https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2"
customized: false customized: false
copy_in_files:
- nginx_id.conf
- iperf3-server.service
customize_command_pattern: > customize_command_pattern: >
LIBGUESTFS_BACKEND=direct virt-customize -a $TMPPATH LIBGUESTFS_BACKEND=direct virt-customize -a $TMPPATH
--firstboot-command 'sh -c "hostname > /var/www/html/id"' --firstboot-command 'sh -c "nmcli connection add type vlan con-name vlan101 ifname vlan101 vlan.parent eth0 vlan.id 101 ipv6.addr-gen-mode default-or-eui64;
--install iperf3,iputils-ping,ncat,nginx,vlan chown -R nginx:nginx /var/lib/nginx/ /var/log/nginx/; setenforce 0; systemctl restart nginx.service"'
--run-command 'echo "[Unit]\nDescription=iperf3 server on port %i\nAfter=syslog.target network.target\n\n[Service]\nExecStart=/usr/bin/iperf3 -s -p %i\nRestart=always\nUser=root\n\n[Install]\nWantedBy=multi-user.target\nDefaultInstance=5201\n" --install iperf3,iputils,nmap-ncat,nginx
> /etc/systemd/system/iperf3-server@.service' --copy-in /tmp/nginx_id.conf:/etc/nginx/conf.d
--run-command 'systemctl enable iperf3-server@5201' --run-command 'systemctl enable nginx'
--run-command 'echo "8021q" >> /etc/modules' --copy-in /tmp/iperf3-server.service:/etc/systemd/system
--run-command --run-command 'systemctl enable iperf3-server'
'echo "network:\n version: 2\n vlans:\n vlan101:\n dhcp4: true\n dhcp4-overrides:\n use-routes: false\n dhcp6: true\n dhcp6-overrides:\n use-routes: false\n id: 101\n link: {{ ubuntu_nic_name }}\n" --root-password password:tobiko
> /etc/netplan/75-tobiko-vlan.yaml' --selinux-relabel
# NIC name expected on Ubuntu VM instances. download_images: >-
# Depending on the openstack version, it has been observed the Ubuntu VM {{
# instances are created with an interface named 'ens3' or 'enp3s0' download_images_default |
ubuntu_nic_name: 'ens3' combine(download_images_override | default({}), recursive=True)
}}
# download_images_override can be provided with more images or with values to override the default ones from download_images_default

View File

@ -18,8 +18,8 @@ test_default_conf:
ceph_rgw: "{{ ceph_rgw }}" ceph_rgw: "{{ ceph_rgw }}"
nova: nova:
ubuntu_connection_timeout: "{{ ubuntu_connection_timeout }}" advanced_vm_connection_timeout: "{{ advanced_vm_connection_timeout }}"
ubuntu_is_reachable_timeout: "{{ ubuntu_is_reachable_timeout }}" advanced_vm_is_reachable_timeout: "{{ advanced_vm_is_reachable_timeout }}"
manila: manila:
share_protocol: "{{ manila_share_protocol }}" share_protocol: "{{ manila_share_protocol }}"
@ -38,7 +38,7 @@ overcloud_ssh_username: ''
ceph_rgw: '' ceph_rgw: ''
ubuntu_connection_timeout: '' advanced_vm_connection_timeout: ''
ubuntu_is_reachable_timeout: '' advanced_vm_is_reachable_timeout: ''
manila_share_protocol: '' manila_share_protocol: ''

View File

@ -25,6 +25,11 @@
- section: "{{ dict_value.type }}" - section: "{{ dict_value.type }}"
option: image_url option: image_url
value: "file://{{ download_images_dir }}/{{ file_name }}" value: "file://{{ download_images_dir }}/{{ file_name }}"
{% if dict_value.username is defined %}
- section: "{{ dict_value.type }}"
option: username
value: "{{ dict_value.username }}"
{% endif %}
{% endfor %} {% endfor %}
vars: vars:

View File

@ -0,0 +1,11 @@
[Unit]
Description=iperf3 server on port 5201
After=syslog.target network.target
[Service]
ExecStart=/usr/bin/iperf3 -s -p 5201
Restart=always
User=root
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,5 @@
server{
listen 80;
listen [::]:80;
location /id { add_header Content-Type text/plain; return 200 '$hostname';}
}

View File

@ -0,0 +1,36 @@
---
- name: download images
get_url:
dest: "{{ download_images_dir }}/{{ dl_image.key }}"
url: "{{ dl_image.value.url }}"
register: download
retries: 5
until: download is success
- name: copy files needed for image customization
copy:
src: "{{ item }}"
dest: "/tmp/{{ item }}"
force: true
mode: "0644"
loop: "{{ dl_image.value.copy_in_files }}"
when:
- dl_image.value.copy_in_files is defined
- name: customize images
# root needed to avoid the supermin issue:
# https://github.com/virt-manager/virt-bootstrap/issues/9
become: yes
vars:
image_file_path: "{{ download_images_dir }}/{{ dl_image.key }}"
shell: |
set -xe
TMPPATH=$(mktemp)
cp {{ image_file_path }} $TMPPATH
{{ dl_image.value.customize_command_pattern }}
mv $TMPPATH {{ image_file_path }}
chmod a+r {{ image_file_path }}
when:
- not (dl_image.value.customized | default(False) | bool)
- dl_image.value.customize_command_pattern is defined

View File

@ -5,34 +5,13 @@
state: directory state: directory
dest: "{{ download_images_dir }}" dest: "{{ download_images_dir }}"
- name: download images
get_url:
dest: "{{ download_images_dir }}/{{ item.key }}"
url: "{{ item.value.url }}"
register: download
retries: 5
until: download is success
with_dict: "{{ download_images }}"
- name: install libguestfs-tools - name: install libguestfs-tools
become: true become: true
package: package:
name: libguestfs-tools name: libguestfs-tools
- name: customize images - name: "download and customize images"
# root needed to avoid the supermin issue: include_tasks: download-and-customize.yaml
# https://github.com/virt-manager/virt-bootstrap/issues/9 loop: '{{ download_images | dict2items }}'
become: yes loop_control:
vars: loop_var: dl_image
image_file_path: "{{ download_images_dir }}/{{ item.key }}"
shell: |
set -xe
TMPPATH=$(mktemp)
cp {{ image_file_path }} $TMPPATH
{{ item.value.customize_command_pattern }}
mv $TMPPATH {{ image_file_path }}
chmod a+r {{ image_file_path }}
when:
- not (item.value.customized | default(False) | bool)
- item.value.customize_command_pattern is defined
with_dict: "{{ download_images }}"

View File

@ -28,7 +28,7 @@ OPTIONS = [
GLANCE_IMAGE_NAMES = ['cirros', GLANCE_IMAGE_NAMES = ['cirros',
'ubuntu'] 'advanced_vm']
def register_tobiko_options(conf): def register_tobiko_options(conf):

View File

@ -29,11 +29,7 @@ OPTIONS = [
default=24, default=24,
help="The mask bits for IPv4 subnets"), help="The mask bits for IPv4 subnets"),
cfg.ListOpt('ipv4_dns_nameservers', cfg.ListOpt('ipv4_dns_nameservers',
# This value is a workaround to avoid UbuntuExternalPortTest default=None,
# failures - with certain ubuntu images, routes to the
# nameservers were added to a VLAN interface, breaking
# connectivity from the VMs to the external network.
default=["8.8.8.8"],
help="List of nameservers IPv4 addresses"), help="List of nameservers IPv4 addresses"),
cfg.StrOpt('ipv6_cidr', cfg.StrOpt('ipv6_cidr',
default='fc00::/48', default='fc00::/48',

View File

@ -28,13 +28,13 @@ OPTIONS = [
cfg.StrOpt('key_type', cfg.StrOpt('key_type',
default=DEFAULT_KEY_TYPE, default=DEFAULT_KEY_TYPE,
help="Default SSH key type to login to server instances"), help="Default SSH key type to login to server instances"),
cfg.FloatOpt('ubuntu_connection_timeout', cfg.FloatOpt('advanced_vm_connection_timeout',
default=1500., default=1500.,
help="Timeout (in seconds) for establishing connection " help="Timeout (in seconds) for establishing connection "
"to ubuntu"), "to advanced_vm"),
cfg.FloatOpt('ubuntu_is_reachable_timeout', cfg.FloatOpt('advanced_vm_is_reachable_timeout',
default=900., default=900.,
help="Timeout (in seconds) till ubuntu server is reachable"), help="Timeout (in seconds) till advanced_vm is reachable"),
cfg.FloatOpt('cloudinit_is_reachable_timeout', cfg.FloatOpt('cloudinit_is_reachable_timeout',
default=600., default=600.,
help="Timeout (in seconds) till cloud-init based server is " help="Timeout (in seconds) till cloud-init based server is "

View File

@ -22,7 +22,7 @@ from tobiko.openstack.stacks import _neutron
from tobiko.openstack.stacks import _nova from tobiko.openstack.stacks import _nova
from tobiko.openstack.stacks import _octavia from tobiko.openstack.stacks import _octavia
from tobiko.openstack.stacks import _qos from tobiko.openstack.stacks import _qos
from tobiko.openstack.stacks import _ubuntu from tobiko.openstack.stacks import _advanced_vm
from tobiko.openstack.stacks import _vlan from tobiko.openstack.stacks import _vlan
@ -92,10 +92,11 @@ QosNetworkStackFixture = _qos.QosNetworkStackFixture
QosPolicyStackFixture = _qos.QosPolicyStackFixture QosPolicyStackFixture = _qos.QosPolicyStackFixture
QosServerStackFixture = _qos.QosServerStackFixture QosServerStackFixture = _qos.QosServerStackFixture
UbuntuFlavorStackFixture = _ubuntu.UbuntuFlavorStackFixture AdvancedFlavorStackFixture = _advanced_vm.AdvancedFlavorStackFixture
UbuntuImageFixture = _ubuntu.UbuntuImageFixture AdvancedImageFixture = _advanced_vm.AdvancedImageFixture
UbuntuServerStackFixture = _ubuntu.UbuntuServerStackFixture AdvancedServerStackFixture = _advanced_vm.AdvancedServerStackFixture
UbuntuExternalServerStackFixture = _ubuntu.UbuntuExternalServerStackFixture AdvancedExternalServerStackFixture = \
_advanced_vm.AdvancedExternalServerStackFixture
VlanNetworkStackFixture = _vlan.VlanNetworkStackFixture VlanNetworkStackFixture = _vlan.VlanNetworkStackFixture
VlanProxyServerStackFixture = _vlan.VlanProxyServerStackFixture VlanProxyServerStackFixture = _vlan.VlanProxyServerStackFixture

View File

@ -23,24 +23,10 @@ from tobiko.shell import sh
CONF = config.CONF CONF = config.CONF
IPERF3_SERVICE_FILE = """
[Unit]
Description=iperf3 server on port %i
After=syslog.target network.target
[Service]
ExecStart=/usr/bin/iperf3 -s -p %i
Restart=always
User=root
[Install]
WantedBy=multi-user.target
DefaultInstance=5201
"""
class UbuntuImageFixture(glance.UrlGlanceImageFixture): class AdvancedImageFixture(glance.UrlGlanceImageFixture):
"""Ubuntu server image running an HTTP server """Advanced server image running an HTTP server
The server has additional installed packages compared to The server has additional installed packages compared to
the minimal one: the minimal one:
@ -49,32 +35,27 @@ class UbuntuImageFixture(glance.UrlGlanceImageFixture):
- ping - ping
- ncat - ncat
- nginx - nginx
- vlan
The image will also have below running services: The image will also have below running services:
- nginx HTTP server listening on TCP port 80 - nginx HTTP server listening on TCP port 80
- iperf3 server listening on TCP port 5201 - iperf3 server listening on TCP port 5201
""" """
image_url = CONF.tobiko.ubuntu.image_url image_url = CONF.tobiko.advanced_vm.image_url
image_name = CONF.tobiko.ubuntu.image_name image_name = CONF.tobiko.advanced_vm.image_name
disk_format = CONF.tobiko.ubuntu.disk_format or "qcow2" disk_format = CONF.tobiko.advanced_vm.disk_format or "qcow2"
container_format = CONF.tobiko.ubuntu.container_format or "bare" container_format = CONF.tobiko.advanced_vm.container_format or "bare"
username = CONF.tobiko.ubuntu.username or 'ubuntu' username = CONF.tobiko.advanced_vm.username or 'cloud-user'
password = CONF.tobiko.ubuntu.password or 'ubuntu' connection_timeout = CONF.tobiko.nova.advanced_vm_connection_timeout
connection_timeout = CONF.tobiko.nova.ubuntu_connection_timeout disabled_algorithms = CONF.tobiko.advanced_vm.disabled_algorithms
disabled_algorithms = CONF.tobiko.ubuntu.disabled_algorithms is_reachable_timeout = CONF.tobiko.nova.advanced_vm_is_reachable_timeout
is_reachable_timeout = CONF.tobiko.nova.ubuntu_is_reachable_timeout
# port of running HTTP server # port of running HTTP server
http_port = 80 http_port = 80
# port of running Iperf3 server # port of running Iperf3 server
iperf3_port = 5201 iperf3_port = 5201
@property iperf3_service_name = "iperf3-server.service"
def iperf3_service_name(self) -> str:
return f"iperf3-server@{self.iperf3_port}.service"
@property @property
def vlan_id(self) -> int: def vlan_id(self) -> int:
@ -85,14 +66,14 @@ class UbuntuImageFixture(glance.UrlGlanceImageFixture):
return f'vlan{self.vlan_id}' return f'vlan{self.vlan_id}'
class UbuntuFlavorStackFixture(_nova.FlavorStackFixture): class AdvancedFlavorStackFixture(_nova.FlavorStackFixture):
ram = 256 ram = 256
swap = 512 swap = 512
class UbuntuServerStackFixture(_nova.CloudInitServerStackFixture, class AdvancedServerStackFixture(_nova.CloudInitServerStackFixture,
_vlan.VlanServerStackFixture): _vlan.VlanServerStackFixture):
"""Ubuntu server running an HTTP server """Advanced server running an HTTP server
The server has additional commands compared to the minimal one: The server has additional commands compared to the minimal one:
@ -101,9 +82,9 @@ class UbuntuServerStackFixture(_nova.CloudInitServerStackFixture,
""" """
#: Glance image used to create a Nova server instance #: Glance image used to create a Nova server instance
image_fixture = tobiko.required_fixture(UbuntuImageFixture) image_fixture = tobiko.required_fixture(AdvancedImageFixture)
#: Flavor used to create a Nova server instance #: Flavor used to create a Nova server instance
flavor_stack = tobiko.required_fixture(UbuntuFlavorStackFixture) flavor_stack = tobiko.required_fixture(AdvancedFlavorStackFixture)
@property @property
def is_reachable_timeout(self) -> tobiko.Seconds: def is_reachable_timeout(self) -> tobiko.Seconds:
@ -114,6 +95,7 @@ class UbuntuServerStackFixture(_nova.CloudInitServerStackFixture,
def http_port(self) -> int: def http_port(self) -> int:
return self.image_fixture.http_port return self.image_fixture.http_port
# port of running Iperf3 server
@property @property
def iperf3_port(self) -> int: def iperf3_port(self) -> int:
return self.image_fixture.iperf3_port return self.image_fixture.iperf3_port
@ -140,7 +122,7 @@ class UbuntuServerStackFixture(_nova.CloudInitServerStackFixture,
@topology.skip_unless_osp_version('17.0', lower=True) @topology.skip_unless_osp_version('17.0', lower=True)
class UbuntuExternalServerStackFixture(UbuntuServerStackFixture, class AdvancedExternalServerStackFixture(AdvancedServerStackFixture,
_nova.ExternalServerStackFixture): _nova.ExternalServerStackFixture):
"""Ubuntu server with port on special external network """Advanced server with port on special external network
""" """

View File

@ -18,13 +18,13 @@ from __future__ import absolute_import
from oslo_log import log from oslo_log import log
from tobiko import config from tobiko import config
from tobiko.openstack.stacks import _ubuntu from tobiko.openstack.stacks import _advanced_vm
CONF = config.CONF CONF = config.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
class OctaviaServerStackFixture(_ubuntu.UbuntuServerStackFixture): class OctaviaServerStackFixture(_advanced_vm.AdvancedServerStackFixture):
has_floating_ip = False has_floating_ip = False

View File

@ -21,7 +21,7 @@ from tobiko.openstack import heat
from tobiko.openstack import neutron from tobiko.openstack import neutron
from tobiko.openstack.stacks import _neutron from tobiko.openstack.stacks import _neutron
from tobiko.openstack.stacks import _hot from tobiko.openstack.stacks import _hot
from tobiko.openstack.stacks import _ubuntu from tobiko.openstack.stacks import _advanced_vm
CONF = config.CONF CONF = config.CONF
@ -61,7 +61,7 @@ class QosNetworkStackFixture(_neutron.NetworkBaseStackFixture):
super().setup_stack() super().setup_stack()
class QosServerStackFixture(_ubuntu.UbuntuServerStackFixture): class QosServerStackFixture(_advanced_vm.AdvancedServerStackFixture):
#: stack with the network with a qos policy #: stack with the network with a qos policy
network_stack = tobiko.required_fixture(QosNetworkStackFixture) network_stack = tobiko.required_fixture(QosNetworkStackFixture)

View File

@ -44,7 +44,7 @@ class OctaviaBasicFaultTest(testtools.TestCase):
listener = None listener = None
pool = None pool = None
server_stack = tobiko.required_fixture( server_stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
other_server_stack = tobiko.required_fixture( other_server_stack = tobiko.required_fixture(
stacks.OctaviaOtherServerStackFixture) stacks.OctaviaOtherServerStackFixture)

View File

@ -53,7 +53,7 @@ class OctaviaServicesFaultTest(testtools.TestCase):
listener = None listener = None
pool = None pool = None
server_stack = tobiko.required_fixture( server_stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
other_server_stack = tobiko.required_fixture( other_server_stack = tobiko.required_fixture(
stacks.OctaviaOtherServerStackFixture) stacks.OctaviaOtherServerStackFixture)

View File

@ -139,7 +139,7 @@ class GetL3AgentModeTest(testtools.TestCase):
class SSHGetL3AgentModeTest(GetL3AgentModeTest): class SSHGetL3AgentModeTest(GetL3AgentModeTest):
server_stack = tobiko.required_fixture( server_stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
@property @property
def connection(self) -> sh.SSHShellConnection: def connection(self) -> sh.SSHShellConnection:

View File

@ -21,13 +21,13 @@ from tobiko.openstack import stacks
from tobiko.tests.functional.openstack.stacks import test_cirros from tobiko.tests.functional.openstack.stacks import test_cirros
class UbuntuServerStackTest(test_cirros.CirrosServerStackTest): class AdvancedServerStackTest(test_cirros.CirrosServerStackTest):
"""Tests connectivity to Nova instances via floating IPs""" """Tests connectivity to Nova instances via floating IPs"""
#: Stack of resources with a server attached to a floating IP #: Stack of resources with a server attached to a floating IP
stack = tobiko.required_fixture(stacks.UbuntuServerStackFixture) stack = tobiko.required_fixture(stacks.AdvancedServerStackFixture)
nameservers_filenames = ('/run/systemd/resolve/resolv.conf',) nameservers_filenames = ('/etc/resolv.conf',)
def test_python(self): def test_python(self):
python_version = sh.execute(['python3', '--version'], python_version = sh.execute(['python3', '--version'],

View File

@ -29,10 +29,10 @@ class VlanProxyServerStackTest(test_cirros.CirrosServerStackTest):
stack = tobiko.required_fixture(stacks.VlanProxyServerStackFixture) stack = tobiko.required_fixture(stacks.VlanProxyServerStackFixture)
class UbuntuVlanServerTest(testtools.TestCase): class AdvancedVlanServerTest(testtools.TestCase):
#: Stack of resources with a server attached to a floating IP #: Stack of resources with a server attached to a floating IP
stack = tobiko.required_fixture(stacks.UbuntuServerStackFixture) stack = tobiko.required_fixture(stacks.AdvancedServerStackFixture)
def test_vlan_ipv4_fixed_ip(self): def test_vlan_ipv4_fixed_ip(self):
self._test_vlan_fixed_ip(ip_version=4) self._test_vlan_fixed_ip(ip_version=4)

View File

@ -209,7 +209,7 @@ class LocalShellConnectionTest(testtools.TestCase):
class SSHShellConnectionTest(LocalShellConnectionTest): class SSHShellConnectionTest(LocalShellConnectionTest):
connection_class = sh.SSHShellConnection connection_class = sh.SSHShellConnection
server = tobiko.required_fixture(stacks.UbuntuServerStackFixture) server = tobiko.required_fixture(stacks.AdvancedServerStackFixture)
@property @property
def ssh_client(self) -> ssh.SSHClientFixture: def ssh_client(self) -> ssh.SSHClientFixture:

View File

@ -210,7 +210,7 @@ class SSHExecuteTest(ExecuteTest):
expected_shell = SSH_EXPECTED_SHELL expected_shell = SSH_EXPECTED_SHELL
server_stack = tobiko.required_fixture( server_stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
@property @property
def ssh_client(self): def ssh_client(self):

View File

@ -68,9 +68,9 @@ class GetHostnameTest(testtools.TestCase):
def test_cirros_hostname(self): def test_cirros_hostname(self):
self.test_ssh_hostname(ssh_client=self.cirros_server.ssh_client) self.test_ssh_hostname(ssh_client=self.cirros_server.ssh_client)
ubuntu_server = tobiko.required_fixture( advanced_server = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
@keystone.skip_unless_has_keystone_credentials() @keystone.skip_unless_has_keystone_credentials()
def test_ubuntu_hostname(self): def test_advanced_vm_hostname(self):
self.test_ssh_hostname(ssh_client=self.ubuntu_server.ssh_client) self.test_ssh_hostname(ssh_client=self.advanced_server.ssh_client)

View File

@ -67,7 +67,7 @@ class LocalProcessTest(ProcessTest):
class SSHProcessFixture(ProcessFixture): class SSHProcessFixture(ProcessFixture):
stack = tobiko.required_fixture( stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
def setup_fixture(self): def setup_fixture(self):
self.ssh_client = self.stack.ssh_client self.ssh_client = self.stack.ssh_client

View File

@ -87,7 +87,7 @@ class ProxyJumpWhichTest(WhichTest):
class SSHWhichTest(WhichTest): class SSHWhichTest(WhichTest):
server_stack = tobiko.required_fixture( server_stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
@property @property
def ssh_client(self): def ssh_client(self):

View File

@ -34,7 +34,7 @@ from tobiko.openstack import stacks
@keystone.skip_unless_has_keystone_credentials() @keystone.skip_unless_has_keystone_credentials()
class CurlExecuteTest(testtools.TestCase): class CurlExecuteTest(testtools.TestCase):
stack = tobiko.required_fixture(stacks.UbuntuServerStackFixture) stack = tobiko.required_fixture(stacks.AdvancedServerStackFixture)
def test_execute_curl( def test_execute_curl(
self, self,
@ -53,7 +53,8 @@ class CurlExecuteTest(testtools.TestCase):
retry_count=30, retry_count=30,
retry_timeout=300., retry_timeout=300.,
retry_interval=10.).strip() retry_interval=10.).strip()
self.assertEqual(self.stack.server_name, result) short_vm_name_from_curl = result.split('.')[0]
self.assertEqual(self.stack.server_name, short_vm_name_from_curl)
def test_execute_curl_ipv4(self): def test_execute_curl_ipv4(self):
self.test_execute_curl(ip_address=self.get_fixed_ip(ip_version=4), self.test_execute_curl(ip_address=self.get_fixed_ip(ip_version=4),

View File

@ -31,8 +31,8 @@ class IfconfigTest(testtools.TestCase):
cirros_stack = tobiko.required_fixture( cirros_stack = tobiko.required_fixture(
stacks.CirrosServerStackFixture) stacks.CirrosServerStackFixture)
ubuntu_stack = tobiko.required_fixture( advanced_vm_stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
def test_list_ip_addresses(self, ip_version=None, **execute_params): def test_list_ip_addresses(self, ip_version=None, **execute_params):
result = sh.execute(command='ls /sbin/ifconfig', result = sh.execute(command='ls /sbin/ifconfig',
@ -59,8 +59,9 @@ class IfconfigTest(testtools.TestCase):
self.test_list_ip_addresses(ssh_client=self.cirros_stack.ssh_client) self.test_list_ip_addresses(ssh_client=self.cirros_stack.ssh_client)
@keystone.skip_unless_has_keystone_credentials() @keystone.skip_unless_has_keystone_credentials()
def test_list_ip_addresses_with_ubuntu_server(self): def test_list_ip_addresses_with_advanced_server(self):
self.test_list_ip_addresses(ssh_client=self.ubuntu_stack.ssh_client) self.test_list_ip_addresses(
ssh_client=self.advanced_vm_stack.ssh_client)
def test_list_ip_addresses_with_proxy_ssh_client(self): def test_list_ip_addresses_with_proxy_ssh_client(self):
ssh_client = ssh.ssh_proxy_client() ssh_client = ssh.ssh_proxy_client()

View File

@ -32,8 +32,8 @@ class IpTest(testtools.TestCase):
cirros_stack = tobiko.required_fixture( cirros_stack = tobiko.required_fixture(
stacks.CirrosServerStackFixture) stacks.CirrosServerStackFixture)
ubuntu_stack = tobiko.required_fixture( advanced_vm_stack = tobiko.required_fixture(
stacks.UbuntuServerStackFixture) stacks.AdvancedServerStackFixture)
namespace = tobiko.required_fixture( namespace = tobiko.required_fixture(
_fixtures.NetworkNamespaceFixture) _fixtures.NetworkNamespaceFixture)
@ -83,8 +83,9 @@ class IpTest(testtools.TestCase):
def test_list_ip_addresses_with_cirros_server(self): def test_list_ip_addresses_with_cirros_server(self):
self.test_list_ip_addresses(ssh_client=self.cirros_stack.ssh_client) self.test_list_ip_addresses(ssh_client=self.cirros_stack.ssh_client)
def test_list_ip_addresses_with_ubuntu_server(self): def test_list_ip_addresses_with_advanced_server(self):
self.test_list_ip_addresses(ssh_client=self.ubuntu_stack.ssh_client) self.test_list_ip_addresses(
ssh_client=self.advanced_vm_stack.ssh_client)
def test_list_ip_addresses_with_proxy_ssh_client(self): def test_list_ip_addresses_with_proxy_ssh_client(self):
ssh_client = ssh.ssh_proxy_client() ssh_client = ssh.ssh_proxy_client()
@ -144,8 +145,8 @@ class IpTest(testtools.TestCase):
self.test_list_ip_addresses(network_namespace=namespace) self.test_list_ip_addresses(network_namespace=namespace)
@pytest.mark.flaky(reruns=3, reruns_delay=5) @pytest.mark.flaky(reruns=3, reruns_delay=5)
def test_list_namespaces_with_ubuntu_server(self): def test_list_namespaces_with_advanced_server(self):
self.test_list_namespaces(ssh_client=self.ubuntu_stack.ssh_client) self.test_list_namespaces(ssh_client=self.advanced_vm_stack.ssh_client)
@pytest.mark.flaky(reruns=3, reruns_delay=5) @pytest.mark.flaky(reruns=3, reruns_delay=5)
def test_list_namespaces_with_proxy_ssh_client(self): def test_list_namespaces_with_proxy_ssh_client(self):

View File

@ -220,6 +220,6 @@ class CirrosPingTest(PingTest):
return self.stack.ssh_client return self.stack.ssh_client
class UbuntuPingTest(CirrosPingTest): class AdvancedPingTest(CirrosPingTest):
stack = tobiko.required_fixture(stacks.UbuntuServerStackFixture) stack = tobiko.required_fixture(stacks.AdvancedServerStackFixture)

View File

@ -121,12 +121,12 @@ class PortTest(testtools.TestCase):
# --- Test opening ports on external network ---------------------------------- # --- Test opening ports on external network ----------------------------------
@stacks.skip_unless_has_external_network @stacks.skip_unless_has_external_network
class UbuntuExternalPortTest(PortTest): class AdvancedExternalPortTest(PortTest):
"""Test Neutron ports""" """Test Neutron ports"""
#: Resources stack with Nova server to send messages to #: Resources stack with Nova server to send messages to
stack = tobiko.required_fixture( stack = tobiko.required_fixture(
stacks.UbuntuExternalServerStackFixture) stacks.AdvancedExternalServerStackFixture)
# --- Test la-h3 extension ---------------------------------------------------- # --- Test la-h3 extension ----------------------------------------------------

View File

@ -30,7 +30,7 @@ CONF = config.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
class RebootTrunkServerStackFixture(stacks.UbuntuServerStackFixture): class RebootTrunkServerStackFixture(stacks.AdvancedServerStackFixture):
def validate_created_stack(self): def validate_created_stack(self):
# (fressi) must wait cloud init to complete Nova # (fressi) must wait cloud init to complete Nova

View File

@ -188,10 +188,10 @@ class CirrosServerTest(BaseServerTest):
stack = tobiko.required_fixture(CirrosServerStackFixture) stack = tobiko.required_fixture(CirrosServerStackFixture)
class UbuntuServerStackFixture(stacks.UbuntuServerStackFixture): class AdvancedServerStackFixture(stacks.AdvancedServerStackFixture):
pass pass
class UbuntuServerTest(BaseServerTest): class AdvancedServerTest(BaseServerTest):
__test__ = True __test__ = True
stack = tobiko.required_fixture(UbuntuServerStackFixture) stack = tobiko.required_fixture(AdvancedServerStackFixture)

View File

@ -33,7 +33,11 @@
test_inventory_file: '{{ zuul_work_dir }}/ansible_hosts' test_inventory_file: '{{ zuul_work_dir }}/ansible_hosts'
test_inventory_groups: {undercloud: [primary]} test_inventory_groups: {undercloud: [primary]}
tox_envlist: infrared tox_envlist: infrared
tox_extra_args: -- --collect-dir {{ test_collect_dir | quote }} tox_extra_args: >-
--
--collect-dir {{ test_collect_dir | quote }}
--customized-fedora-image-url
https://download.fedoraproject.org/pub/fedora/linux/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
tox_environ: tox_environ:
ANSIBLE_INVENTORY: '{{ test_inventory_file }}' ANSIBLE_INVENTORY: '{{ test_inventory_file }}'
zuul_output_dir: '{{ ansible_user_dir }}/zuul-output' zuul_output_dir: '{{ ansible_user_dir }}/zuul-output'