Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions scripts/archive_migration_functions.sh
Original file line number Diff line number Diff line change
@@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down
21 changes: 16 additions & 5 deletions x-pack/test/functional/apps/dashboard/group1/preserve_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
20 changes: 15 additions & 5 deletions x-pack/test/functional/apps/discover/preserve_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
23 changes: 17 additions & 6 deletions x-pack/test/functional/apps/visualize/preserve_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Loading