diff --git a/tests_e2e/scenarios/lib/ssh_client.py b/tests_e2e/scenarios/lib/ssh_client.py index 5e0afbd41..e4e650e3b 100644 --- a/tests_e2e/scenarios/lib/ssh_client.py +++ b/tests_e2e/scenarios/lib/ssh_client.py @@ -44,3 +44,5 @@ def generate_ssh_key(private_key_file: Path): """ shell.run_command(["ssh-keygen", "-m", "PEM", "-t", "rsa", "-b", "4096", "-q", "-N", "", "-f", str(private_key_file)]) + def get_architecture(self): + return self.run_command("uname -m").rstrip() diff --git a/tests_e2e/scenarios/runbooks/daily.yml b/tests_e2e/scenarios/runbooks/daily.yml index d0969699f..3ed7c223c 100644 --- a/tests_e2e/scenarios/runbooks/daily.yml +++ b/tests_e2e/scenarios/runbooks/daily.yml @@ -8,14 +8,8 @@ extension: - "../testsuites" variable: - - name: location - value: "westus2" - name: subscription_id value: "" - - name: marketplace_image - value: "" - - name: vhd - value: "" - name: vm_size value: "" - name: keep_environment @@ -31,6 +25,14 @@ variable: value: "" is_secret: true + # The image and location are set by the combinator + - name: marketplace_image + value: "" + - name: location + value: "" + - name: default_location + value: "westus2" + platform: - type: azure admin_username: $(user) @@ -46,32 +48,37 @@ platform: min: 2 azure: marketplace: "$(marketplace_image)" - vhd: $(vhd) + vhd: "" location: $(location) vm_size: $(vm_size) combinator: - type: grid + type: batch items: - - name: marketplace_image - value: - - "Canonical UbuntuServer 18.04-LTS latest" - - "Debian debian-10 10 latest" - - "OpenLogic CentOS 7_9 latest" - - "SUSE sles-15-sp2-basic gen2 latest" - - "RedHat RHEL 7-RAW latest" - - "microsoftcblmariner cbl-mariner cbl-mariner-1 latest" - - "microsoftcblmariner cbl-mariner cbl-mariner-2 latest" - # - # TODO: Add this distro, currently available in eastus - # - # - "microsoftcblmariner cbl-mariner cbl-mariner-2-arm64 latest" - # + - marketplace_image: "Canonical UbuntuServer 18.04-LTS latest" + location: $(default_location) + - marketplace_image: "Debian debian-10 10 latest" + location: $(default_location) + - marketplace_image: "OpenLogic CentOS 7_9 latest" + location: $(default_location) + - marketplace_image: "SUSE sles-15-sp2-basic gen2 latest" + location: $(default_location) + - marketplace_image: "RedHat RHEL 7-RAW latest" + location: $(default_location) + - marketplace_image: "microsoftcblmariner cbl-mariner cbl-mariner-1 latest" + location: $(default_location) + - marketplace_image: "microsoftcblmariner cbl-mariner cbl-mariner-2 latest" + location: $(default_location) +# +# TODO: Add this image (currently there are allocation issues trying to use it) +# +# # Mariner 2 ARM64 is not available in westus2 currently; use eastus. +# - marketplace_image: "microsoftcblmariner cbl-mariner cbl-mariner-2-arm64 latest" +# location: "eastus" concurrency: 10 notifier: - - type: env_stats - type: agent.junit include: diff --git a/tests_e2e/scenarios/tests/bvts/extension_operations.py b/tests_e2e/scenarios/tests/bvts/extension_operations.py index ae5e0c13b..e037465bf 100755 --- a/tests_e2e/scenarios/tests/bvts/extension_operations.py +++ b/tests_e2e/scenarios/tests/bvts/extension_operations.py @@ -34,32 +34,47 @@ from tests_e2e.scenarios.lib.agent_test import AgentTest from tests_e2e.scenarios.lib.identifiers import VmExtensionIds, VmExtensionIdentifier from tests_e2e.scenarios.lib.logging import log +from tests_e2e.scenarios.lib.ssh_client import SshClient from tests_e2e.scenarios.lib.vm_extension import VmExtension class ExtensionOperationsBvt(AgentTest): def run(self): + ssh_client: SshClient = SshClient( + ip_address=self._context.vm_ip_address, + username=self._context.username, + private_key_file=self._context.private_key_file) + + is_arm64: bool = ssh_client.get_architecture() == "aarch64" + custom_script_2_0 = VmExtension( self._context.vm, VmExtensionIds.CustomScript, resource_name="CustomScript") + if is_arm64: + log.info("Will skip the update scenario, since currently there is only 1 version of CSE on ARM64") + else: + log.info("Installing %s", custom_script_2_0) + message = f"Hello {uuid.uuid4()}!" + custom_script_2_0.enable( + settings={ + 'commandToExecute': f"echo \'{message}\'" + }, + auto_upgrade_minor_version=False + ) + custom_script_2_0.assert_instance_view(expected_version="2.0", expected_message=message) + custom_script_2_1 = VmExtension( self._context.vm, VmExtensionIdentifier(VmExtensionIds.CustomScript.publisher, VmExtensionIds.CustomScript.type, "2.1"), resource_name="CustomScript") - log.info("Installing %s", custom_script_2_0) - message = f"Hello {uuid.uuid4()}!" - custom_script_2_0.enable( - settings={ - 'commandToExecute': f"echo \'{message}\'" - }, - auto_upgrade_minor_version=False - ) - custom_script_2_0.assert_instance_view(expected_version="2.0", expected_message=message) + if is_arm64: + log.info("Installing %s", custom_script_2_1) + else: + log.info("Updating %s to %s", custom_script_2_0, custom_script_2_1) - log.info("Updating %s to %s", custom_script_2_0, custom_script_2_1) message = f"Hello {uuid.uuid4()}!" custom_script_2_1.enable( settings={ diff --git a/tests_e2e/scenarios/tests/bvts/run_command.py b/tests_e2e/scenarios/tests/bvts/run_command.py index 25258cef3..624cd10ea 100755 --- a/tests_e2e/scenarios/tests/bvts/run_command.py +++ b/tests_e2e/scenarios/tests/bvts/run_command.py @@ -45,25 +45,30 @@ def __init__(self, extension: VmExtension, get_settings: Callable[[str], Dict[st self.get_settings = get_settings def run(self): + ssh_client = SshClient( + ip_address=self._context.vm_ip_address, + username=self._context.username, + private_key_file=self._context.private_key_file) + test_cases = [ RunCommandBvt.TestCase( VmExtension(self._context.vm, VmExtensionIds.RunCommand, resource_name="RunCommand"), lambda s: { "script": base64.standard_b64encode(bytearray(s, 'utf-8')).decode('utf-8') - }), - RunCommandBvt.TestCase( - VmExtension(self._context.vm, VmExtensionIds.RunCommandHandler, resource_name="RunCommandHandler"), - lambda s: { - "source": { - "script": s - } }) ] - ssh_client = SshClient( - ip_address=self._context.vm_ip_address, - username=self._context.username, - private_key_file=self._context.private_key_file) + if ssh_client.get_architecture() == "aarch64": + log.info("Skipping test case for %s, since it has not been published on ARM64", VmExtensionIds.RunCommandHandler) + else: + test_cases.append( + RunCommandBvt.TestCase( + VmExtension(self._context.vm, VmExtensionIds.RunCommandHandler, resource_name="RunCommandHandler"), + lambda s: { + "source": { + "script": s + } + })) with soft_assertions(): for t in test_cases: diff --git a/tests_e2e/scenarios/testsuites/agent_junit.py b/tests_e2e/scenarios/testsuites/agent_junit.py index b918f17a3..bcf6a71a7 100644 --- a/tests_e2e/scenarios/testsuites/agent_junit.py +++ b/tests_e2e/scenarios/testsuites/agent_junit.py @@ -28,7 +28,7 @@ from lisa import schema # pylint: disable=E0401 from lisa.messages import ( # pylint: disable=E0401 MessageBase, - TestResultMessage, + TestResultMessageBase, ) @@ -48,8 +48,8 @@ def type_schema(cls) -> Type[schema.TypedSchema]: return AgentJUnitSchema def _received_message(self, message: MessageBase) -> None: - if isinstance(message, TestResultMessage): - distro = message.information.get('distro_version') - if distro is not None: - message.name = distro + if isinstance(message, TestResultMessageBase): + image = message.information.get('image') + if image is not None: + message.name = image super()._received_message(message)