mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 23:00:59 -05:00
test(cloudformation): restore the dynamic reference Javadoc to the test it describes (#3694)
This commit is contained in:
1 parent
a2fddaf08d
commit
d8df3e0143
1 file changed
+14
-14
+14
-14
@@ -380,6 +380,20 @@ class CloudFormationTemplateEngineTest {
|
||||
* literal text because {@code resolveNode}, the general-purpose path every non-RDS property goes
|
||||
* through, had no dynamic-reference stage.
|
||||
*/
|
||||
@Test
|
||||
void resolveNodeResolvesDynamicReferenceInPlainStringValue() {
|
||||
UnaryOperator<String> resolver = value -> {
|
||||
assertEquals("{{resolve:ssm:/demo/url}}", value);
|
||||
return "https://real.example.com";
|
||||
};
|
||||
CloudFormationTemplateEngine e = new CloudFormationTemplateEngine("000000000000",
|
||||
"us-east-1", "my-stack", "stack/id", Map.of(), Map.of(), Map.of(), Map.of(),
|
||||
Map.of(), mapper, (Function<String, String>) name -> null, resolver);
|
||||
|
||||
assertEquals("https://real.example.com",
|
||||
e.resolveNode(json("\"{{resolve:ssm:/demo/url}}\"")).asText());
|
||||
}
|
||||
|
||||
/**
|
||||
* CDK emits an RDS master credential as an {@code Fn::Join} whose fragments split one dynamic
|
||||
* reference: {@code ["{{resolve:secretsmanager:", {"Ref": "Secret"}, ":SecretString:password::}}"]}.
|
||||
@@ -424,20 +438,6 @@ class CloudFormationTemplateEngineTest {
|
||||
+ "{\"Ref\":\"Secret\"},\":SecretString:password::}}\"]]}")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void resolveNodeResolvesDynamicReferenceInPlainStringValue() {
|
||||
UnaryOperator<String> resolver = value -> {
|
||||
assertEquals("{{resolve:ssm:/demo/url}}", value);
|
||||
return "https://real.example.com";
|
||||
};
|
||||
CloudFormationTemplateEngine e = new CloudFormationTemplateEngine("000000000000",
|
||||
"us-east-1", "my-stack", "stack/id", Map.of(), Map.of(), Map.of(), Map.of(),
|
||||
Map.of(), mapper, (Function<String, String>) name -> null, resolver);
|
||||
|
||||
assertEquals("https://real.example.com",
|
||||
e.resolveNode(json("\"{{resolve:ssm:/demo/url}}\"")).asText());
|
||||
}
|
||||
|
||||
/**
|
||||
* The same dynamic-reference stage applies to the text an intrinsic function produces, since a
|
||||
* literal {@code {{resolve:...}}} embedded in an {@code Fn::Sub} template survives substitution
|
||||
|
||||
Reference in new issue
Block a user