-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Index management] Clean all tests after execution and navigate directly to the tab #232198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SoniaSanzV
merged 6 commits into
elastic:main
from
SoniaSanzV:kbn_mngmt_test/index_management_tests_cleanup
Aug 29, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2dc1357
Clean all tests after execution and navigate directly to the tab
SoniaSanzV ee0835e
Add changes to serverless
SoniaSanzV 4b843c9
Add missing navigateTo
SoniaSanzV 8fa330e
Unify cleaning for enrich
SoniaSanzV c8bf852
Merge branch 'main' into kbn_mngmt_test/index_management_tests_cleanup
SoniaSanzV d74139c
Separate index and policy deletion
SoniaSanzV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -56,20 +56,20 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { | |
|
|
||
| await log.debug('Navigating to the enrich policies tab'); | ||
| await security.testUser.setRoles(['index_management_user']); | ||
| await pageObjects.common.navigateToApp('indexManagement'); | ||
| // Navigate to the enrich policies tab | ||
| await pageObjects.indexManagement.changeTabs('enrich_policiesTab'); | ||
| await pageObjects.header.waitUntilLoadingHasFinished(); | ||
| await pageObjects.indexManagement.navigateToIndexManagementTab('enrich_policies'); | ||
| }); | ||
|
|
||
| after(async () => { | ||
| await log.debug('Cleaning up created index and policy'); | ||
|
|
||
| try { | ||
| await es.enrich.deletePolicy({ name: ENRICH_POLICY_NAME }); | ||
| } catch (e) { | ||
| log.debug(`[Teardown error] Error deleting test policy: ${e.message}`); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here |
||
| } | ||
| try { | ||
| await es.indices.delete({ index: ENRICH_INDEX_NAME }); | ||
| } catch (e) { | ||
| log.debug('[Teardown error] Error deleting test policy'); | ||
| throw e; | ||
| log.debug(`[Teardown error] Error deleting test index: ${e.message}`); | ||
| } | ||
| }); | ||
|
|
||
|
|
@@ -100,10 +100,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { | |
|
|
||
| it('can delete a policy', async () => { | ||
| await security.testUser.setRoles(['index_management_user']); | ||
| await pageObjects.common.navigateToApp('indexManagement'); | ||
| // Navigate to the enrich policies tab | ||
| await pageObjects.indexManagement.changeTabs('enrich_policiesTab'); | ||
| await pageObjects.header.waitUntilLoadingHasFinished(); | ||
| await pageObjects.indexManagement.navigateToIndexManagementTab('enrich_policies'); | ||
| // Since we disabled wait_for_completion in the server request, we dont know when | ||
| // a given policy will finish executing. Until that happens the policy cannot | ||
| // be deleted. 2s seems to be plenty enough to guarantee that, at least for this | ||
|
|
@@ -121,9 +118,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { | |
| this.tags('skipFIPS'); | ||
| it('read only access', async () => { | ||
| await security.testUser.setRoles(['index_management_monitor_enrich_only']); | ||
| await pageObjects.common.navigateToApp('indexManagement'); | ||
| await pageObjects.indexManagement.changeTabs('enrich_policiesTab'); | ||
| await pageObjects.header.waitUntilLoadingHasFinished(); | ||
| await pageObjects.indexManagement.navigateToIndexManagementTab('enrich_policies'); | ||
|
|
||
| await testSubjects.missingOrFail('createPolicyButton'); | ||
| await testSubjects.missingOrFail('deletePolicyButton'); | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could separate these into two
try-catchblocks so that if one fails the other resource is still deleted, and the log message would be more helpful (i.e. right now, if the policy deletion failed, the logs will say that the index deletion failed).