Skip to content

Commit

Permalink
fixup do useful integ tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Jan 5, 2023
1 parent f40bd8f commit 6a39e0a
Show file tree
Hide file tree
Showing 23 changed files with 2,728 additions and 200 deletions.
1 change: 1 addition & 0 deletions packages/@aws-cdk/integ-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/aws-sqs": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/integ-tests": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
import { App, Stack } from '@aws-cdk/core';
import { IntegTest } from '@aws-cdk/integ-tests';
import { App, Stack } from "@aws-cdk/core";
import { ExpectedResult, IntegTest } from "@aws-cdk/integ-tests";
import * as sqs from "@aws-cdk/aws-sqs";

const app = new App();
const stack = new Stack(app);
const stack = new Stack(app, "TypeScriptStack");

new IntegTest(app, 'Integ', { testCases: [stack] });
const queue = new sqs.Queue(stack, "Queue", {
fifo: true,
});

const integ = new IntegTest(app, "TypeScript", { testCases: [stack] });

integ.assertions
.awsApiCall("SQS", "getQueueAttributes", {
QueueUrl: queue.queueUrl,
AttributeNames: ["QueueArn"],
})
.assertAtPath(
"Attributes.QueueArn",
ExpectedResult.stringLikeRegexp(".*\\.fifo$")
);

app.synth();

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "22.0.0",
"files": {
"278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4": {
"source": {
"path": "asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"884f6a34f5af139919c79f7141fa993fe740ad1b22d8376b8c410891a5375258": {
"source": {
"path": "TypeScriptDefaultTestDeployAssert326F54C0.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "884f6a34f5af139919c79f7141fa993fe740ad1b22d8376b8c410891a5375258.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"Resources": {
"AwsApiCallSQSgetQueueAttributes": {
"Type": "Custom::DeployAssert@SdkCallSQSgetQueueAttributes",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F",
"Arn"
]
},
"service": "SQS",
"api": "getQueueAttributes",
"expected": "{\"$StringLike\":\".*\\\\.fifo$\"}",
"actualPath": "Attributes.QueueArn",
"parameters": {
"QueueUrl": {
"Fn::ImportValue": "TypeScriptStack:ExportsOutputRefQueue4A7E3555425E8BD3"
},
"AttributeNames": [
"QueueArn"
]
},
"flattenResponse": "true",
"outputPaths": [
"Attributes.QueueArn"
],
"salt": "1672925181504"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
]
},
"ManagedPolicyArns": [
{
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}
],
"Policies": [
{
"PolicyName": "Inline",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"sqs:GetQueueAttributes"
],
"Effect": "Allow",
"Resource": [
"*"
]
}
]
}
}
]
}
},
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Runtime": "nodejs14.x",
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.zip"
},
"Timeout": 120,
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73",
"Arn"
]
}
}
}
},
"Outputs": {
"AssertionResultsAwsApiCallSQSgetQueueAttributes": {
"Value": {
"Fn::GetAtt": [
"AwsApiCallSQSgetQueueAttributes",
"assertion"
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "22.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"17df2b35842875d1c6503893d859747aad3657768e67f486f0b6fbaa833cf1dd": {
"source": {
"path": "Default.template.json",
"path": "TypeScriptStack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
"objectKey": "17df2b35842875d1c6503893d859747aad3657768e67f486f0b6fbaa833cf1dd.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
{
"Resources": {
"Queue4A7E3555": {
"Type": "AWS::SQS::Queue",
"Properties": {
"FifoQueue": true
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
},
"Outputs": {
"ExportsOutputRefQueue4A7E3555425E8BD3": {
"Value": {
"Ref": "Queue4A7E3555"
},
"Export": {
"Name": "TypeScriptStack:ExportsOutputRefQueue4A7E3555425E8BD3"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
Expand Down
Loading

0 comments on commit 6a39e0a

Please sign in to comment.