-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Darshit Chanpura <[email protected]>
- Loading branch information
1 parent
768ba1a
commit 4c84726
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,7 @@ test('Test Resources with security enabled multi-node with existing Vpc with use | |
const app = new App({ | ||
context: { | ||
securityDisabled: false, | ||
adminPassword: "myStrongPassword123!", | ||
minDistribution: false, | ||
distributionUrl: 'www.example.com', | ||
cpuArch: 'x64', | ||
|
@@ -165,6 +166,7 @@ test('Test Resources with security enabled single-node cluster', () => { | |
const app = new App({ | ||
context: { | ||
securityDisabled: false, | ||
adminPassword: "myStrongPassword123!", | ||
minDistribution: false, | ||
distributionUrl: 'www.example.com', | ||
cpuArch: 'x64', | ||
|
@@ -220,6 +222,7 @@ test('Throw error on wrong cpu arch to instance mapping', () => { | |
const app = new App({ | ||
context: { | ||
securityDisabled: false, | ||
adminPassword: "myStrongPassword123!", | ||
minDistribution: false, | ||
distributionUrl: 'www.example.com', | ||
cpuArch: 'arm64', | ||
|
@@ -254,6 +257,7 @@ test('Throw error on ec2 instance outside of enum list', () => { | |
const app = new App({ | ||
context: { | ||
securityDisabled: false, | ||
adminPassword: "myStrongPassword123!", | ||
minDistribution: false, | ||
distributionUrl: 'www.example.com', | ||
cpuArch: 'x64', | ||
|
@@ -428,6 +432,7 @@ test('Throw error on unsupported ebs volume type', () => { | |
const app = new App({ | ||
context: { | ||
securityDisabled: false, | ||
adminPassword: "myStrongPassword123!", | ||
minDistribution: false, | ||
distributionUrl: 'www.example.com', | ||
cpuArch: 'x64', | ||
|
@@ -524,3 +529,36 @@ test('Throw error on incorrect JSON', () => { | |
expect(error.message).toEqual('Encountered following error while parsing customConfigFiles json parameter: SyntaxError: Unexpected token o in JSON at position 25'); | ||
} | ||
}); | ||
|
||
test('Throw error when security is enabled and adminPassword is not defined', () => { | ||
const app = new App({ | ||
context: { | ||
securityDisabled: false, | ||
minDistribution: false, | ||
distributionUrl: 'www.example.com', | ||
cpuArch: 'x64', | ||
singleNodeCluster: false, | ||
dashboardsUrl: 'www.example.com', | ||
distVersion: '1.0.0', | ||
serverAccessType: 'ipv4', | ||
restrictServerAccessTo: 'all', | ||
additionalConfig: '{ "name": "John Doe", "age": 30, "email": "[email protected]" }', | ||
additionalOsdConfig: '{ "something.enabled": "true", "something_else.enabled": "false" }', | ||
// eslint-disable-next-line max-len | ||
customConfigFiles: '{"test/data/config.yml": opensearch/config/opensearch-security/config.yml"}', | ||
}, | ||
}); | ||
// WHEN | ||
try { | ||
const testStack = new OsClusterEntrypoint(app, { | ||
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); | ||
// eslint-disable-next-line max-len | ||
expect(error.message).toEqual('adminPassword parameter is required to be set when security is enabled'); | ||
} | ||
}); |