[Archive Migration] batch 5 of removing empty_kibana (#139410)

* remove use of empty_kibana es_archive

* remove empty_kibana archives again

* replace es_archiver/empty_kibana with cleanStandardList

* remove more empty_kibana uses

* add cleanup of a package

* remove comment

* move fleet_setup before epm, something not cleaning packages

* revert fleet_api_integration changes and restore empty_kibana
This commit is contained in:
Lee Drengenberg 2022-08-27 03:24:39 -05:00 committed by GitHub
parent e19232cc02
commit a029e68e56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 14 deletions

View file

@ -219,6 +219,7 @@ export default function ({ getService, getPageObject }) {
const retry = getService('retry'); const retry = getService('retry');
const testSubjects = getService('testSubjects'); const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver'); const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
// for historical reasons, PageObjects are loaded in a single API call // for historical reasons, PageObjects are loaded in a single API call
// and returned on an object with a key/value for each requested PageObject // and returned on an object with a key/value for each requested PageObject
@ -231,8 +232,8 @@ export default function ({ getService, getPageObject }) {
// app/page and restores some archives into {es} with esArchiver // app/page and restores some archives into {es} with esArchiver
before(async () => { before(async () => {
await Promise.all([ await Promise.all([
// start with an empty .kibana index // start by clearing Saved Objects from the .kibana index
esArchiver.load('test/functional/fixtures/es_archiver/empty_kibana'), await kibanaServer.savedObjects.cleanStandardList();
// load some basic log data only if the index doesn't exist // load some basic log data only if the index doesn't exist
esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/makelogs') esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/makelogs')
]); ]);
@ -243,10 +244,10 @@ export default function ({ getService, getPageObject }) {
// right after the before() hook definition, add the teardown steps // right after the before() hook definition, add the teardown steps
// that will tidy up {es} for other test suites // that will tidy up {es} for other test suites
after(async () => { after(async () => {
// we unload the empty_kibana archive but not the makelogs // we clear Kibana Saved Objects but not the makelogs
// archive because we don't make any changes to it, and subsequent // archive because we don't make any changes to it, and subsequent
// suites could use it if they call `.loadIfNeeded()`. // suites could use it if they call `.loadIfNeeded()`.
await esArchiver.unload('test/functional/fixtures/es_archiver/empty_kibana'); await kibanaServer.savedObjects.cleanStandardList();
}); });
// This series of tests illustrate how tests generally verify // This series of tests illustrate how tests generally verify

View file

@ -12,19 +12,20 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
const browser = getService('browser'); const browser = getService('browser');
const log = getService('log'); const log = getService('log');
const esArchiver = getService('esArchiver'); const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
describe('dashboard elements', () => { describe('dashboard elements', () => {
before(async () => { before(async () => {
log.debug('Starting before method'); log.debug('Starting before method');
await browser.setWindowSize(1280, 800); await browser.setWindowSize(1280, 800);
await esArchiver.load('test/functional/fixtures/es_archiver/empty_kibana'); await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/long_window_logstash'); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/long_window_logstash');
}); });
after(async () => { after(async () => {
await esArchiver.unload('test/functional/fixtures/es_archiver/empty_kibana'); await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.unload('test/functional/fixtures/es_archiver/long_window_logstash'); await esArchiver.unload('test/functional/fixtures/es_archiver/long_window_logstash');
}); });

View file

@ -15,12 +15,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry'); const retry = getService('retry');
const security = getService('security'); const security = getService('security');
const PageObjects = getPageObjects(['common', 'home', 'settings', 'discover', 'timePicker']); const PageObjects = getPageObjects(['common', 'home', 'settings', 'discover', 'timePicker']);
const kibanaServer = getService('kibanaServer');
describe('Index patterns on aliases', function () { describe('Index patterns on aliases', function () {
before(async function () { before(async function () {
await kibanaServer.savedObjects.cleanStandardList();
await security.testUser.setRoles(['kibana_admin', 'test_alias_reader']); await security.testUser.setRoles(['kibana_admin', 'test_alias_reader']);
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/alias'); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/alias');
await esArchiver.load('test/functional/fixtures/es_archiver/empty_kibana');
await es.indices.updateAliases({ await es.indices.updateAliases({
body: { body: {
actions: [ actions: [
@ -76,6 +77,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => { after(async () => {
await PageObjects.common.unsetTime(); await PageObjects.common.unsetTime();
await security.testUser.restoreDefaults(); await security.testUser.restoreDefaults();
await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.unload('test/functional/fixtures/es_archiver/alias'); await esArchiver.unload('test/functional/fixtures/es_archiver/alias');
}); });
}); });

View file

@ -343,7 +343,7 @@ The data the tests need:
- Is generated on the fly using our application APIs (preferred way) - Is generated on the fly using our application APIs (preferred way)
- Is ingested on the ELS instance using the `es_archiver` utility - Is ingested on the ELS instance using the `es_archiver` utility
By default, when running the tests in Jenkins mode, a base set of data is ingested on the ELS instance: an empty kibana index and a set of auditbeat data (the `empty_kibana` and `auditbeat` archives, respectively). This is usually enough to cover most of the scenarios that we are testing. By default, when running the tests in Jenkins mode, a base set of data is ingested on the ELS instance: a set of auditbeat data (the `auditbeat` archive). This is usually enough to cover most of the scenarios that we are testing.
### How to generate a new archive ### How to generate a new archive

View file

@ -28,6 +28,9 @@ export async function buildUp(getService: FtrProviderContext['getService']) {
} }
export async function tearDown(getService: FtrProviderContext['getService']) { export async function tearDown(getService: FtrProviderContext['getService']) {
const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer');
await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana'); await kibanaServer.savedObjects.cleanStandardList();
const spacesService = getService('spaces');
for (const space of Object.values(Spaces)) await spacesService.delete(space.id);
} }

View file

@ -26,6 +26,9 @@ export async function buildUp(getService: FtrProviderContext['getService']) {
} }
export async function tearDown(getService: FtrProviderContext['getService']) { export async function tearDown(getService: FtrProviderContext['getService']) {
const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer');
await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana'); await kibanaServer.savedObjects.cleanStandardList();
const spacesService = getService('spaces');
for (const space of Object.values(Spaces)) await spacesService.delete(space.id);
} }

View file

@ -12,12 +12,13 @@ export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest'); const supertest = getService('supertest');
const esArchiver = getService('esArchiver'); const esArchiver = getService('esArchiver');
const chance = new Chance(); const chance = new Chance();
const kibanaServer = getService('kibanaServer');
describe('POST /internal/cloud_security_posture/update_rules_config', () => { describe('POST /internal/cloud_security_posture/update_rules_config', () => {
let agentPolicyId: string; let agentPolicyId: string;
before(async () => { before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server'); await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server');
const { body: agentPolicyResponse } = await supertest const { body: agentPolicyResponse } = await supertest
@ -31,7 +32,7 @@ export default function ({ getService }: FtrProviderContext) {
}); });
after(async () => { after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana'); await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.unload('x-pack/test/functional/es_archives/fleet/empty_fleet_server'); await esArchiver.unload('x-pack/test/functional/es_archives/fleet/empty_fleet_server');
}); });