Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya committed Jan 4, 2024
1 parent f33fd3c commit 6b9e5ec
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/infra-stack-props.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,41 @@ test('Throw error on missing CPU Arch', () => {
expect(error.message).toEqual('cpuArch parameter is required. Valid inputs: x64 or arm64');
}
});

test('Throw error on invalid CPU Arch', () => {
const app = new App({
context: {
distVersion: '1.0.0',
securityDisabled: false,
minDistribution: false,
cpuArch: 'arm64',
singleNodeCluster: false,
dashboardsUrl: 'www.example.com',
serverAccessType: 'ipv4',
restrictServerAccessTo: 'all',
additionalConfig: '{ "name": "John Doe", "age": 30, "email": "johndoe@example.com" }',
additionalOsdConfig: '{ "something.enabled": "true", something_else.enabled": "false" }',
},
});
// WHEN
try {
// WHEN
const networkStack = new NetworkStack(app, 'opensearch-network-stack', {
env: { account: 'test-account', region: 'us-east-1' },
});

// @ts-ignore
const infraStack = new InfraStack(app, 'opensearch-infra-stack', {
vpc: networkStack.vpc,
securityGroup: networkStack.osSecurityGroup,
env: { account: 'test-account', region: 'us-east-1' },
});

// eslint-disable-next-line no-undef
fail('Expected an error to be thrown');
} catch (error) {
expect(error).toBeInstanceOf(Error);
// @ts-ignore
expect(error.message).toEqual('distributionUrl parameter is required. Please provide the OpenSearch distribution artifact url to download');
}
});

0 comments on commit 6b9e5ec

Please sign in to comment.