Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logic to skip test for unspported images #3276

Merged
merged 3 commits into from
May 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions microsoft/testsuites/vm_extensions/linux_patch_extension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) Microsoft Corporation. Licensed under the MIT license.

from typing import Any
from typing import Any, Dict, List

from assertpy.assertpy import assert_that

Expand All @@ -14,17 +14,57 @@
simple_requirement,
)
from lisa.base_tools.service import Service
from lisa.operating_system import BSD
from lisa.operating_system import BSD, SLES, CBLMariner, Debian, Redhat
from lisa.sut_orchestrator import AZURE
from lisa.sut_orchestrator.azure.common import (
get_compute_client,
get_node_context,
wait_operation,
)
from lisa.sut_orchestrator.azure.platform_ import AzurePlatform
from lisa.util import SkippedException, UnsupportedDistroException


def _is_os_unsupported(self, node: Node) -> None:
feng-j678 marked this conversation as resolved.
Show resolved Hide resolved
"""
Below specific Linux distro versions that are
not supported by linux patch extension.
debian debian-11 11 0.20230124.1270
redhat rhel-arm64 8_6-arm64 8.6.2022060901
debian debian-11 11-backports 0.20221219.1234
microsoftcblmariner cbl-mariner cbl-mariner-2-arm64 2.20230126.01
suse sles-15-sp5 gen2 2024.02.07
feng-j678 marked this conversation as resolved.
Show resolved Hide resolved
"""
unsupported_versions_x86_64: Dict[type, List[str]] = {
Debian: [10, 11],
SLES: [15],
CBLMariner: [2],
}
unsupported_versions_arm64: Dict[type, List[str]] = {
Redhat: [8_6],
feng-j678 marked this conversation as resolved.
Show resolved Hide resolved
}

arch = node.os.get_kernel_information().hardware_platform # type: ignore
if arch == "aarch64":
unsupported_versions = unsupported_versions_arm64
else:
unsupported_versions = unsupported_versions_x86_64

# Extract Debian version from the complete version string
debian_version = node.os.information.version.major.split()[1]
feng-j678 marked this conversation as resolved.
Show resolved Hide resolved

for distro, version_list in unsupported_versions.items():
if isinstance(node.os, distro) and debian_version in version_list:
feng-j678 marked this conversation as resolved.
Show resolved Hide resolved
# Both node.os and distro are in the version_list, so raise an exception
raise SkippedException(
UnsupportedDistroException(
node.os, "This Distro version is unsupported"
)
)


def _set_up_vm(node: Node, environment: Environment) -> Any:
_is_os_unsupported(node)
assert environment.platform, "platform shouldn't be None."
platform: AzurePlatform = environment.platform # type: ignore
assert isinstance(
Expand Down
Loading