[Archive Migrations] x-pack spaces-multi-space (#139552)

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

Helps with: elastic#102552
This commit is contained in:
Tre 2022-09-06 17:06:53 +01:00 committed by GitHub
parent 09b2a49494
commit 114bc85ee2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 220 additions and 461 deletions

View file

@ -1,24 +1,36 @@
#!/bin/bash
# ??? Should we migrate
# x-pack/test/functional/es_archives/dashboard/feature_controls/spaces
# x-pack/test/functional/es_archives/spaces/multi_space
# ### Yes, it needs migration
# ### Saved Object type(s) that we care about:
# dashboard
# index-pattern
# visualization
# ### Test file(s) that use it:
# x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_spaces.ts
# x-pack/test/functional/apps/discover/preserve_url.ts
# x-pack/test/functional/apps/visualize/preserve_url.ts
# x-pack/test/functional/apps/dashboard/group1/preserve_url.ts
# ### Config(s) that govern the test file(s):
# x-pack/test/functional/apps/dashboard/group1/config.ts
# x-pack/test/functional/apps/discover/config.ts
# x-pack/test/functional/apps/visualize/config.ts
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/dashboard/feature_controls/spaces"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/dashboard/feature_controls/custom_space"
newArchives=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/feature_controls/custom_space")
newArchives+=("x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_non_timezone_space")
orig_archive="x-pack/test/functional/es_archives/spaces/multi_space"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space"
# newArchives=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space")
# newArchives+=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space")
testFiles=("x-pack/test/functional/apps/discover/preserve_url.ts")
testFiles+=("x-pack/test/functional/apps/visualize/preserve_url.ts")
testFiles+=("x-pack/test/functional/apps/dashboard/group1/preserve_url.ts")
test_config="x-pack/test/functional/apps/dashboard/group1/config.ts"
# test_config="x-pack/test/functional/apps/discover/config.ts"
# test_config="x-pack/test/functional/apps/visualize/config.ts"
curl_so_count() {
local so=${1:-search-session}
@ -356,14 +368,7 @@ save_kbn() {
load_kbn() {
local space=${1:-default}
set -x
node scripts/kbn_archiver.js --config "$test_config" load "$new_archive" --space "$space"
set +x
}
load_kbns() {
local space=${1:-default}
local archive=${2:-${new_archive}}
for x in "${newArchives[@]}"; do
set -x
@ -379,8 +384,9 @@ load_created_kbn_archive() {
}
unload_kbn() {
local archive=${1:-${new_archive}}
set -x
node scripts/kbn_archiver.js --config "$test_config" unload "$new_archive"
node scripts/kbn_archiver.js --config "$test_config" unload "$archive"
set +x
}

View file

@ -9,18 +9,29 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'dashboard', 'spaceSelector', 'header']);
const appsMenu = getService('appsMenu');
const globalNav = getService('globalNav');
const kibanaServer = getService('kibanaServer');
const spacesService = getService('spaces');
describe('preserve url', function () {
before(async function () {
await esArchiver.load('x-pack/test/functional/es_archives/spaces/multi_space');
const anotherSpace = 'another-space';
before(async () => {
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space_default_space'
);
await spacesService.create({ id: anotherSpace, name: 'Another Space' });
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space_another_space',
{ space: anotherSpace }
);
});
after(function () {
return esArchiver.unload('x-pack/test/functional/es_archives/spaces/multi_space');
after(async () => {
await spacesService.delete(anotherSpace);
await kibanaServer.savedObjects.cleanStandardList();
});
it('goes back to last opened url', async function () {

View file

@ -9,17 +9,27 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'discover', 'spaceSelector', 'header']);
const globalNav = getService('globalNav');
const kibanaServer = getService('kibanaServer');
const spacesService = getService('spaces');
describe('preserve url', function () {
before(async function () {
await esArchiver.load('x-pack/test/functional/es_archives/spaces/multi_space');
const anotherSpace = 'another-space';
before(async () => {
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space_default_space'
);
await spacesService.create({ id: anotherSpace, name: 'Another Space' });
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space_another_space',
{ space: anotherSpace }
);
});
after(function () {
return esArchiver.unload('x-pack/test/functional/es_archives/spaces/multi_space');
after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
});
it('goes back to last opened url', async function () {

View file

@ -9,21 +9,32 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'visualize', 'spaceSelector', 'visChart']);
const appsMenu = getService('appsMenu');
const globalNav = getService('globalNav');
const kibanaServer = getService('kibanaServer');
const spacesService = getService('spaces');
describe('preserve url', function () {
before(async function () {
await esArchiver.load('x-pack/test/functional/es_archives/spaces/multi_space');
const anotherSpace = 'another-space';
before(async () => {
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space_default_space'
);
await spacesService.create({ id: anotherSpace, name: 'Another Space' });
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space_another_space',
{ space: anotherSpace }
);
});
after(function () {
return esArchiver.unload('x-pack/test/functional/es_archives/spaces/multi_space');
after(async () => {
await spacesService.delete(anotherSpace);
await kibanaServer.savedObjects.cleanStandardList();
});
it('goes back to last opened url', async function () {
it('goes back to last opened url', async () => {
await PageObjects.common.navigateToApp('visualize');
await PageObjects.visualize.openSavedVisualization('A Pie');
await PageObjects.common.navigateToApp('home');

File diff suppressed because one or more lines are too long

View file

@ -1,245 +0,0 @@
{
"type": "index",
"value": {
"aliases": {
".kibana": {}
},
"index": ".kibana_1",
"mappings": {
"properties": {
"config": {
"dynamic": "true",
"properties": {
"buildNum": {
"type": "keyword"
},
"dateFormat:tz": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
},
"dashboard": {
"dynamic": "strict",
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"optionsJSON": {
"type": "text"
},
"panelsJSON": {
"type": "text"
},
"refreshInterval": {
"properties": {
"display": {
"type": "keyword"
},
"pause": {
"type": "boolean"
},
"section": {
"type": "integer"
},
"value": {
"type": "integer"
}
}
},
"timeFrom": {
"type": "keyword"
},
"timeRestore": {
"type": "boolean"
},
"timeTo": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"index-pattern": {
"dynamic": "strict",
"properties": {
"fieldFormatMap": {
"type": "text"
},
"fields": {
"type": "text"
},
"intervalName": {
"type": "keyword"
},
"notExpandable": {
"type": "boolean"
},
"sourceFilters": {
"type": "text"
},
"timeFieldName": {
"type": "keyword"
},
"title": {
"type": "text"
}
}
},
"search": {
"dynamic": "strict",
"properties": {
"columns": {
"type": "keyword"
},
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"sort": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"server": {
"dynamic": "strict",
"properties": {
"uuid": {
"type": "keyword"
}
}
},
"space": {
"properties": {
"_reserved": {
"type": "boolean"
},
"color": {
"type": "keyword"
},
"description": {
"type": "text"
},
"disabledFeatures": {
"type": "keyword"
},
"initials": {
"type": "keyword"
},
"name": {
"fields": {
"keyword": {
"ignore_above": 2048,
"type": "keyword"
}
},
"type": "text"
}
}
},
"spaceId": {
"type": "keyword"
},
"type": {
"type": "keyword"
},
"url": {
"dynamic": "strict",
"properties": {
"accessCount": {
"type": "long"
},
"accessDate": {
"type": "date"
},
"createDate": {
"type": "date"
},
"url": {
"fields": {
"keyword": {
"ignore_above": 2048,
"type": "keyword"
}
},
"type": "text"
}
}
},
"visualization": {
"dynamic": "strict",
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"savedSearchId": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
},
"visState": {
"type": "text"
}
}
}
}
},
"settings": {
"index": {
"number_of_replicas": "1",
"number_of_shards": "1"
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long