[Dashboard] Adds migration smoke tests for TSVB panels on dashboard (#105655) (#106745)

* Adds migration smoke tests for TSVB panels on dashboard

* Adds index pattern TSVB panel

* Update 7.13.3 export

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Corey Robertson <corey.robertson@elastic.co>
This commit is contained in:
Kibana Machine 2021-07-26 14:11:44 -04:00 committed by GitHub
parent e103f1ae49
commit b0ca99fa08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 139 additions and 0 deletions

View file

@ -21,5 +21,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./dashboard_maps_by_value'));
loadTestFile(require.resolve('./migration_smoke_tests/lens_migration_smoke_test'));
loadTestFile(require.resolve('./migration_smoke_tests/tsvb_migration_smoke_test'));
});
}

View file

@ -0,0 +1,3 @@
{"attributes":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[]}"},"optionsJSON":"{\"hidePanelTitles\":false,\"useMargins\":true}","panelsJSON":"[{\"version\":\"7.13.3\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"90f0f762-f2ae-4400-b650-e699513c6dbf\"},\"panelIndex\":\"90f0f762-f2ae-4400-b650-e699513c6dbf\",\"embeddableConfig\":{\"savedVis\":{\"title\":\"Non Kibana Index\",\"description\":\"\",\"type\":\"metrics\",\"params\":{\"time_range_mode\":\"entire_time_range\",\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"timeseries\",\"series\":[{\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"palette\":{\"type\":\"palette\",\"name\":\"default\"},\"metrics\":[{\"id\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"type\":\"count\"}],\"separate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash*\",\"use_kibana_indexes\":false,\"interval\":\"\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"axis_scale\":\"normal\",\"show_legend\":1,\"show_grid\":1,\"tooltip_mode\":\"show_all\",\"isModelInvalid\":false},\"uiState\":{},\"data\":{\"aggs\":[],\"searchSource\":{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}}},\"enhancements\":{}}},{\"version\":\"7.13.3\",\"type\":\"visualization\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"e7112256-80ef-4d79-836c-6480e0039179\"},\"panelIndex\":\"e7112256-80ef-4d79-836c-6480e0039179\",\"embeddableConfig\":{\"savedVis\":{\"title\":\"\",\"description\":\"\",\"type\":\"metrics\",\"params\":{\"time_range_mode\":\"entire_time_range\",\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"timeseries\",\"series\":[{\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"palette\":{\"type\":\"palette\",\"name\":\"default\"},\"metrics\":[{\"id\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"type\":\"count\"}],\"separate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\"}],\"time_field\":\"\",\"use_kibana_indexes\":true,\"interval\":\"\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"axis_scale\":\"normal\",\"show_legend\":1,\"show_grid\":1,\"tooltip_mode\":\"show_all\",\"isModelInvalid\":false,\"index_pattern_ref_name\":\"metrics_e7112256-80ef-4d79-836c-6480e0039179_0_index_pattern\"},\"uiState\":{},\"data\":{\"aggs\":[],\"searchSource\":{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}}},\"hidePanelTitles\":false,\"enhancements\":{}},\"title\":\"Kibana Index\"}]","refreshInterval":{"pause":true,"value":0},"timeFrom":"2015-09-21T10:30:00.000Z","timeRestore":true,"timeTo":"2015-09-22T12:00:00.000Z","title":"TSVB 7.13.3","version":1},"coreMigrationVersion":"7.13.3","id":"d8c09ac0-e4ca-11eb-8015-4bb2e4229ebd","migrationVersion":{"dashboard":"7.13.1"},"references":[{"id":"d0d5bf10-e3ef-11eb-a821-bb6e72afa109","name":"e7112256-80ef-4d79-836c-6480e0039179:metrics_e7112256-80ef-4d79-836c-6480e0039179_0_index_pattern","type":"index_pattern"}],"type":"dashboard","updated_at":"2021-07-23T18:45:00.781Z","version":"Wzc1NCwxXQ=="}
{"attributes":{"fieldAttrs":"{}","fields":"[]","runtimeFieldMap":"{}","timeFieldName":"@timestamp","title":"logstash*"},"coreMigrationVersion":"7.13.3","id":"d0d5bf10-e3ef-11eb-a821-bb6e72afa109","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-07-23T18:43:39.839Z","version":"WzcyMiwxXQ=="}
{"exportedCount":2,"missingRefCount":1,"missingReferences":[{"id":"d0d5bf10-e3ef-11eb-a821-bb6e72afa109","type":"index_pattern"}]}

