summaryrefslogtreecommitdiff
path: root/tests/integration_tests/modules/test_lxd.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration_tests/modules/test_lxd.py')
-rw-r--r--tests/integration_tests/modules/test_lxd.py46
1 files changed, 32 insertions, 14 deletions
diff --git a/tests/integration_tests/modules/test_lxd.py b/tests/integration_tests/modules/test_lxd.py
index f84cdff6..40941ab4 100644
--- a/tests/integration_tests/modules/test_lxd.py
+++ b/tests/integration_tests/modules/test_lxd.py
@@ -8,8 +8,10 @@ import warnings
import pytest
import yaml
-from tests.integration_tests.clouds import ImageSpecification, IntegrationCloud
+from tests.integration_tests.clouds import IntegrationCloud
from tests.integration_tests.instances import IntegrationInstance
+from tests.integration_tests.integration_settings import PLATFORM
+from tests.integration_tests.releases import CURRENT_RELEASE, FOCAL
from tests.integration_tests.util import verify_clean_log
BRIDGE_USER_DATA = """\
@@ -149,7 +151,9 @@ lxd:
"""
-@pytest.mark.no_container
+@pytest.mark.skipif(
+ PLATFORM == "lxd_container", reason="Containers cannot run LXD"
+)
@pytest.mark.user_data(BRIDGE_USER_DATA)
class TestLxdBridge:
@pytest.mark.parametrize("binary_name", ["lxc", "lxd"])
@@ -202,7 +206,7 @@ def validate_preseed_storage_pools(client, preseed_cfg):
def validate_preseed_projects(client: IntegrationInstance, preseed_cfg):
# Support for projects by lxd init --preseed was added in lxd 4.12
# https://discuss.linuxcontainers.org/t/lxd-4-12-has-been-released/10424#projects-now-supported-by-lxd-init-dump-and-preseed-9
- if ImageSpecification.from_os_image().release in ("bionic", "focal"):
+ if CURRENT_RELEASE.series in ("bionic", "focal"):
return
for src_project in preseed_cfg.get("projects", []):
proj_name = src_project["name"]
@@ -226,17 +230,23 @@ def validate_preseed_projects(client: IntegrationInstance, preseed_cfg):
assert project == src_project
-@pytest.mark.no_container
+@pytest.mark.skipif(
+ PLATFORM == "lxd_container", reason="Containers cannot manipulate storage"
+)
@pytest.mark.user_data(STORAGE_USER_DATA.format("btrfs"))
def test_storage_btrfs(client):
validate_storage(client, "btrfs-progs", "mkfs.btrfs")
-@pytest.mark.no_container
-@pytest.mark.not_bionic
+@pytest.mark.skipif(
+ PLATFORM == "lxd_container", reason="Containers cannot manipulate LXD"
+)
+@pytest.mark.skipif(
+ CURRENT_RELEASE < FOCAL, reason="tested on Focal and later"
+)
def test_storage_preseed_btrfs(setup_image, session_cloud: IntegrationCloud):
- cfg_image_spec = ImageSpecification.from_os_image()
- if cfg_image_spec.release in ("bionic",):
+ # TODO: If test is marked as not bionic, why is there a bionic section?
+ if CURRENT_RELEASE.series in ("bionic",):
nictype = "nictype: bridged"
parent = "parent: lxdbr0"
network = ""
@@ -256,7 +266,9 @@ def test_storage_preseed_btrfs(setup_image, session_cloud: IntegrationCloud):
validate_preseed_projects(client, preseed_cfg)
-@pytest.mark.no_container
+@pytest.mark.skipif(
+ PLATFORM == "lxd_container", reason="Containers cannot manipulate LVM"
+)
@pytest.mark.user_data(STORAGE_USER_DATA.format("lvm"))
def test_storage_lvm(client):
log = client.read_from_file("/var/log/cloud-init.log")
@@ -281,17 +293,23 @@ def test_basic_preseed(client):
validate_preseed_projects(client, preseed_cfg)
-@pytest.mark.no_container
+@pytest.mark.skipif(
+ PLATFORM == "lxd_container", reason="Containers cannot manipulate ZFS"
+)
@pytest.mark.user_data(STORAGE_USER_DATA.format("zfs"))
def test_storage_zfs(client):
validate_storage(client, "zfsutils-linux", "zpool")
-@pytest.mark.no_container
-@pytest.mark.not_bionic
+@pytest.mark.skipif(
+ PLATFORM == "lxd_container", reason="Containers cannot manipulate LXD"
+)
+@pytest.mark.skipif(
+ CURRENT_RELEASE < FOCAL, reason="Tested on focal and later"
+)
def test_storage_preseed_zfs(setup_image, session_cloud: IntegrationCloud):
- cfg_image_spec = ImageSpecification.from_os_image()
- if cfg_image_spec.release in ("bionic",):
+ # TODO: If test is marked as not bionic, why is there a bionic section?
+ if CURRENT_RELEASE.series in ("bionic",):
nictype = "nictype: bridged"
parent = "parent: lxdbr0"
network = ""