Skip to content

Commit

Permalink
tests: disable 24.10 integration tests (#599)
Browse files Browse the repository at this point in the history
tests: add xfail fixtures for LXD integration tests

Signed-off-by: Callahan Kovacs <[email protected]>
  • Loading branch information
mr-cal committed Aug 27, 2024
1 parent a977369 commit fceca92
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
22 changes: 21 additions & 1 deletion tests/integration/lxd/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2021-2023 Canonical Ltd.
# Copyright 2021-2024 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -25,11 +25,31 @@
from typing import Any, Dict, Optional

import pytest
from craft_providers.bases import ubuntu
from craft_providers.lxd import LXC
from craft_providers.lxd import project as lxc_project
from craft_providers.lxd.lxd_instance import LXDInstance
from craft_providers.lxd.lxd_provider import LXDProvider

_xfail_bases = {
ubuntu.BuilddBaseAlias.XENIAL: "Fails to setup snapd (#582)",
ubuntu.BuilddBaseAlias.ORACULAR: "24.10 fails setup (#598)",
ubuntu.BuilddBaseAlias.DEVEL: "24.10 fails setup (#598)",
}
"""List of bases that are expected to fail and a reason why."""

UBUNTU_BASES_PARAM = [
(
pytest.param(
base, marks=pytest.mark.xfail(reason=_xfail_bases[base], strict=True)
)
if base in _xfail_bases
else base
)
for base in ubuntu.BuilddBaseAlias
]
"""List of testable Ubuntu bases."""


@pytest.fixture(autouse=True, scope="module")
def installed_lxd_required(installed_lxd):
Expand Down
12 changes: 5 additions & 7 deletions tests/integration/lxd/test_lxd_provider.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2022-2023 Canonical Ltd.
# Copyright 2022-2024 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -17,9 +17,11 @@
#

import pytest
from craft_providers.bases import almalinux, get_base_from_alias, ubuntu
from craft_providers.bases import almalinux, get_base_from_alias
from craft_providers.lxd import LXDProvider, is_installed

from .conftest import UBUNTU_BASES_PARAM


def test_ensure_provider_is_available_not_installed(uninstalled_lxd):
"""Verify lxd is installed and configured."""
Expand All @@ -42,11 +44,7 @@ def test_create_environment(installed_lxd, instance_name):


@pytest.mark.parametrize(
"alias",
[
*set(ubuntu.BuilddBaseAlias) - {ubuntu.BuilddBaseAlias.XENIAL},
almalinux.AlmaLinuxBaseAlias.NINE,
],
"alias", [*UBUNTU_BASES_PARAM, almalinux.AlmaLinuxBaseAlias.NINE]
)
def test_launched_environment(
alias, installed_lxd, instance_name, tmp_path, session_provider
Expand Down
9 changes: 4 additions & 5 deletions tests/integration/lxd/test_remotes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2021-2023 Canonical Ltd.
# Copyright 2021-2024 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -21,17 +21,16 @@
from craft_providers import lxd
from craft_providers.bases import ubuntu

from .conftest import UBUNTU_BASES_PARAM

# The LXD tests can be flaky, erroring out with a BaseCompatibilityError:
# "Clean incompatible instance and retry the requested operation."
# This is due to an upstream LXD bug that appears to still be present in LXD 5.14:
# https://github.com/lxc/lxd/issues/11422
pytestmark = pytest.mark.flaky(reruns=3, reruns_delay=2)


# exclude XENIAL because it is not supported for LXD
@pytest.mark.parametrize(
"alias", set(ubuntu.BuilddBaseAlias) - {ubuntu.BuilddBaseAlias.XENIAL}
)
@pytest.mark.parametrize("alias", UBUNTU_BASES_PARAM)
def test_configure_and_launch_remote(instance_name, alias):
"""Verify remotes are configured and images can be launched."""
base_configuration = ubuntu.BuilddBase(alias=alias)
Expand Down

0 comments on commit fceca92

Please sign in to comment.