View file

@ -0,0 +1,132 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import expect from '@kbn/expect';
import path from 'path';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['common', 'settings', 'header', 'savedObjects', 'dashboard']);
describe('Export import saved objects between versions', () => {
describe('From 7.12.1', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.savedObjects.importFile(
path.join(__dirname, 'exports', 'tsvb_dashboard_migration_test_7_12_1.ndjson')
);
});
it('should be able to import dashboard with TSVB panels from 7.12.1', async () => {
// this will catch cases where there is an error in the migrations.
await PageObjects.savedObjects.checkImportSucceeded();
await PageObjects.savedObjects.clickImportDone();
});
it('should render all panels on the dashboard', async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.loadSavedDashboard('TSVB Index Pattern Smoke Test');
// dashboard should load properly
await PageObjects.dashboard.expectOnDashboard('TSVB Index Pattern Smoke Test');
await PageObjects.dashboard.waitForRenderComplete();
// There should be 0 error embeddables on the dashboard
const errorEmbeddables = await testSubjects.findAll('embeddableStackError');
expect(errorEmbeddables.length).to.be(0);
});
it('should show the edit action for all panels', async () => {
await PageObjects.dashboard.switchToEditMode();
// All panels should be editable. This will catch cases where an error does not create an error embeddable.
const panelTitles = await PageObjects.dashboard.getPanelTitles();
for (const title of panelTitles) {
await dashboardPanelActions.expectExistsEditPanelAction(title);
}
});
it('should retain all panel drilldowns from 7.12.1', async () => {
// Both panels configured with drilldowns in 7.12.1 should still have drilldowns.
const totalPanels = await PageObjects.dashboard.getPanelCount();
let panelsWithDrilldowns = 0;
let drilldownCount = 0;
for (let panelIndex = 0; panelIndex < totalPanels; panelIndex++) {
const panelDrilldownCount = await PageObjects.dashboard.getPanelDrilldownCount(
panelIndex
);
if (panelDrilldownCount >= 1) {
panelsWithDrilldowns++;
}
drilldownCount += await PageObjects.dashboard.getPanelDrilldownCount(panelIndex);
}
expect(panelsWithDrilldowns).to.be(2);
expect(drilldownCount).to.be(3);
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
});
});
describe('from 7.13.3', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaSavedObjects();
await PageObjects.savedObjects.importFile(
path.join(__dirname, 'exports', 'tsvb_dashboard_migration_test_7_13_3.ndjson')
);
});
it('should be able to import dashboard with TSVB panels from 7.13.3', async () => {
// this will catch cases where there is an error in the migrations.
await PageObjects.savedObjects.checkImportSucceeded();
await PageObjects.savedObjects.clickImportDone();
});
it('should render all panels on the dashboard', async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.loadSavedDashboard('TSVB 7.13.3');
// dashboard should load properly
await PageObjects.dashboard.expectOnDashboard('TSVB 7.13.3');
await PageObjects.dashboard.waitForRenderComplete();
// There should be 0 error embeddables on the dashboard
const errorEmbeddables = await testSubjects.findAll('embeddableStackError');
expect(errorEmbeddables.length).to.be(0);
});
it('should show the edit action for all panels', async () => {
await PageObjects.dashboard.switchToEditMode();
// All panels should be editable. This will catch cases where an error does not create an error embeddable.
const panelTitles = await PageObjects.dashboard.getPanelTitles();
for (const title of panelTitles) {
await dashboardPanelActions.expectExistsEditPanelAction(title);
}
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
});
});
});
}