-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QA] Encryption Rotation tests via Email Connectors (#82659)
- Loading branch information
1 parent
e078e90
commit 3979418
Showing
4 changed files
with
132 additions
and
45 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
x-pack/test/stack_functional_integration/apps/alerts/alerts_encryption_keys.js
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
|
||
const ARCHIVE = 'email_connectors_with_encryption_rotation'; | ||
|
||
export default ({ getPageObjects, getService }) => { | ||
const esArchiver = getService('esArchiver'); | ||
const testSubjects = getService('testSubjects'); | ||
const pageObjects = getPageObjects(['common', 'triggersActionsUI']); | ||
const find = getService('find'); | ||
const retry = getService('retry'); | ||
|
||
const address = (name) => (emails) => emails.split(',').find((x) => x.includes(name)); | ||
const toWayne = address('wayne'); | ||
|
||
describe('encryption key rotation with', function () { | ||
before(async () => { | ||
esArchiver.load(ARCHIVE); | ||
}); | ||
beforeEach(async () => { | ||
await pageObjects.common.navigateToApp('triggersConnectors'); | ||
}); | ||
after(async () => { | ||
esArchiver.unload(ARCHIVE); | ||
}); | ||
|
||
describe(`email connectors`, () => { | ||
describe(`without the key used to create it`, () => { | ||
it('should show a failure callout', async () => { | ||
const connectorName = 'should_fail'; | ||
await testConnector(connectorName); | ||
await retry.try(async () => { | ||
const executionFailureResultCallout = await testSubjects.find('executionFailureResult'); | ||
expect(await executionFailureResultCallout.getVisibleText()).to.match( | ||
/Internal Server Error/ | ||
); | ||
}); | ||
expect(true).to.be(true); | ||
}); | ||
}); | ||
describe(`with a decryption only key`, () => { | ||
it('should show a success callout', async () => { | ||
const connectorName = 'decrypt_only'; | ||
await testConnector(connectorName); | ||
await retry.try(async () => { | ||
await testSubjects.find('executionSuccessfulResult'); | ||
}); | ||
}); | ||
}); | ||
describe(`with the current key`, () => { | ||
it('should show a success callout', async () => { | ||
const connectorName = 'current_key'; | ||
await testConnector(connectorName); | ||
await retry.try(async () => { | ||
await testSubjects.find('executionSuccessfulResult'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
async function testConnector(name) { | ||
await pageObjects.triggersActionsUI.searchConnectors(name); | ||
await testSubjects.click('runConnector'); | ||
await testSubjects.setValue('comboBoxInput', toWayne(process.env.REPORTING_TEST_EMAILS)); | ||
await testSubjects.setValue('subjectInput', name); | ||
await testSubjects.setValue('messageTextArea', name); | ||
await find.clickByCssSelector('[data-test-subj="executeActionButton"]:not(disabled)'); | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
x-pack/test/stack_functional_integration/apps/alerts/index.js
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export default ({ loadTestFile }) => { | ||
describe('Encryption Rotation', function () { | ||
loadTestFile(require.resolve('./alerts_encryption_keys')); | ||
}); | ||
}; |
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