From 948870c5b4a2a891435a8e49dc2a6f37aa95aac4 Mon Sep 17 00:00:00 2001 From: Domenico Andreoli Date: Mon, 14 Jun 2021 18:22:23 +0200 Subject: [PATCH] Fix esArchiver path in the Jenkins context --- .../apps/alerts/alerts_encryption_keys.js | 8 +++++++- .../apps/ccs/ccs_discover.js | 10 +++++++--- .../apps/metricbeat/_metricbeat_dashboard.js | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/x-pack/test/stack_functional_integration/apps/alerts/alerts_encryption_keys.js b/x-pack/test/stack_functional_integration/apps/alerts/alerts_encryption_keys.js index f11aa7e09635b..e4ac00661c078 100644 --- a/x-pack/test/stack_functional_integration/apps/alerts/alerts_encryption_keys.js +++ b/x-pack/test/stack_functional_integration/apps/alerts/alerts_encryption_keys.js @@ -6,8 +6,14 @@ */ import expect from '@kbn/expect'; +import { resolve } from 'path'; +import { REPO_ROOT } from '@kbn/dev-utils'; -const ARCHIVE = '../integration-test/test/es_archives/email_connectors_with_encryption_rotation'; +const INTEGRATION_TEST_ROOT = process.env.WORKSPACE || resolve(REPO_ROOT, '../integration-test'); +const ARCHIVE = resolve( + INTEGRATION_TEST_ROOT, + 'test/es_archives/email_connectors_with_encryption_rotation' +); export default ({ getPageObjects, getService }) => { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/stack_functional_integration/apps/ccs/ccs_discover.js b/x-pack/test/stack_functional_integration/apps/ccs/ccs_discover.js index 00fce236b5d17..a22e4438c7dbd 100644 --- a/x-pack/test/stack_functional_integration/apps/ccs/ccs_discover.js +++ b/x-pack/test/stack_functional_integration/apps/ccs/ccs_discover.js @@ -6,11 +6,15 @@ */ import fs from 'fs'; +import { resolve } from 'path'; import expect from '@kbn/expect'; import { Client as EsClient } from '@elastic/elasticsearch'; import { KbnClient } from '@kbn/test'; import { EsArchiver } from '@kbn/es-archiver'; -import { CA_CERT_PATH } from '@kbn/dev-utils'; +import { CA_CERT_PATH, REPO_ROOT } from '@kbn/dev-utils'; + +const INTEGRATION_TEST_ROOT = process.env.WORKSPACE || resolve(REPO_ROOT, '../integration-test'); +const ARCHIVE = resolve(INTEGRATION_TEST_ROOT, 'test/es_archives/metricbeat'); export default ({ getService, getPageObjects }) => { describe('Cross cluster search test in discover', async () => { @@ -261,7 +265,7 @@ export default ({ getService, getPageObjects }) => { before('Prepare data:metricbeat-*', async function () { log.info('Create index'); - await esArchiver.load('../integration-test/test/es_archives/metricbeat'); + await esArchiver.load(ARCHIVE); log.info('Create index pattern'); dataId = await supertest @@ -321,7 +325,7 @@ export default ({ getService, getPageObjects }) => { } log.info('Delete index'); - await esArchiver.unload('../integration-test/test/es_archives/metricbeat'); + await esArchiver.unload(ARCHIVE); }); after('Clean up .siem-signal-*', async function () { diff --git a/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat_dashboard.js b/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat_dashboard.js index 2b25d5ffea6e1..b678e88bcf0df 100644 --- a/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat_dashboard.js +++ b/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat_dashboard.js @@ -6,6 +6,11 @@ */ import expect from '@kbn/expect'; +import { resolve } from 'path'; +import { REPO_ROOT } from '@kbn/dev-utils'; + +const INTEGRATION_TEST_ROOT = process.env.WORKSPACE || resolve(REPO_ROOT, '../integration-test'); +const ARCHIVE = resolve(INTEGRATION_TEST_ROOT, 'test/es_archives/metricbeat'); export default function ({ getService, getPageObjects, updateBaselines }) { const screenshot = getService('screenshots'); @@ -15,7 +20,7 @@ export default function ({ getService, getPageObjects, updateBaselines }) { describe('check metricbeat Dashboard', function () { before(async function () { - await esArchiver.load('../integration-test/test/es_archives/metricbeat'); + await esArchiver.load(ARCHIVE); // this navigateToActualURL takes the place of navigating to the dashboard landing page, // filtering on the dashboard name, selecting it, setting the timepicker, and going to full screen @@ -45,7 +50,7 @@ export default function ({ getService, getPageObjects, updateBaselines }) { }); after(async function () { - await esArchiver.unload('../integration-test/test/es_archives/metricbeat'); + await esArchiver.unload(ARCHIVE); }); it('[Metricbeat System] Overview ECS should match snapshot', async function () {