diff --git a/nightly-playground/package-lock.json b/nightly-playground/package-lock.json index 7528414..d3fcfa2 100644 --- a/nightly-playground/package-lock.json +++ b/nightly-playground/package-lock.json @@ -8,7 +8,7 @@ "name": "nightly-playground", "version": "0.1.0", "dependencies": { - "@opensearch-project/opensearch-cluster-cdk": "1.2.0", + "@opensearch-project/opensearch-cluster-cdk": "1.2.1", "@types/babel__traverse": "^7.18.2", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", @@ -1323,9 +1323,9 @@ } }, "node_modules/@opensearch-project/opensearch-cluster-cdk": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@opensearch-project/opensearch-cluster-cdk/-/opensearch-cluster-cdk-1.2.0.tgz", - "integrity": "sha512-zXJc/CaeBeI42YGCI3iimUjm0OY7rDRHZaACz4akpqWSm7X+Wp7FMkp0GTsOZo9rRa59zqirplekfrenAF3M+A==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@opensearch-project/opensearch-cluster-cdk/-/opensearch-cluster-cdk-1.2.1.tgz", + "integrity": "sha512-K8JjU5iP9dlid8ovL+R3eI18vDV/Ef4vpFTd88ZkBU7sUewmOiqnHc3mrtmbcm0eW4ZiAJ5P4tbahWltmSOEQw==", "dependencies": { "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", @@ -7889,9 +7889,9 @@ } }, "@opensearch-project/opensearch-cluster-cdk": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@opensearch-project/opensearch-cluster-cdk/-/opensearch-cluster-cdk-1.2.0.tgz", - "integrity": "sha512-zXJc/CaeBeI42YGCI3iimUjm0OY7rDRHZaACz4akpqWSm7X+Wp7FMkp0GTsOZo9rRa59zqirplekfrenAF3M+A==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@opensearch-project/opensearch-cluster-cdk/-/opensearch-cluster-cdk-1.2.1.tgz", + "integrity": "sha512-K8JjU5iP9dlid8ovL+R3eI18vDV/Ef4vpFTd88ZkBU7sUewmOiqnHc3mrtmbcm0eW4ZiAJ5P4tbahWltmSOEQw==", "requires": { "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", diff --git a/nightly-playground/package.json b/nightly-playground/package.json index 152e567..0bf8523 100644 --- a/nightly-playground/package.json +++ b/nightly-playground/package.json @@ -22,7 +22,7 @@ "typescript": "~3.9.7" }, "dependencies": { - "@opensearch-project/opensearch-cluster-cdk": "1.2.0", + "@opensearch-project/opensearch-cluster-cdk": "1.2.1", "@types/babel__traverse": "^7.18.2", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", diff --git a/nightly-playground/test/nightly-playground.test.ts b/nightly-playground/test/nightly-playground.test.ts index 3a9f823..fca3876 100644 --- a/nightly-playground/test/nightly-playground.test.ts +++ b/nightly-playground/test/nightly-playground.test.ts @@ -6,7 +6,7 @@ this file be licensed under the Apache-2.0 license or a compatible open source license. */ import { App } from 'aws-cdk-lib'; -import { Template } from 'aws-cdk-lib/assertions'; +import { Match, Template } from 'aws-cdk-lib/assertions'; import { NightlyPlaygroundStack } from '../lib/nightly-playground-stack'; test('Ensure security is always enabled with custom role mapping', () => { @@ -29,7 +29,7 @@ test('Ensure security is always enabled with custom role mapping', () => { const infraTemplate = Template.fromStack(infraStack); infraTemplate.hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Port: 443, + Port: 8443, Protocol: 'TCP', }); infraTemplate.hasResource('AWS::AutoScaling::AutoScalingGroup', { @@ -124,3 +124,38 @@ test('Test commons stack resources', () => { ValidationMethod: 'DNS', }); }); + +test('Ensure port mapping', () => { + const app = new App({ + context: { + distVersion: '2.3.0', + distributionUrl: 'someUrl', + dashboardsUrl: 'someUrl', + }, + }); + + // WHEN + const nightlyStack = new NightlyPlaygroundStack(app, '2x', { + env: { account: 'test-account', region: 'us-east-1' }, + }); + + expect(nightlyStack.stacks).toHaveLength(3); + const infraStack = nightlyStack.stacks.filter((s) => s.stackName === 'infraStack-2x')[0]; + const infraTemplate = Template.fromStack(infraStack); + + infraTemplate.hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Port: 443, + Protocol: 'TLS', + Certificates: [ + { + CertificateArn: { + 'Fn::ImportValue': Match.anyValue(), + }, + }, + ], + }); + infraTemplate.hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Port: 8443, + Protocol: 'TCP', + }); +});