forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(athena): WorkGroup tags corruption (aws#9085)
Since Athena does not have AWS constructs the tests are empty. What does the team think about me adding one test to verify this patch is correctly applied for the cfn generated constructs? Can I also get feedback on the file name choice I made or a pointer to conventions on the patch file names? Fixes aws#6936 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
5 changed files
with
153 additions
and
3 deletions.
There are no files selected for viewing
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
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,6 +1,72 @@ | ||
import '@aws-cdk/assert/jest'; | ||
import {} from '../lib'; | ||
import { expect, haveResource } from '@aws-cdk/assert'; | ||
import * as cdk from '@aws-cdk/core'; | ||
import { CfnWorkGroup } from '../lib'; | ||
|
||
test('No tests are specified for this package', () => { | ||
expect(true).toBe(true); | ||
describe('Athena Workgroup Tags', () => { | ||
test('test tag spec correction', () => { | ||
const stack = new cdk.Stack(); | ||
new CfnWorkGroup(stack, 'Athena-Workgroup', { | ||
name: 'HelloWorld', | ||
description: 'A WorkGroup', | ||
recursiveDeleteOption: true, | ||
state: 'ENABLED', | ||
tags: [ | ||
{ | ||
key: 'key1', | ||
value: 'value1', | ||
}, | ||
{ | ||
key: 'key2', | ||
value: 'value2', | ||
}], | ||
workGroupConfiguration: { | ||
requesterPaysEnabled: true, | ||
resultConfiguration: { | ||
outputLocation: 's3://fakebucketme/athena/results/', | ||
}, | ||
}, | ||
}); | ||
expect(stack).to(haveResource('AWS::Athena::WorkGroup', { | ||
Tags: [ | ||
{ | ||
Key: 'key1', | ||
Value: 'value1', | ||
}, | ||
{ | ||
Key: 'key2', | ||
Value: 'value2', | ||
}, | ||
], | ||
})); | ||
}); | ||
test('test tag aspect spec correction', () => { | ||
const stack = new cdk.Stack(); | ||
cdk.Tag.add(stack, 'key1', 'value1'); | ||
cdk.Tag.add(stack, 'key2', 'value2'); | ||
new CfnWorkGroup(stack, 'Athena-Workgroup', { | ||
name: 'HelloWorld', | ||
description: 'A WorkGroup', | ||
recursiveDeleteOption: true, | ||
state: 'ENABLED', | ||
workGroupConfiguration: { | ||
requesterPaysEnabled: true, | ||
resultConfiguration: { | ||
outputLocation: 's3://fakebucketme/athena/results/', | ||
}, | ||
}, | ||
}); | ||
expect(stack).to(haveResource('AWS::Athena::WorkGroup', { | ||
Tags: [ | ||
{ | ||
Key: 'key1', | ||
Value: 'value1', | ||
}, | ||
{ | ||
Key: 'key2', | ||
Value: 'value2', | ||
}, | ||
], | ||
})); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
packages/@aws-cdk/aws-athena/test/integ.workgroup.expected.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,23 @@ | ||
{ | ||
"Resources": { | ||
"AthenaWorkgroup": { | ||
"Type": "AWS::Athena::WorkGroup", | ||
"Properties": { | ||
"Name": "HelloWorld", | ||
"Description": "A WorkGroup", | ||
"RecursiveDeleteOption": true, | ||
"State": "ENABLED", | ||
"Tags": [ | ||
{ | ||
"Key": "key1", | ||
"Value": "value1" | ||
}, | ||
{ | ||
"Key": "key2", | ||
"Value": "value2" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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,23 @@ | ||
import * as cdk from '@aws-cdk/core'; | ||
import { CfnWorkGroup }from '../lib'; | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'aws-cdk-athena-workgroup-tags'); | ||
|
||
new CfnWorkGroup(stack, 'AthenaWorkgroup', { | ||
name: 'HelloWorld', | ||
description: 'A WorkGroup', | ||
recursiveDeleteOption: true, | ||
state: 'ENABLED', | ||
tags: [ | ||
{ | ||
key: 'key1', | ||
value: 'value1', | ||
}, | ||
{ | ||
key: 'key2', | ||
value: 'value2', | ||
}], | ||
}); | ||
|
||
app.synth(); |
36 changes: 36 additions & 0 deletions
36
packages/@aws-cdk/cfnspec/spec-source/570_Athena_Workgroup_Tags_patch.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,36 @@ | ||
{ | ||
"PropertyTypes": { | ||
"AWS::Athena::WorkGroup.Tags": { | ||
"patch": { | ||
"description": "Corrects tag specification for AWS::Athena::WorkGroup.Tags", | ||
"operations": [ | ||
{ | ||
"op": "remove", | ||
"path": "/Properties" | ||
}, | ||
{ | ||
"op": "add", | ||
"path": "/ItemType", | ||
"value": "Tag" | ||
}, | ||
{ | ||
"op": "add", | ||
"path": "/Required", | ||
"value": false | ||
}, | ||
{ | ||
"op": "add", | ||
"path": "/Type", | ||
"value": "List" | ||
}, | ||
{ | ||
"op": "add", | ||
"path": "/UpdateType", | ||
"value": "Mutable" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
|