Skip to content

Commit

Permalink
Merge branch 'master' into madeline-k/feat/kinesisfirehose-deliveryst…
Browse files Browse the repository at this point in the history
…ream
  • Loading branch information
madeline-k authored Jul 22, 2021
2 parents 8c2903e + 91cf79b commit efb6eee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
8 changes: 2 additions & 6 deletions packages/@aws-cdk/aws-elasticsearch/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1415,12 +1415,8 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {
// Validate feature support for the given Elasticsearch version, per
// https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-features-by-version.html
if (elasticsearchVersionNum < 5.1) {
if (
props.logging?.slowIndexLogEnabled
|| props.logging?.appLogEnabled
|| props.logging?.slowSearchLogEnabled
) {
throw new Error('Error and slow logs publishing requires Elasticsearch version 5.1 or later.');
if (props.logging?.appLogEnabled) {
throw new Error('Error logs publishing requires Elasticsearch version 5.1 or later.');
}
if (props.encryptionAtRest?.enabled) {
throw new Error('Encryption of data at rest requires Elasticsearch version 5.1 or later.');
Expand Down
16 changes: 2 additions & 14 deletions packages/@aws-cdk/aws-elasticsearch/test/domain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1317,26 +1317,14 @@ describe('custom error responses', () => {
})).toThrow(/Unknown Elasticsearch version: 5\.4/);
});

test('error when log publishing is enabled for elasticsearch version < 5.1', () => {
const error = /logs publishing requires Elasticsearch version 5.1 or later/;
test('error when error log publishing is enabled for elasticsearch version < 5.1', () => {
const error = /Error logs publishing requires Elasticsearch version 5.1 or later/;
expect(() => new Domain(stack, 'Domain1', {
version: ElasticsearchVersion.V2_3,
logging: {
appLogEnabled: true,
},
})).toThrow(error);
expect(() => new Domain(stack, 'Domain2', {
version: ElasticsearchVersion.V1_5,
logging: {
slowSearchLogEnabled: true,
},
})).toThrow(error);
expect(() => new Domain(stack, 'Domain3', {
version: ElasticsearchVersion.V1_5,
logging: {
slowIndexLogEnabled: true,
},
})).toThrow(error);
});

test('error when encryption at rest is enabled for elasticsearch version < 5.1', () => {
Expand Down

0 comments on commit efb6eee

Please sign in to comment.