Skip to content

Commit 484c27c

Browse files
authored
Consolidate pytest markers in e2e tests (#83)
Issue #, if available: N/A Description of changes: Consolidates markers used to pass data to fixtures into `resource_data`. This also removes *Warning* logs from the test because now all markers will be registered By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d8e3c27 commit 484c27c

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

test/e2e/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def pytest_configure(config):
3939
"markers", "slow: mark test as slow to run"
4040
)
4141
config.addinivalue_line(
42-
"markers", "vpc_data: mark test with data to pass to vpc fixture"
42+
"markers", "resource_data: mark test with data to use when creating fixture"
4343
)
4444

4545
def pytest_collection_modifyitems(config, items):
@@ -65,7 +65,7 @@ def simple_vpc(request):
6565
replacements["ENABLE_DNS_SUPPORT"] = "False"
6666
replacements["ENABLE_DNS_HOSTNAMES"] = "False"
6767

68-
marker = request.node.get_closest_marker("vpc_data")
68+
marker = request.node.get_closest_marker("resource_data")
6969
if marker is not None:
7070
data = marker.args[0]
7171
if 'cidr_block' in data:

test/e2e/tests/test_dhcp_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def simple_dhcp_options(request):
4242
replacements["DHCP_VAL_2_1"] = "10.2.5.1"
4343
replacements["DHCP_VAL_2_2"] = "10.2.5.2"
4444

45-
marker = request.node.get_closest_marker("dhcp_options_data")
45+
marker = request.node.get_closest_marker("resource_data")
4646
if marker is not None:
4747
data = marker.args[0]
4848
if 'dhcp_key_1' in data:
@@ -102,7 +102,7 @@ def test_create_delete(self, ec2_client, simple_dhcp_options):
102102
# Check DHCP Options no longer exists in AWS
103103
ec2_validator.assert_dhcp_options(resource_id, exists=False)
104104

105-
@pytest.mark.dhcp_options_data({'dhcp_key_1': 'InvalidValue'})
105+
@pytest.mark.resource_data({'dhcp_key_1': 'InvalidValue'})
106106
def test_terminal_condition_invalid_parameter_value(self, simple_dhcp_options):
107107
(ref, _) = simple_dhcp_options
108108

test/e2e/tests/test_elastic_ip_address.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def simple_elastic_ip_address(request):
5555
replacements["ADDRESS_NAME"] = resource_name
5656
replacements["PUBLIC_IPV4_POOL"] = "amazon"
5757

58-
marker = request.node.get_closest_marker("elastic_ip_address_data")
58+
marker = request.node.get_closest_marker("resource_data")
5959
if marker is not None:
6060
data = marker.args[0]
6161
if 'resource_file' in data:
@@ -114,7 +114,7 @@ def test_create_delete(self, ec2_client, simple_elastic_ip_address):
114114
exists = address_exists(ec2_client, resource_id)
115115
assert not exists
116116

117-
@pytest.mark.elastic_ip_address_data({'public_ipv4_pool': 'InvalidIpV4Address'})
117+
@pytest.mark.resource_data({'public_ipv4_pool': 'InvalidIpV4Address'})
118118
def test_terminal_condition_invalid_parameter_value(self, simple_elastic_ip_address):
119119
(ref, _) = simple_elastic_ip_address
120120

@@ -125,7 +125,7 @@ def test_terminal_condition_invalid_parameter_value(self, simple_elastic_ip_addr
125125
# invalid value for parameter pool: InvalidIpV4Address
126126
assert expected_msg in terminal_condition['message']
127127

128-
@pytest.mark.elastic_ip_address_data({'address': '52.27.68.220', 'resource_file': 'invalid/elastic_ip_invalid_combination'})
128+
@pytest.mark.resource_data({'address': '52.27.68.220', 'resource_file': 'invalid/elastic_ip_invalid_combination'})
129129
def test_terminal_condition_invalid_parameter_combination(self, simple_elastic_ip_address):
130130
(ref, _) = simple_elastic_ip_address
131131

test/e2e/tests/test_internet_gateway.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def simple_internet_gateway(request, simple_vpc):
4141
replacements = REPLACEMENT_VALUES.copy()
4242
replacements["INTERNET_GATEWAY_NAME"] = resource_name
4343

44-
marker = request.node.get_closest_marker("bootstrap_options")
44+
marker = request.node.get_closest_marker("resource_data")
4545
if marker is not None:
4646
data = marker.args[0]
4747
if 'resource_file' in data:
@@ -99,7 +99,7 @@ def test_create_delete(self, ec2_client, simple_internet_gateway):
9999
# Check Internet Gateway no longer exists in AWS
100100
ec2_validator.assert_internet_gateway(resource_id, exists=False)
101101

102-
@pytest.mark.bootstrap_options({'create_vpc': True, 'resource_file': 'internet_gateway_vpc_attachment'})
102+
@pytest.mark.resource_data({'create_vpc': True, 'resource_file': 'internet_gateway_vpc_attachment'})
103103
def test_vpc_association(self, ec2_client, simple_internet_gateway):
104104
(ref, cr) = simple_internet_gateway
105105

test/e2e/tests/test_security_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def simple_security_group(request):
4141
replacements["VPC_ID"] = test_vpc.vpc_id
4242
replacements["SECURITY_GROUP_DESCRIPTION"] = "TestSecurityGroup"
4343

44-
marker = request.node.get_closest_marker("fixture_overrides")
44+
marker = request.node.get_closest_marker("resource_data")
4545
if marker is not None:
4646
data = marker.args[0]
4747
if 'resource_file' in data:
@@ -97,7 +97,7 @@ def test_create_delete(self, ec2_client, simple_security_group):
9797
# Check Security Group no longer exists in AWS
9898
ec2_validator.assert_security_group(resource_id, exists=False)
9999

100-
@pytest.mark.fixture_overrides({
100+
@pytest.mark.resource_data({
101101
'resource_file': 'security_group_rule',
102102
'IP_PROTOCOL': 'tcp',
103103
'FROM_PORT': "80",

test/e2e/tests/test_vpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_create_delete(self, ec2_client, simple_vpc):
6565
# Check VPC no longer exists in AWS
6666
ec2_validator.assert_vpc(resource_id, exists=False)
6767

68-
@pytest.mark.vpc_data({'enable_dns_support': 'true', 'enable_dns_hostnames': 'true'})
68+
@pytest.mark.resource_data({'enable_dns_support': 'true', 'enable_dns_hostnames': 'true'})
6969
def test_enable_attributes(self, ec2_client, simple_vpc):
7070
(ref, cr) = simple_vpc
7171
resource_id = cr["status"]["vpcID"]

0 commit comments

Comments
 (0)