Skip to content

Commit

Permalink
chore(redshift): fix integ test (aws#21569)
Browse files Browse the repository at this point in the history
This test could not have passed because the elastic ip has not been created before the address is assigned.
This fixes that. It has been run locally and succeeds.


----

### All Submissions:

* [ ] 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

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] 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*
  • Loading branch information
TheRealAmazonKendra authored Aug 12, 2022
1 parent 6cb85a3 commit 1187f8c
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 36 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"Resources": {
"ElasticIPAddress": {
"Type": "AWS::EC2::EIP",
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"Vpc8378EB38": {
"Type": "AWS::EC2::VPC",
"Properties": {
Expand Down Expand Up @@ -525,7 +530,9 @@
"ClusterSubnetGroupName": {
"Ref": "ClusterSubnetsDCFA5CB7"
},
"ElasticIp": "10.123.123.123",
"ElasticIp": {
"Ref": "ElasticIPAddress"
},
"Encrypted": true,
"NumberOfNodes": 2,
"PubliclyAccessible": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"version": "20.0.0",
"testCases": {
"integ.cluster-elasticip": {
"aws-cdk-redshift-elastic-ip-test/DefaultTest": {
"stacks": [
"aws-cdk-redshift-cluster-database"
],
"diffAssets": false,
"stackUpdateWorkflow": true
"assertionStack": "awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798"
}
},
"synthContext": {},
"enableLookups": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"validateOnSynth": false
},
"metadata": {
"/aws-cdk-redshift-cluster-database/ElasticIPAddress": [
{
"type": "aws:cdk:logicalId",
"data": "ElasticIPAddress"
}
],
"/aws-cdk-redshift-cluster-database/Vpc/Resource": [
{
"type": "aws:cdk:logicalId",
Expand Down Expand Up @@ -180,14 +186,20 @@
"/aws-cdk-redshift-cluster-database/Cluster/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "ClusterEB0386A7",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_REPLACE"
]
"data": "ClusterEB0386A7"
}
]
},
"displayName": "aws-cdk-redshift-cluster-database"
},
"awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.template.json",
"validateOnSynth": false
},
"displayName": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.33"
"version": "10.1.71"
}
},
"aws-cdk-redshift-cluster-database": {
"id": "aws-cdk-redshift-cluster-database",
"path": "aws-cdk-redshift-cluster-database",
"children": {
"ElasticIPAddress": {
"id": "ElasticIPAddress",
"path": "aws-cdk-redshift-cluster-database/ElasticIPAddress",
"attributes": {
"aws:cdk:cloudformation:type": "AWS::EC2::EIP",
"aws:cdk:cloudformation:props": {}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-ec2.CfnEIP",
"version": "0.0.0"
}
},
"Vpc": {
"id": "Vpc",
"path": "aws-cdk-redshift-cluster-database/Vpc",
Expand Down Expand Up @@ -826,7 +838,9 @@
"clusterSubnetGroupName": {
"Ref": "ClusterSubnetsDCFA5CB7"
},
"elasticIp": "10.123.123.123",
"elasticIp": {
"Ref": "ElasticIPAddress"
},
"encrypted": true,
"numberOfNodes": 2,
"publiclyAccessible": true,
Expand Down Expand Up @@ -856,6 +870,42 @@
"fqn": "@aws-cdk/core.Stack",
"version": "0.0.0"
}
},
"aws-cdk-redshift-elastic-ip-test": {
"id": "aws-cdk-redshift-elastic-ip-test",
"path": "aws-cdk-redshift-elastic-ip-test",
"children": {
"DefaultTest": {
"id": "DefaultTest",
"path": "aws-cdk-redshift-elastic-ip-test/DefaultTest",
"children": {
"Default": {
"id": "Default",
"path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/Default",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.71"
}
},
"DeployAssert": {
"id": "DeployAssert",
"path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert",
"constructInfo": {
"fqn": "@aws-cdk/core.Stack",
"version": "0.0.0"
}
}
},
"constructInfo": {
"fqn": "@aws-cdk/integ-tests.IntegTestCase",
"version": "0.0.0"
}
}
},
"constructInfo": {
"fqn": "@aws-cdk/integ-tests.IntegTest",
"version": "0.0.0"
}
}
},
"constructInfo": {
Expand Down
12 changes: 8 additions & 4 deletions packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/usr/bin/env node
/// !cdk-integ pragma:ignore-assets
import * as ec2 from '@aws-cdk/aws-ec2';
import * as cdk from '@aws-cdk/core';
import * as integ from '@aws-cdk/integ-tests';
import * as constructs from 'constructs';
import * as redshift from '../lib';

const app = new cdk.App();

const stack = new cdk.Stack(app, 'aws-cdk-redshift-cluster-database');

cdk.Aspects.of(stack).add({
visit(node: constructs.IConstruct) {
if (cdk.CfnResource.isCfnResource(node)) {
Expand All @@ -16,6 +15,7 @@ cdk.Aspects.of(stack).add({
},
});

const elasticIp = new ec2.CfnEIP(stack, 'ElasticIPAddress');
const vpc = new ec2.Vpc(stack, 'Vpc', {
enableDnsHostnames: true,
enableDnsSupport: true,
Expand All @@ -29,7 +29,11 @@ new redshift.Cluster(stack, 'Cluster', {
masterUsername: 'admin',
},
publiclyAccessible: true,
elasticIp: '10.123.123.123',
elasticIp: elasticIp.ref,
});

new integ.IntegTest(app, 'aws-cdk-redshift-elastic-ip-test', {
testCases: [stack],
});

app.synth();

0 comments on commit 1187f8c

Please sign in to comment.