Skip to content

Commit

Permalink
fix(glue): expose CfnTable as defaultChild (#4197)
Browse files Browse the repository at this point in the history
* fix(glue): export CfnTable defaultChild

* chore: better defaultChild test
  • Loading branch information
Jimmy Gaussen authored and mergify[bot] committed Sep 24, 2019
1 parent 84e1d4b commit 467d855
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-glue/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export class Table extends Resource implements ITable {
resource: 'table',
resourceName: `${this.database.databaseName}/${this.tableName}`
});
this.node.defaultChild = tableResource;
}

/**
Expand Down
24 changes: 24 additions & 0 deletions packages/@aws-cdk/aws-glue/test/test.table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,30 @@ export = {
test.done();
},

'table.node.defaultChild'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const database = new glue.Database(stack, 'Database', {
databaseName: 'database',
});

// WHEN
const table = new glue.Table(stack, 'Table', {
database,
tableName: 'table',
columns: [{
name: 'col',
type: glue.Schema.STRING
}],
compressed: true,
dataFormat: glue.DataFormat.Json,
});

// THEN
test.ok(table.node.defaultChild instanceof glue.CfnTable);
test.done();
},

'encrypted table': {
'SSE-S3'(test: Test) {
const stack = new cdk.Stack();
Expand Down

0 comments on commit 467d855

Please sign in to comment.