Skip to content

Commit e4f679e

Browse files
Terminal code mappings for RouteTable (#69)
Issue #, if available: [1362](aws-controllers-k8s/community#1362) Description of changes: - Removed `InvalidVpcId.NotFound`, `InvalidVpcId.Malformed` and `InvalidParameterValue` terminal codes for **Route Table** resource. - Removed Integration test that exists for `InvalidVpcId.NotFound` terminal code. I tried adding integration test for the `InvalidParameterValue` by passing an invalid parameter, but it leaves a dangling **VPC** resource which is incorrect, tested locally by using patch and found dangling resource being created. Considering these scenarios, removed the above mentioned terminal codes for **Route Table** resource. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 1978162 commit e4f679e

File tree

5 files changed

+5
-61
lines changed

5 files changed

+5
-61
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-08-11T14:16:06Z"
2+
build_date: "2022-08-15T17:09:48Z"
33
build_hash: 87477ae8ca8ac6ddb8c565bbd910cc7e30f55ed0
4-
go_version: go1.18.1
4+
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: a3238ca676f6a461ed229d04c6bcb8f962f9435b
10+
file_checksum: 8b8371fa96d088f1656b21e76951932d4daa48fb
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
@@ -290,11 +290,6 @@ resources:
290290
sdk_create_post_build_request:
291291
template_path: hooks/nat_gateway/sdk_create_post_build_request.go.tpl
292292
RouteTable:
293-
exceptions:
294-
terminal_codes:
295-
- InvalidVpcID.Malformed
296-
- InvalidVpcID.NotFound
297-
- InvalidParameterValue
298293
fields:
299294
# RouteStatuses as Route to ensure
300295
# fields set server-side (active, origin)

generator.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,6 @@ resources:
290290
sdk_create_post_build_request:
291291
template_path: hooks/nat_gateway/sdk_create_post_build_request.go.tpl
292292
RouteTable:
293-
exceptions:
294-
terminal_codes:
295-
- InvalidVpcID.Malformed
296-
- InvalidVpcID.NotFound
297-
- InvalidParameterValue
298293
fields:
299294
# RouteStatuses as Route to ensure
300295
# fields set server-side (active, origin)

pkg/resource/route_table/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_route_table.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -83,39 +83,6 @@ def test_create_delete(self, ec2_client):
8383
# Check Route Table no longer exists in AWS
8484
ec2_validator.assert_route_table(resource_id, exists=False)
8585

86-
87-
def test_terminal_condition(self):
88-
test_resource_values = REPLACEMENT_VALUES.copy()
89-
resource_name = random_suffix_name("route-table-fail", 24)
90-
test_resource_values["ROUTE_TABLE_NAME"] = resource_name
91-
test_resource_values["VPC_ID"] = "InvalidVpcId"
92-
93-
# Load RouteTable CR
94-
resource_data = load_ec2_resource(
95-
"route_table",
96-
additional_replacements=test_resource_values,
97-
)
98-
logging.debug(resource_data)
99-
100-
# Create k8s resource
101-
ref = k8s.CustomResourceReference(
102-
CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL,
103-
resource_name, namespace="default",
104-
)
105-
k8s.create_custom_resource(ref, resource_data)
106-
cr = k8s.wait_resource_consumed_by_controller(ref)
107-
108-
assert cr is not None
109-
assert k8s.get_resource_exists(ref)
110-
111-
expected_msg = "InvalidVpcID.NotFound: The vpc ID 'InvalidVpcId' does not exist"
112-
terminal_condition = k8s.get_resource_condition(ref, "ACK.Terminal")
113-
# Example condition message:
114-
# InvalidVpcID.NotFound: The vpc ID 'InvalidVpcId' does not exist
115-
# status code: 400, request id: 5801fc80-67cf-465f-8b83-5e02d517d554
116-
# This check only verifies the error message; the request hash is irrelevant and therefore can be ignored.
117-
assert expected_msg in terminal_condition['message']
118-
11986
def test_crud_route(self, ec2_client):
12087
test_resource_values = REPLACEMENT_VALUES.copy()
12188
resource_name = random_suffix_name("route-table-test", 24)

0 commit comments

Comments
 (0)