Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
add test for TransformerAWSV2RHEL
Browse files Browse the repository at this point in the history
Signed-off-by: Janine Olear <[email protected]>
  • Loading branch information
miyunari committed Jul 24, 2023
1 parent ed01e82 commit 2ea5c05
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name": "RHEL 6.10 hvm x86_64 Hourly2", "arch": "x86_64", "version": "6.10", "imageId": "ami-0c22ca1423e1721e7", "date": "2021-03-18T15:22:40.000Z", "virt": "hvm", "selflink": "https://console.aws.amazon.com/ec2/home?region=af-south-1#launchAmi=ami-0c22ca1423e1721e7", "region": "af-south-1"}
33 changes: 33 additions & 0 deletions tests/transformer/v2_aws_rhel_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Tests for the v2 AWS RHEL transformer."""
import filecmp
import os

from cloudimagedirectory import transformer


def test_aws_v2_rhel_transformer_command(runner, tmp_path):
"""Verify that we can transform AWS data for RHEL."""
result = runner.invoke(
transformer.run,
[
"-f",
"tests/transformer/testdata/input/raw/aws/af-south-1.json",
"-op=.",
f"-dp={tmp_path}",
"--filter.until=none",
],
)

assert result.exit_code == 0, f"expected no error, but got code {result.exit_code} and output:\n{result.output}"

# Ensure the directory was made.
assert os.path.isdir(f"{tmp_path}/v2/os/rhel/provider/aws/version/6.10/region/af-south-1/image")

# Get current directory
pwd = os.getcwd()

# Check image data by comparing the expected file and the output file byte by byte.
assert filecmp.cmp(
f"{pwd}/tests/transformer/testdata/expected/v2/os/rhel/provider/aws/version/6.10/region/af-south-1/image/4031b089d970c84bf7fad57831ba552e36517a3f",
f"{tmp_path}/v2/os/rhel/provider/aws/version/6.10/region/af-south-1/image/4031b089d970c84bf7fad57831ba552e36517a3f",
)

0 comments on commit 2ea5c05

Please sign in to comment.