[8.x] Improves cleanup in spaces data functional test (#198921) (#199024)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Improves cleanup in spaces data functional test
(#198921)](https://github.com/elastic/kibana/pull/198921)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jeramy
Soucy","email":"jeramy.soucy@elastic.co"},"sourceCommit":{"committedDate":"2024-11-05T16:31:25Z","message":"Improves
cleanup in spaces data functional test (#198921)\n\nCloses
#52714\r\n\r\n## Summary\r\n\r\nUses the sample data FTR service to
remove the sample data via API\r\nduring cleanup. Previously, the after
block only removed the sample data\r\nfrom one space and attempted to
rely on an esArchiver call to clean up\r\nremaining data later on. As
the scope of the test does not use the\r\nesArchiver any longer, it
seems more appropriate to remove the sample\r\ndata more
deterministically.\r\n\r\n### Flaky test
runner\r\n\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7335","sha":"b5c8ed7b5c8883993a534626384fe92b728e850c","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","release_note:skip","v9.0.0","backport:all-open","FTR"],"title":"Improves
cleanup in spaces data functional
test","number":198921,"url":"https://github.com/elastic/kibana/pull/198921","mergeCommit":{"message":"Improves
cleanup in spaces data functional test (#198921)\n\nCloses
#52714\r\n\r\n## Summary\r\n\r\nUses the sample data FTR service to
remove the sample data via API\r\nduring cleanup. Previously, the after
block only removed the sample data\r\nfrom one space and attempted to
rely on an esArchiver call to clean up\r\nremaining data later on. As
the scope of the test does not use the\r\nesArchiver any longer, it
seems more appropriate to remove the sample\r\ndata more
deterministically.\r\n\r\n### Flaky test
runner\r\n\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7335","sha":"b5c8ed7b5c8883993a534626384fe92b728e850c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198921","number":198921,"mergeCommit":{"message":"Improves
cleanup in spaces data functional test (#198921)\n\nCloses
#52714\r\n\r\n## Summary\r\n\r\nUses the sample data FTR service to
remove the sample data via API\r\nduring cleanup. Previously, the after
block only removed the sample data\r\nfrom one space and attempted to
rely on an esArchiver call to clean up\r\nremaining data later on. As
the scope of the test does not use the\r\nesArchiver any longer, it
seems more appropriate to remove the sample\r\ndata more
deterministically.\r\n\r\n### Flaky test
runner\r\n\r\n-\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7335","sha":"b5c8ed7b5c8883993a534626384fe92b728e850c"}}]}]
BACKPORT-->

Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
This commit is contained in:
Kibana Machine 2024-11-06 05:20:49 +11:00 committed by GitHub
parent ab745989f7
commit 6fa817aa3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,7 @@ export default function spaceSelectorFunctionalTests({
'spaceSelector',
]);
const spacesService = getService('spaces');
const sampleData = getService('sampleData');
describe('Spaces', function () {
const testSpacesIds = ['another-space', ...Array.from('123456789', (idx) => `space-${idx}`)];
@ -158,14 +159,7 @@ export default function spaceSelectorFunctionalTests({
});
after(async () => {
// No need to remove the same sample data in both spaces, the index
// data will be removed in the first call. By feature limitation,
// the created saved objects in the second space will be broken but removed
// when we call esArchiver.unload('x-pack/test/functional/es_archives/spaces').
await PageObjects.common.navigateToApp('home', {
hash: sampleDataHash,
});
await PageObjects.home.removeSampleDataSet('logs');
await sampleData.testResources.removeKibanaSampleData('logs');
await PageObjects.security.forceLogout();
});