From 6b9e5ec98df5123745ff5aff75641a4a848671de Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Thu, 4 Jan 2024 11:56:58 -0800 Subject: [PATCH] Add more tests Signed-off-by: Sayali Gaikawad --- test/infra-stack-props.test.ts | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/infra-stack-props.test.ts b/test/infra-stack-props.test.ts index 5c08307bad5..f8be7563e37 100644 --- a/test/infra-stack-props.test.ts +++ b/test/infra-stack-props.test.ts @@ -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'); + } +});