Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(athena): WorkGroup tags corruption #9085

Merged
merged 13 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-athena/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"nodeunit-shim": "0.0.0",
"cfn2ts": "0.0.0",
"pkglint": "0.0.0"
},
Expand Down
72 changes: 69 additions & 3 deletions packages/@aws-cdk/aws-athena/test/athena.test.ts
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 packages/@aws-cdk/aws-athena/test/integ.workgroup.expected.json
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"
}
]
}
}
}
}
23 changes: 23 additions & 0 deletions packages/@aws-cdk/aws-athena/test/integ.workgroup.ts
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();
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"
}
]
}
}
}
}