-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integ-runner): example language integ tests should do something
- Loading branch information
Showing
22 changed files
with
2,743 additions
and
219 deletions.
There are no files selected for viewing
37 changes: 32 additions & 5 deletions
37
packages/@aws-cdk/integ-runner/test/language-tests/integ.typescript-test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,36 @@ | ||
import { App, Stack } from '@aws-cdk/core'; | ||
import { IntegTest } from '@aws-cdk/integ-tests'; | ||
/** | ||
* This test cannot use service modules since it would introduce a circular dependency | ||
* Using CfnResource etc. is a workaround to still test something useful | ||
*/ | ||
import * as cdk from "@aws-cdk/core"; | ||
import { ExpectedResult, IntegTest } from "@aws-cdk/integ-tests"; | ||
|
||
const app = new App(); | ||
const stack = new Stack(app); | ||
const app = new cdk.App(); | ||
|
||
new IntegTest(app, 'Integ', { testCases: [stack] }); | ||
const stack = new cdk.Stack(app, "TypeScriptStack"); | ||
const queue = new cdk.CfnResource(stack, "Queue", { | ||
type: "AWS::SQS::Queue", | ||
properties: { | ||
FifoQueue: true | ||
} | ||
}); | ||
|
||
const assertionStack = new cdk.Stack(app, "TypeScriptAssertions"); | ||
assertionStack.addDependency(stack); | ||
|
||
const integ = new IntegTest(app, "TypeScript", { | ||
testCases: [stack], | ||
assertionStack, | ||
}); | ||
|
||
integ.assertions | ||
.awsApiCall("SQS", "getQueueAttributes", { | ||
QueueUrl: stack.exportValue(queue.getAtt("QueueUrl", cdk.ResolutionTypeHint.STRING)), | ||
AttributeNames: ["QueueArn"], | ||
}) | ||
.assertAtPath( | ||
"Attributes.QueueArn", | ||
ExpectedResult.stringLikeRegexp(".*\\.fifo$") | ||
); | ||
|
||
app.synth(); |
19 changes: 0 additions & 19 deletions
19
...-tests/integ.typescript-test.ts.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
...ests/integ.typescript-test.ts.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...er/test/language-tests/integ.typescript-test.ts.snapshot/TypeScriptAssertions.assets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | ||
} | ||
} | ||
}, | ||
"bb131995f97d3bf2ccde6c8fd8d88a6b780ae97a9348985f50b9207d5e341b5c": { | ||
"source": { | ||
"path": "TypeScriptAssertions.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "bb131995f97d3bf2ccde6c8fd8d88a6b780ae97a9348985f50b9207d5e341b5c.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
139 changes: 139 additions & 0 deletions
139
.../test/language-tests/integ.typescript-test.ts.snapshot/TypeScriptAssertions.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:ExportsOutputFnGetAttQueueQueueUrlA8D516BA" | ||
}, | ||
"AttributeNames": [ | ||
"QueueArn" | ||
] | ||
}, | ||
"flattenResponse": "true", | ||
"outputPaths": [ | ||
"Attributes.QueueArn" | ||
], | ||
"salt": "1672941547549" | ||
}, | ||
"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." | ||
} | ||
] | ||
} | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...thon-test.py.snapshot/Default.assets.json → ...t.ts.snapshot/TypeScriptStack.assets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...on-test.py.snapshot/Default.template.json → ...ts.snapshot/TypeScriptStack.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.