From 92b669e6863717e7c24b7db5a67fff96253a4042 Mon Sep 17 00:00:00 2001 From: Aaron Moat <2937187+AaronMoat@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:19:14 +1000 Subject: [PATCH] Reduce noise in CDK template snapshots (#1649) --- .../infra/__snapshots__/appStack.test.ts.snap | 20 +++++++++---------- .../infra/appStack.test.ts | 5 ++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap b/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap index 319220ad0..2151f06a1 100644 --- a/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +++ b/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap @@ -182,7 +182,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], "Timeout": 30, @@ -321,7 +321,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, @@ -352,7 +352,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, @@ -389,7 +389,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, @@ -534,7 +534,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, @@ -885,7 +885,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], "Timeout": 30, @@ -1024,7 +1024,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, @@ -1055,7 +1055,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, @@ -1092,7 +1092,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, @@ -1237,7 +1237,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = ` "Tags": [ { "Key": "aws-codedeploy-hooks", - "Value": "2.1.1-8a9d620b7ff7fbe76112f7c96c06f51e36bb2cb3", + "Value": "x.x.x-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, ], }, diff --git a/template/lambda-sqs-worker-cdk/infra/appStack.test.ts b/template/lambda-sqs-worker-cdk/infra/appStack.test.ts index 42ddb7acb..cdd0bb5f1 100644 --- a/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +++ b/template/lambda-sqs-worker-cdk/infra/appStack.test.ts @@ -50,8 +50,11 @@ it.each(['dev', 'prod'])( .replaceAll( /workerCurrentVersion([0-9a-zA-Z]+)"/g, (_, hash) => `workerCurrentVersion${'x'.repeat(hash.length)}"`, + ) + .replaceAll( + /"Value":"\d+\.\d+\.\d+-([^"]+)"/g, + (_, hash) => `"Value": "x.x.x-${'x'.repeat(hash.length)}"`, ); - expect(JSON.parse(json)).toMatchSnapshot(); }, );