Skip to content

Commit

Permalink
Fix protocol mapping with certificate (#144)
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya authored Mar 15, 2024
1 parent f68c5f9 commit 1cfa4cd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
14 changes: 7 additions & 7 deletions nightly-playground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nightly-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
39 changes: 37 additions & 2 deletions nightly-playground/test/nightly-playground.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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', {
Expand Down Expand Up @@ -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',
});
});

0 comments on commit 1cfa4cd

Please sign in to comment.