Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae55ba2

Browse files
committed
Ensure tests work correctly with the updated ec2_create_security_group fixture (#12602)
Signed-off-by: Ramtin Mesgari <[email protected]>
1 parent eb6b6c6 commit ae55ba2

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

‎tests/aws/services/ec2/test_ec2.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ def test_get_security_groups_for_vpc(
734734
GroupName="test-security-group-1",
735735
Description="Test Security Group 1 Description",
736736
VpcId=vpc_id,
737+
ports=[22]
737738
)
738739
sg1_id = sg1["GroupId"]
739740
snapshot.match("create_security_group_1", sg1)
@@ -742,6 +743,7 @@ def test_get_security_groups_for_vpc(
742743
GroupName="test-security-group-2",
743744
Description="Test Security Group 2 Description",
744745
VpcId=vpc_id,
746+
ports=[22]
745747
)
746748
sg2_id = sg2["GroupId"]
747749
snapshot.match("create_security_group_2", sg2)
@@ -756,6 +758,7 @@ def test_get_security_groups_for_vpc(
756758
GroupName="test-security-group-3",
757759
Description="Test Security Group 3 Description",
758760
VpcId=default_vpc_id,
761+
ports=[22]
759762
)
760763
sg3_id = sg3["GroupId"]
761764
snapshot.match("create_security_group_3", sg3)
@@ -769,11 +772,6 @@ def test_get_security_groups_for_vpc(
769772
assert sg2_id in vpc_sg_ids
770773
assert sg3_id not in vpc_sg_ids
771774

772-
cleanups.append(lambda: aws_client.ec2.delete_vpc(VpcId=vpc_id))
773-
cleanups.append(lambda: aws_client.ec2.delete_security_group(GroupId=sg1_id))
774-
cleanups.append(lambda: aws_client.ec2.delete_security_group(GroupId=sg2_id))
775-
cleanups.append(lambda: aws_client.ec2.delete_security_group(GroupId=sg3_id))
776-
777775

778776
@markers.snapshot.skip_snapshot_verify(
779777
# Moto and LS do not return the ClientToken

‎tests/aws/services/ec2/test_ec2.snapshot.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337
}
338338
},
339339
"tests/aws/services/ec2/test_ec2.py::TestEc2Integrations::test_get_security_groups_for_vpc": {
340-
"recorded-date": "14-05-2025, 20:05:26",
340+
"recorded-date": "14-05-2025, 20:57:48",
341341
"recorded-content": {
342342
"create_vpc": {
343343
"vpc-id": "<vpc-id:1>"
@@ -369,17 +369,17 @@
369369
"get_security_groups_for_vpc": {
370370
"SecurityGroupForVpcs": [
371371
{
372-
"Description": "Test Security Group 2 Description",
373-
"GroupId": "<group-id:2>",
374-
"GroupName": "test-security-group-2",
372+
"Description": "default VPC security group",
373+
"GroupId": "<group-id:4>",
374+
"GroupName": "default",
375375
"OwnerId": "111111111111",
376376
"PrimaryVpcId": "<vpc-id:1>",
377377
"Tags": []
378378
},
379379
{
380-
"Description": "default VPC security group",
381-
"GroupId": "<group-id:4>",
382-
"GroupName": "default",
380+
"Description": "Test Security Group 2 Description",
381+
"GroupId": "<group-id:2>",
382+
"GroupName": "test-security-group-2",
383383
"OwnerId": "111111111111",
384384
"PrimaryVpcId": "<vpc-id:1>",
385385
"Tags": []
@@ -399,9 +399,5 @@
399399
}
400400
}
401401
}
402-
},
403-
"tests/aws/services/ec2/test_ec2.py::TestEc2Integrations::test_get_security_groups_for_vpc_invalid_inputs": {
404-
"recorded-date": "14-05-2025, 20:07:05",
405-
"recorded-content": {}
406402
}
407403
}

‎tests/aws/services/ec2/test_ec2.validation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"last_validated_date": "2024-06-07T01:11:12+00:00"
1313
},
1414
"tests/aws/services/ec2/test_ec2.py::TestEc2Integrations::test_get_security_groups_for_vpc": {
15-
"last_validated_date": "2025-05-14T20:05:19+00:00"
15+
"last_validated_date": "2025-05-14T20:57:45+00:00"
1616
},
1717
"tests/aws/services/ec2/test_ec2.py::TestEc2Integrations::test_vcp_peering_difference_regions": {
1818
"last_validated_date": "2024-06-07T21:28:25+00:00"

0 commit comments

Comments
 (0)