Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 43c1fe6

Browse files
committed
Add validated test for nested intrinsics
1 parent 093a6d3 commit 43c1fe6

3 files changed

Lines changed: 88 additions & 0 deletions

File tree

tests/aws/services/cloudformation/test_change_set_fn_select.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,73 @@ def test_invalid_select_index_type(self, snapshot, aws_client, cleanups, select_
236236
)
237237

238238
snapshot.match("error", exc_info.value.response)
239+
240+
@markers.aws.validated
241+
def test_nested_select_within_other_intrinsics(self, snapshot, deploy_cfn_template):
242+
template = json.dumps(
243+
{
244+
"Resources": {
245+
"Repo": {
246+
"Type": "AWS::ECR::Repository",
247+
},
248+
"Parameter": {
249+
"Type": "AWS::SSM::Parameter",
250+
"Properties": {
251+
"Type": "String",
252+
"Value": {
253+
"Fn::Join": [
254+
"",
255+
[
256+
{
257+
"Fn::Select": [
258+
4,
259+
{
260+
"Fn::Split": [
261+
":",
262+
{"Fn::GetAtt": ["Repo", "Arn"]},
263+
]
264+
},
265+
]
266+
},
267+
".dkr.ecr.",
268+
{
269+
"Fn::Select": [
270+
3,
271+
{
272+
"Fn::Split": [
273+
":",
274+
{"Fn::GetAtt": ["Repo", "Arn"]},
275+
]
276+
},
277+
]
278+
},
279+
".",
280+
{"Ref": "AWS::URLSuffix"},
281+
"/",
282+
{"Ref": "Repo"},
283+
],
284+
]
285+
},
286+
},
287+
},
288+
},
289+
"Outputs": {
290+
"RepoName": {"Value": {"Ref": "Repo"}},
291+
"ParameterValue": {
292+
"Value": {
293+
"Fn::GetAtt": ["Parameter", "Value"],
294+
},
295+
},
296+
},
297+
}
298+
)
299+
stack = deploy_cfn_template(template=template)
300+
snapshot.add_transformer(snapshot.transform.regex(stack.outputs["RepoName"], "<repo-name>"))
301+
# the domain name is different between AWS and LocalStack so transform this value out
302+
snapshot.add_transformer(
303+
snapshot.transform.regex(
304+
r"(localhost\.localstack\.cloud(:\d+)?|amazonaws\.com)", "<domain>"
305+
)
306+
)
307+
308+
snapshot.match("parameter-value", stack.outputs)

tests/aws/services/cloudformation/test_change_set_fn_select.snapshot.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,5 +2436,14 @@
24362436
}
24372437
}
24382438
}
2439+
},
2440+
"tests/aws/services/cloudformation/test_change_set_fn_select.py::TestChangeSetFnSelect::test_nested_select_within_other_intrinsics": {
2441+
"recorded-date": "16-09-2025, 10:30:37",
2442+
"recorded-content": {
2443+
"parameter-value": {
2444+
"ParameterValue": "111111111111.dkr.ecr.<region>.<domain>/<repo-name>",
2445+
"RepoName": "<repo-name>"
2446+
}
2447+
}
24392448
}
24402449
}

tests/aws/services/cloudformation/test_change_set_fn_select.validation.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,14 @@
4343
"teardown": 0.0,
4444
"total": 0.14
4545
}
46+
},
47+
"tests/aws/services/cloudformation/test_change_set_fn_select.py::TestChangeSetFnSelect::test_nested_select_within_other_intrinsics": {
48+
"last_validated_date": "2025-09-16T10:30:37+00:00",
49+
"durations_in_seconds": {
50+
"setup": 0.95,
51+
"call": 12.37,
52+
"teardown": 6.51,
53+
"total": 19.83
54+
}
4655
}
4756
}

0 commit comments

Comments
 (0)