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 ARM64 to the daily test run #2734

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions tests_e2e/scenarios/lib/ssh_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
53 changes: 30 additions & 23 deletions tests_e2e/scenarios/runbooks/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that those variables are generated by the combinator, overriding them from the command line has no effect. In future PRs I will replace those in favor of using JSON files defining the test suites, as we discussed earlier.

platform:
- type: azure
admin_username: $(user)
Expand All @@ -46,32 +48,37 @@ platform:
min: 2
azure:
marketplace: "$(marketplace_image)"
vhd: $(vhd)
vhd: ""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will use the VHD parameter in a future PR

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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This notifier was copied from the sample on which I based the original runbook. Taking a look at its report, it does not provide anything useful for our scenario, so I'm removing it.

- type: agent.junit

include:
Expand Down
35 changes: 25 additions & 10 deletions tests_e2e/scenarios/tests/bvts/extension_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down
27 changes: 16 additions & 11 deletions tests_e2e/scenarios/tests/bvts/run_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions tests_e2e/scenarios/testsuites/agent_junit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from lisa import schema # pylint: disable=E0401
from lisa.messages import ( # pylint: disable=E0401
MessageBase,
TestResultMessage,
TestResultMessageBase,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the Base class also captures SubTests. We don't have any of those currently, but decided to make the code more generic in case we use them.

)


Expand All @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the image instead of the distro allows to distinguish Mariner 1 & 2

super()._received_message(message)