summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/integration_tests/modules/test_apt.py33
-rw-r--r--tox.ini1
2 files changed, 28 insertions, 6 deletions
diff --git a/tests/integration_tests/modules/test_apt.py b/tests/integration_tests/modules/test_apt.py
index c0c8321c..54711fc0 100644
--- a/tests/integration_tests/modules/test_apt.py
+++ b/tests/integration_tests/modules/test_apt.py
@@ -200,29 +200,32 @@ class TestApt:
assert conf_exists is False
-DEFAULT_DATA = """\
+_DEFAULT_DATA = """\
#cloud-config
apt:
primary:
- arches:
- default
+ {uri}
security:
- arches:
- default
"""
+DEFAULT_DATA = _DEFAULT_DATA.format(uri='')
@pytest.mark.ubuntu
@pytest.mark.user_data(DEFAULT_DATA)
class TestDefaults:
- def test_primary(self, class_client: IntegrationInstance):
- """Test apt default primary sources.
+ @pytest.mark.openstack
+ def test_primary_on_openstack(self, class_client: IntegrationInstance):
+ """Test apt default primary source on openstack.
- Ported from
- tests/cloud_tests/testcases/modules/apt_configure_primary.py
+ When no uri is provided.
"""
+ zone = class_client.execute('cloud-init query v1.availability_zone')
sources_list = class_client.read_from_file('/etc/apt/sources.list')
- assert 'deb http://archive.ubuntu.com/ubuntu' in sources_list
+ assert '{}.clouds.archive.ubuntu.com'.format(zone) in sources_list
def test_security(self, class_client: IntegrationInstance):
"""Test apt default security sources.
@@ -239,6 +242,24 @@ class TestDefaults:
)
+DEFAULT_DATA_WITH_URI = _DEFAULT_DATA.format(
+ uri='uri: "http://something.random.invalid/ubuntu"'
+)
+
+
+@pytest.mark.user_data(DEFAULT_DATA_WITH_URI)
+def test_default_primary_with_uri(client: IntegrationInstance):
+ """Test apt default primary sources.
+
+ Ported from
+ tests/cloud_tests/testcases/modules/apt_configure_primary.py
+ """
+ sources_list = client.read_from_file('/etc/apt/sources.list')
+ assert 'archive.ubuntu.com' not in sources_list
+
+ assert 'something.random.invalid' in sources_list
+
+
DISABLED_DATA = """\
#cloud-config
apt:
diff --git a/tox.ini b/tox.ini
index 10efd190..3158ebd5 100644
--- a/tox.ini
+++ b/tox.ini
@@ -174,6 +174,7 @@ markers =
gce: test will only run on GCE platform
azure: test will only run on Azure platform
oci: test will only run on OCI platform
+ openstack: test will only run on openstack
lxd_config_dict: set the config_dict passed on LXD instance creation
lxd_container: test will only run in LXD container
lxd_use_exec: `execute` will use `lxc exec` instead of SSH