Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

test(cloudformation): restore the dynamic reference Javadoc to the test it describes (#3694)

Chris Jovanovskid8df3e01433f
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTemplateEngineTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTemplateEngineTest.java
index 05f7fca3e0..c2e62d85dd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTemplateEngineTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTemplateEngineTest.java
@@ -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