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

chore(elasticsearch): fix broken integration test #21616

Merged
merged 4 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-elasticsearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/integ-tests": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"Resources": {
"ServiceLinkedRole": {
"Type": "AWS::IAM::ServiceLinkedRole",
"Properties": {
"AWSServiceName": "es.amazonaws.com",
"Description": "Role for ElasticSearch VPC Test"
}
},
"Vpc8378EB38": {
"Type": "AWS::EC2::VPC",
"Properties": {
Expand Down Expand Up @@ -397,7 +404,10 @@
"VpcId": {
"Ref": "Vpc8378EB38"
}
}
},
"DependsOn": [
"ServiceLinkedRole"
]
},
"Domain66AC69E0": {
"Type": "AWS::Elasticsearch::Domain",
Expand Down Expand Up @@ -450,6 +460,9 @@
]
}
},
"DependsOn": [
"ServiceLinkedRole"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"17.0.0"}
{"version":"20.0.0"}
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.elasticsearch-vpc": {
"cdk-integ-elasticsearch-vpc-test/DefaultTest": {
"stacks": [
"cdk-integ-elasticsearch-vpc"
],
"diffAssets": false,
"stackUpdateWorkflow": true
"assertionStack": "cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175"
}
},
"synthContext": {},
"enableLookups": false
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "17.0.0",
"version": "20.0.0",
"artifacts": {
"Tree": {
"type": "cdk:tree",
Expand All @@ -15,6 +15,12 @@
"validateOnSynth": false
},
"metadata": {
"/cdk-integ-elasticsearch-vpc/ServiceLinkedRole": [
{
"type": "aws:cdk:logicalId",
"data": "ServiceLinkedRole"
}
],
"/cdk-integ-elasticsearch-vpc/Vpc/Resource": [
{
"type": "aws:cdk:logicalId",
Expand Down Expand Up @@ -167,6 +173,15 @@
]
},
"displayName": "cdk-integ-elasticsearch-vpc"
},
"cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.template.json",
"validateOnSynth": false
},
"displayName": "cdk-integ-elasticsearch-vpc-test/DefaultTest/DeployAssert"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@
"id": "Tree",
"path": "Tree",
"constructInfo": {
"fqn": "@aws-cdk/core.Construct",
"version": "0.0.0"
"fqn": "constructs.Construct",
"version": "10.1.71"
}
},
"cdk-integ-elasticsearch-vpc": {
"id": "cdk-integ-elasticsearch-vpc",
"path": "cdk-integ-elasticsearch-vpc",
"children": {
"ServiceLinkedRole": {
"id": "ServiceLinkedRole",
"path": "cdk-integ-elasticsearch-vpc/ServiceLinkedRole",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnResource",
"version": "0.0.0"
}
},
"Vpc": {
"id": "Vpc",
"path": "cdk-integ-elasticsearch-vpc/Vpc",
Expand Down Expand Up @@ -768,6 +776,42 @@
"fqn": "@aws-cdk/core.Stack",
"version": "0.0.0"
}
},
"cdk-integ-elasticsearch-vpc-test": {
"id": "cdk-integ-elasticsearch-vpc-test",
"path": "cdk-integ-elasticsearch-vpc-test",
"children": {
"DefaultTest": {
"id": "DefaultTest",
"path": "cdk-integ-elasticsearch-vpc-test/DefaultTest",
"children": {
"Default": {
"id": "Default",
"path": "cdk-integ-elasticsearch-vpc-test/DefaultTest/Default",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.71"
}
},
"DeployAssert": {
"id": "DeployAssert",
"path": "cdk-integ-elasticsearch-vpc-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
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import { App, Stack, StackProps, RemovalPolicy } from '@aws-cdk/core';
import { App, Stack, StackProps, RemovalPolicy, CfnResource } from '@aws-cdk/core';
import * as integ from '@aws-cdk/integ-tests';
import { Construct } from 'constructs';
import * as es from '../lib';

class TestStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);

const serviceLinkedRole = new CfnResource(this, 'ServiceLinkedRole', {
type: 'AWS::IAM::ServiceLinkedRole',
properties: {
AWSServiceName: 'es.amazonaws.com',
Description: 'Role for ElasticSearch VPC Test',
},
});

const vpc = new ec2.Vpc(this, 'Vpc');
const domainProps: es.DomainProps = {
version: es.ElasticsearchVersion.V7_1,
Expand All @@ -19,10 +28,14 @@ class TestStack extends Stack {
dataNodes: 2,
},
};
new es.Domain(this, 'Domain', domainProps);
const domain = new es.Domain(this, 'Domain', domainProps);
domain.node.addDependency(serviceLinkedRole);
}
}

const app = new App();
new TestStack(app, 'cdk-integ-elasticsearch-vpc');
const testCase = new TestStack(app, 'cdk-integ-elasticsearch-vpc');
new integ.IntegTest(app, 'cdk-integ-elasticsearch-vpc-test', {
testCases: [testCase],
});
app.synth();