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 ec2 tests to check billing code in metadata. #81

Merged
merged 2 commits into from
Jun 21, 2018
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
14 changes: 14 additions & 0 deletions usr/share/lib/ipa/tests/SLES/EC2/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import json
import pytest


@pytest.fixture()
def get_ec2_billing_products(host):
def f():
result = host.run(
'ec2metadata --api latest --document'
)

data = json.loads(result.stdout.strip())
return data['billingProducts']
return f
10 changes: 10 additions & 0 deletions usr/share/lib/ipa/tests/SLES/EC2/test_sles_ec2_billing_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


def test_sles_ec2_billing_code(get_ec2_billing_products):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the following.

"""This is really ONLY for SLES. All other on-demand products are sold through the Marketplace and they do not have a billing-product-code."""

"""
This is really ONLY for SLES.

All other on-demand products are sold through the Marketplace
and they do not have a billing-product-code.
"""
assert get_ec2_billing_products()
2 changes: 2 additions & 0 deletions usr/share/lib/ipa/tests/SLES/EC2/test_sles_ec2_byos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests:
- test_sles_ec2_no_billing_code
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


def test_sles_ec2_no_billing_code(get_ec2_billing_products):
assert get_ec2_billing_products() is None
2 changes: 2 additions & 0 deletions usr/share/lib/ipa/tests/SLES/EC2/test_sles_ec2_on_demand.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests:
- test_sles_ec2_billing_code