Skip to content

Commit b877c7f

Browse files
Terminal codes for Security Group (#70)
Issue #, if available: [1362](aws-controllers-k8s/community#1362) Description of changes: - Removed `InvalidVpcId.NotFound`, `InvalidVpcId.Malformed` and `VPCIdNotSpecified` errors from terminal codes. - Removed integeration test for `InvalidVpcId.NotFound` terminal code. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent e4f679e commit b877c7f

File tree

5 files changed

+4
-61
lines changed

5 files changed

+4
-61
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-08-15T17:09:48Z"
2+
build_date: "2022-08-15T17:56:40Z"
33
build_hash: 87477ae8ca8ac6ddb8c565bbd910cc7e30f55ed0
44
go_version: go1.18.3
55
version: v0.19.3
66
api_directory_checksum: ff86d89efc3212fed4eb14bdc83af54601428a83
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.42.0
99
generator_config_info:
10-
file_checksum: 8b8371fa96d088f1656b21e76951932d4daa48fb
10+
file_checksum: ca6ca773378da313559135dd2c614353077be06f
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,6 @@ resources:
381381
input_fields:
382382
GroupIds: Ids
383383
GroupNames: Names
384-
exceptions:
385-
terminal_codes:
386-
- InvalidVpcID.Malformed
387-
- InvalidVpcID.NotFound
388-
- VPCIdNotSpecified
389384
hooks:
390385
sdk_create_post_build_request:
391386
template_path: hooks/security_group/sdk_create_post_build_request.go.tpl

generator.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,6 @@ resources:
381381
input_fields:
382382
GroupIds: Ids
383383
GroupNames: Names
384-
exceptions:
385-
terminal_codes:
386-
- InvalidVpcID.Malformed
387-
- InvalidVpcID.NotFound
388-
- VPCIdNotSpecified
389384
hooks:
390385
sdk_create_post_build_request:
391386
template_path: hooks/security_group/sdk_create_post_build_request.go.tpl

pkg/resource/security_group/sdk.go

Lines changed: 2 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/tests/test_security_group.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -79,40 +79,6 @@ def test_create_delete(self, ec2_client):
7979
# Check Security Group no longer exists in AWS
8080
ec2_validator.assert_security_group(resource_id, exists=False)
8181

82-
def test_terminal_condition(self):
83-
test_resource_values = REPLACEMENT_VALUES.copy()
84-
resource_name = random_suffix_name("security-group-fail", 24)
85-
86-
test_resource_values["SECURITY_GROUP_NAME"] = resource_name
87-
test_resource_values["VPC_ID"] = "InvalidVpcId"
88-
test_resource_values["SECURITY_GROUP_DESCRIPTION"] = "TestSecurityGroup-terminal"
89-
90-
# Load Security Group CR
91-
resource_data = load_ec2_resource(
92-
"security_group",
93-
additional_replacements=test_resource_values,
94-
)
95-
logging.debug(resource_data)
96-
97-
# Create k8s resource
98-
ref = k8s.CustomResourceReference(
99-
CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL,
100-
resource_name, namespace="default",
101-
)
102-
k8s.create_custom_resource(ref, resource_data)
103-
cr = k8s.wait_resource_consumed_by_controller(ref)
104-
105-
assert cr is not None
106-
assert k8s.get_resource_exists(ref)
107-
108-
expected_msg = "InvalidVpcID.NotFound: The vpc ID 'InvalidVpcId' does not exist"
109-
terminal_condition = k8s.get_resource_condition(ref, "ACK.Terminal")
110-
# Example condition message:
111-
# InvalidVpcID.NotFound: The vpc ID 'InvalidVpcId' does not exist
112-
# status code: 400, request id: 5801fc80-67cf-465f-8b83-5e02d517d554
113-
# This check only verifies the error message; the request hash is irrelevant and therefore can be ignored.
114-
assert expected_msg in terminal_condition['message']
115-
11682
def test_rules_create_update_delete(self, ec2_client):
11783
test_resource_values = REPLACEMENT_VALUES.copy()
11884
resource_name = random_suffix_name("sec-group-rules", 24)

0 commit comments

Comments
 (0)