Skip to content

Commit 7274527

Browse files
committed
ignore ACK system tags during tag assertion
1 parent 9413fc6 commit 7274527

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

Diff for: test/e2e/tag.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
# not use this file except in compliance with the License. A copy of the
5+
# License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is distributed
10+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
# express or implied. See the License for the specific language governing
12+
# permissions and limitations under the License.
13+
14+
"""Utilities for working with tags
15+
TODO(vijtrip2): reuse tag utility from test-infra/acktest.
16+
Currently using this duplicate method to punt changing the
17+
way resources are bootstrapped
18+
"""
19+
20+
ACK_SYSTEM_TAG_PREFIX = "services.k8s.aws/"
21+
22+
23+
def clean(tags):
24+
"""Returns supplied tags collection, stripped of ACK system tags.
25+
"""
26+
return [
27+
t for t in tags if not t['Key'].startswith(ACK_SYSTEM_TAG_PREFIX)
28+
]

Diff for: test/e2e/tests/test_table.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
get_resource_tags,
2929
)
3030
from e2e.replacement_values import REPLACEMENT_VALUES
31+
from e2e import tag
3132

3233
RESOURCE_PLURAL = "tables"
3334

@@ -153,7 +154,7 @@ def test_table_update_tags(self, dynamodb_client):
153154
k8s.patch_custom_resource(ref, cr)
154155
time.sleep(UPDATE_TAGS_WAIT_AFTER_SECONDS)
155156

156-
table_tags = get_resource_tags(cr["status"]["ackResourceMetadata"]["arn"])
157+
table_tags = tag.clean(get_resource_tags(cr["status"]["ackResourceMetadata"]["arn"]))
157158
assert len(table_tags) == len(tags)
158159
assert table_tags[0]['Key'] == tags[0]['key']
159160
assert table_tags[0]['Value'] == tags[0]['value']

0 commit comments

Comments
 (0)