Skip to content

Commit 98eb981

Browse files
chore(stepfunctions-tasks): athenaStartQueryExecution addition to integration tests for better coverage (#22699)
Based on the recommendation from @TheRealAmazonKendra in #22694, here is a modification to the integration test for the fix to #22650 . This is in addition to PR #22692 which fixed the original problem, thanks to @kaizencc. I know this bug has already been closed, but I already had this written, so I just figured I would submit it anyways. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 7b51ea9 commit 98eb981

File tree

7 files changed

+62
-24
lines changed

7 files changed

+62
-24
lines changed

packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ const startQueryExecutionJob = new AthenaStartQueryExecution(stack, 'Start Athen
2020
encryptionConfiguration: {
2121
encryptionOption: EncryptionOption.S3_MANAGED,
2222
},
23+
outputLocation: {
24+
bucketName: 'query-results-bucket',
25+
objectKey: 'folder',
26+
},
2327
},
2428
});
2529

packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.integ.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.assets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "20.0.0",
2+
"version": "21.0.0",
33
"files": {
4-
"60ec4a933a76b17b02958f5e3be45afa01bedec88203c997738cf20fe4cf7fc2": {
4+
"18086c8605b3e9331cb12bb96c57aa22b79a3d214ce457de38940cde714961ad": {
55
"source": {
66
"path": "aws-stepfunctions-tasks-athena-start-query-execution-integ.template.json",
77
"packaging": "file"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "60ec4a933a76b17b02958f5e3be45afa01bedec88203c997738cf20fe4cf7fc2.json",
12+
"objectKey": "18086c8605b3e9331cb12bb96c57aa22b79a3d214ce457de38940cde714961ad.json",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}

packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.integ.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.template.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,34 @@
8383
{
8484
"Action": [
8585
"lakeformation:GetDataAccess",
86-
"s3:AbortMultipartUpload",
8786
"s3:CreateBucket",
8887
"s3:GetBucketLocation",
8988
"s3:GetObject",
90-
"s3:ListBucket",
89+
"s3:ListBucket"
90+
],
91+
"Effect": "Allow",
92+
"Resource": "*"
93+
},
94+
{
95+
"Action": [
96+
"s3:AbortMultipartUpload",
9197
"s3:ListBucketMultipartUploads",
9298
"s3:ListMultipartUploadParts",
9399
"s3:PutObject"
94100
],
95101
"Effect": "Allow",
96-
"Resource": "*"
102+
"Resource": {
103+
"Fn::Join": [
104+
"",
105+
[
106+
"arn:",
107+
{
108+
"Ref": "AWS::Partition"
109+
},
110+
":s3:::query-results-bucket/folder"
111+
]
112+
]
113+
}
97114
},
98115
{
99116
"Action": [
@@ -229,7 +246,7 @@
229246
{
230247
"Ref": "AWS::Partition"
231248
},
232-
":states:::athena:startQueryExecution\",\"Parameters\":{\"QueryString.$\":\"$.queryString\",\"QueryExecutionContext\":{\"Database\":\"mydatabase\"},\"ResultConfiguration\":{\"EncryptionConfiguration\":{\"EncryptionOption\":\"SSE_S3\"}}}}},\"TimeoutSeconds\":30}"
249+
":states:::athena:startQueryExecution\",\"Parameters\":{\"QueryString.$\":\"$.queryString\",\"QueryExecutionContext\":{\"Database\":\"mydatabase\"},\"ResultConfiguration\":{\"EncryptionConfiguration\":{\"EncryptionOption\":\"SSE_S3\"},\"OutputLocation\":\"s3://query-results-bucket/folder/\"}}}},\"TimeoutSeconds\":30}"
233250
]
234251
]
235252
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"20.0.0"}
1+
{"version":"21.0.0"}

packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.integ.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "20.0.0",
2+
"version": "21.0.0",
33
"testCases": {
44
"integ.start-query-execution": {
55
"stacks": [

packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.integ.snapshot/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "20.0.0",
2+
"version": "21.0.0",
33
"artifacts": {
44
"Tree": {
55
"type": "cdk:tree",
@@ -23,7 +23,7 @@
2323
"validateOnSynth": false,
2424
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
2525
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
26-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/60ec4a933a76b17b02958f5e3be45afa01bedec88203c997738cf20fe4cf7fc2.json",
26+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/18086c8605b3e9331cb12bb96c57aa22b79a3d214ce457de38940cde714961ad.json",
2727
"requiresBootstrapStackVersion": 6,
2828
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2929
"additionalDependencies": [

packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.integ.snapshot/tree.json

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"path": "Tree",
1010
"constructInfo": {
1111
"fqn": "constructs.Construct",
12-
"version": "10.1.85"
12+
"version": "10.1.140"
1313
}
1414
},
1515
"aws-stepfunctions-tasks-athena-start-query-execution-integ": {
@@ -130,17 +130,34 @@
130130
{
131131
"Action": [
132132
"lakeformation:GetDataAccess",
133-
"s3:AbortMultipartUpload",
134133
"s3:CreateBucket",
135134
"s3:GetBucketLocation",
136135
"s3:GetObject",
137-
"s3:ListBucket",
136+
"s3:ListBucket"
137+
],
138+
"Effect": "Allow",
139+
"Resource": "*"
140+
},
141+
{
142+
"Action": [
143+
"s3:AbortMultipartUpload",
138144
"s3:ListBucketMultipartUploads",
139145
"s3:ListMultipartUploadParts",
140146
"s3:PutObject"
141147
],
142148
"Effect": "Allow",
143-
"Resource": "*"
149+
"Resource": {
150+
"Fn::Join": [
151+
"",
152+
[
153+
"arn:",
154+
{
155+
"Ref": "AWS::Partition"
156+
},
157+
":s3:::query-results-bucket/folder"
158+
]
159+
]
160+
}
144161
},
145162
{
146163
"Action": [
@@ -296,7 +313,7 @@
296313
{
297314
"Ref": "AWS::Partition"
298315
},
299-
":states:::athena:startQueryExecution\",\"Parameters\":{\"QueryString.$\":\"$.queryString\",\"QueryExecutionContext\":{\"Database\":\"mydatabase\"},\"ResultConfiguration\":{\"EncryptionConfiguration\":{\"EncryptionOption\":\"SSE_S3\"}}}}},\"TimeoutSeconds\":30}"
316+
":states:::athena:startQueryExecution\",\"Parameters\":{\"QueryString.$\":\"$.queryString\",\"QueryExecutionContext\":{\"Database\":\"mydatabase\"},\"ResultConfiguration\":{\"EncryptionConfiguration\":{\"EncryptionOption\":\"SSE_S3\"},\"OutputLocation\":\"s3://query-results-bucket/folder/\"}}}},\"TimeoutSeconds\":30}"
300317
]
301318
]
302319
}
@@ -317,28 +334,28 @@
317334
"id": "stateMachineArn",
318335
"path": "aws-stepfunctions-tasks-athena-start-query-execution-integ/stateMachineArn",
319336
"constructInfo": {
320-
"fqn": "constructs.Construct",
321-
"version": "10.1.85"
337+
"fqn": "@aws-cdk/core.CfnOutput",
338+
"version": "0.0.0"
322339
}
323340
},
324341
"Service-principalMap": {
325342
"id": "Service-principalMap",
326343
"path": "aws-stepfunctions-tasks-athena-start-query-execution-integ/Service-principalMap",
327344
"constructInfo": {
328-
"fqn": "constructs.Construct",
329-
"version": "10.1.85"
345+
"fqn": "@aws-cdk/core.CfnMapping",
346+
"version": "0.0.0"
330347
}
331348
}
332349
},
333350
"constructInfo": {
334-
"fqn": "constructs.Construct",
335-
"version": "10.1.85"
351+
"fqn": "@aws-cdk/core.Stack",
352+
"version": "0.0.0"
336353
}
337354
}
338355
},
339356
"constructInfo": {
340-
"fqn": "constructs.Construct",
341-
"version": "10.1.85"
357+
"fqn": "@aws-cdk/core.App",
358+
"version": "0.0.0"
342359
}
343360
}
344361
}

0 commit comments

Comments
 (0)