[Archive Migrations] reporting-ecommerce_kibana_spaces - using an api in conjuction with migration (#136288)

* [Archive Migrations] x-pack-reporting-ecommerce_kibana_spaces

Replaces the old es archive with kbn archive.
Change test to use new archive.

Helps with: https://github.com/elastic/kibana/issues/102552

* Drop original archive.

* fixup

* Increase timeout.

* Decrease timeout.

* drop only

* Increase timeout after chatting with Lee about
how these tests run on cloud and often take
longer.

* Drop non_timezone_space and related code after chatting
with T Sullivan and Lee.

* Add timestamp stuff from Lee.

* Drop unused.

* CR fixups.

* Shouldn't need this.
This commit is contained in:
Tre 2022-07-29 11:58:17 +01:00 committed by GitHub
parent ef5a9f1378
commit 9171417da3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 136 additions and 2887 deletions

View file

@ -2,9 +2,11 @@
standard_list="url,index-pattern,query,graph-workspace,tag,visualization,canvas-element,canvas-workpad,dashboard,search,lens,map,cases,uptime-dynamic-settings,osquery-saved-query,osquery-pack,infrastructure-ui-source,metrics-explorer-view,inventory-view,infrastructure-monitoring-log-view,apm-indices"
orig_archive="x-pack/test/functional/es_archives/banners/multispace"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/banners/multispace"
test_config="x-pack/test/functional/apps/spaces/config.ts"
orig_archive="x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_spaces"
newArchives=("x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_non_default_space")
newArchives+=("x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_non_timezone_space")
test_config="x-pack/test/reporting_api_integration/reporting_and_security.config.ts"
arrayify_csv() {
local xs=${1}
@ -29,6 +31,11 @@ intersection() {
echo "${intersections[@]}"
}
# Just a note that this is using Gnu date.
# On OSX if you don't install this, and instead use the native date you only get seconds.
# With gdate you can something like nanoseconds.
alias timestamp='while read line; do echo "[`gdate +%H:%M:%S.%N`] $line"; done'
is_zipped() {
local archive=$1
@ -91,7 +98,6 @@ _find_config() {
local current
local parent
local grandParent
local greatGrand
current=$(dirname "$test_file")
parent=$(dirname "$current")
@ -277,6 +283,16 @@ load_kbn() {
set +x
}
load_kbns() {
local space=${1:-default}
for x in "${newArchives[@]}"; do
set -x
node scripts/kbn_archiver.js --config "$test_config" load "$x" --space "$space"
set +x
done
}
load_created_kbn_archive() {
set -x
node scripts/kbn_archiver.js --config "$test_config" load "$new_archive"
@ -289,6 +305,16 @@ unload_kbn() {
set +x
}
unload_kbns() {
local space=${1:-default}
for x in "${newArchives[@]}"; do
set -x
node scripts/kbn_archiver.js --config "$test_config" unload "$x"
set +x
done
}
ping_server() {
set -x
server_addr="http://elastic:changeme@localhost:9220"
@ -312,6 +338,14 @@ run_test() {
set +x
}
run_test_with_timestamp() {
local config=${1:-$test_config}
set -x
node scripts/functional_test_runner --config "$config" | timestamp
set +x
}
run_test_extra() {
set -x
node scripts/functional_test_runner --config "$test_config" \

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -13,7 +13,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
// eslint-disable-next-line import/no-default-export
export default function ({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
const kibanaServer = getService('kibanaServer');
const reportingAPI = getService('reportingAPI');
const supertest = getService('supertest');
@ -39,19 +39,21 @@ export default function ({ getService }: FtrProviderContext) {
);
};
const spacesSharedObjectsArchive =
'x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces';
describe('Exports and Spaces', () => {
const id = 'non_default_space';
before(async () => {
await esArchiver.load(spacesSharedObjectsArchive); // multiple spaces with different config settings
await spacesService.create({ id, name: id });
await kibanaServer.importExport.load(
`x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_non_default_space`,
{ space: id }
);
await reportingAPI.initEcommerce();
});
after(async () => {
await reportingAPI.teardownEcommerce();
await reportingAPI.deleteAllReports();
await esArchiver.unload(spacesSharedObjectsArchive);
await spacesService.delete(id);
});
/*

View file

@ -43,7 +43,7 @@ export default function ({ getService }: FtrProviderContext) {
{ jobParams: createPdfV2Params(1541.5999755859375) }
);
await retry.tryForTime(18000, async () => {
await retry.tryForTime(48000, async () => {
const response: supertest.Response = await supertestSvc
.get(downloadReportPath)
.responseType('blob')