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

Added check for missing marketplaceProductCodes in instance identity. #345

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
40 changes: 24 additions & 16 deletions test_suite/cloud/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,31 +401,39 @@ def test_aws_instance_identity(self, host, instance_data, instance_data_aws_web)
assert instance_data_aws_web['region'] in instance_data['availability_zone'], \
'Unexpected region for deployed instance'

# Check instance architecture
arch = instance_data_aws_web['architecture']
if arch == 'arm64':
arch = 'aarch64'

assert arch == host.system_info.arch, \
'Unexpected architecture for deployed instance'

# Check Billing Codes
ami_name = instance_data['name']
obtained_billing_codes = instance_data_aws_web['billingProducts']
if obtained_billing_codes:
expected_billing_codes = []
if test_lib.is_rhel_high_availability(host) and 'Access2' not in ami_name:
# RHELDST-4222, on-demand (hourly) has the billing code for RHEL and for HA
expected_billing_codes = ['bp-79a54010', 'bp-6fa54006']
elif 'Hourly2' in ami_name:
expected_billing_codes = ['bp-6fa54006']
elif 'Access2' in ami_name:
# Cloud Access billing code, means don't charge for the OS (so it can apply to anything cloud Access)
expected_billing_codes = ['bp-63a5400a']
else:
pytest.skip(
'Unable to decide billing codes as no "Hourly2" or "Access2" found in AMI name')
Copy link

Choose a reason for hiding this comment

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

Could you add ami_name to the message?


billing_codes = []
if test_lib.is_rhel_high_availability(host) and 'Access2' not in ami_name:
# RHELDST-4222, on-demand (hourly) has the billing code for RHEL and for HA
billing_codes = ['bp-79a54010', 'bp-6fa54006']
elif 'Hourly2' in ami_name:
billing_codes = ['bp-6fa54006']
elif 'Access2' in ami_name:
# Cloud Access billing code, means don't charge for the OS (so it can apply to anything cloud Access)
billing_codes = ['bp-63a5400a']
else:
pytest.skip(
'Unable to decide billing codes as no "Hourly2" or "Access2" found in AMI name')
for code in expected_billing_codes:
assert code in obtained_billing_codes, \
f'Expected billing code "{code}" not found in instance document data'

obtained_marketplace_product_codes = list(instance_data_aws_web['marketplaceProductCodes'])

print(f'marketplaceProductCodes = {obtained_billing_codes}')
Copy link

Choose a reason for hiding this comment

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

copy& paste issue?

marketplaceProductCodes vs obtained_billing_code


for code in billing_codes:
assert code in instance_data_aws_web['billingProducts'], \
'Expected billing code not found in instance document data'
assert len(obtained_marketplace_product_codes) > 1, 'List of marketplaceProductCodes is empty'
Copy link

Choose a reason for hiding this comment

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

This will fail for pre-release testing.


@pytest.mark.run_on(['rhel'])
def test_cmdline_nvme_io_timeout(self, host):
Expand Down
Loading