Skip to content

Commit

Permalink
test: add test_ami_boots_in_aws()
Browse files Browse the repository at this point in the history
A variant of the test_image_boots() test that only runs for the AMI
image type.
The function uses the AWS VM class to boot an AMI (given the AMI ID),
run a couple of commands over SSH, then tears it down.

As opposed to the local boot test, this one also runs on macOS.
  • Loading branch information
achilleas-k committed Jan 9, 2024
1 parent c8c3d26 commit 94b93ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ def test_image_boots(image_type):
assert "hello" in output


@pytest.mark.parametrize("image_type", ["ami"], indirect=["image_type"])
def test_ami_boots_in_aws(image_type):
with AWS(image_type.metadata["ami_id"]) as test_vm:
exit_status, _ = test_vm.run("true", user=image_type.username, password=image_type.password)
assert exit_status == 0
exit_status, output = test_vm.run("echo hello", user=image_type.username, password=image_type.password)
assert exit_status == 0
assert "hello" in output


def log_has_osbuild_selinux_denials(log):
OSBUID_SELINUX_DENIALS_RE = re.compile(r"(?ms)avc:\ +denied.*osbuild")
return re.search(OSBUID_SELINUX_DENIALS_RE, log)
Expand Down

0 comments on commit 94b93ab

Please sign in to comment.