Skip to content

Commit

Permalink
[Archive migration] 'x-pack/test/functional/es_archives/visualize/def…
Browse files Browse the repository at this point in the history
…ault' (#128829)

* Enterprise Search causes local failure

* convert the rest of the tests using the es_archive

* add another kbn_archive for custom space saved objects

* This test needed a doc from the es_archive

(cherry picked from commit c5e2e5e)
  • Loading branch information
Lee Drengenberg committed Apr 1, 2022
1 parent f76a91a commit 26f6095
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 240 deletions.
8 changes: 6 additions & 2 deletions x-pack/test/api_integration/apis/lens/field_stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const COMMON_HEADERS = {

export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const supertest = getService('supertest');

describe('index stats apis', () => {
Expand All @@ -29,10 +30,13 @@ export default ({ getService }: FtrProviderContext) => {

describe('field distribution', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/visualize/default'
);
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
});

it('should return a 404 for missing index patterns', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,18 @@ export default ({ getService }: FtrProviderContext) => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/visualize/default'
);
await kibanaServer.uiSettings.update({
'lens:useFieldExistenceSampling': true,
});
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
await esArchiver.unload('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.uiSettings.update({
'lens:useFieldExistenceSampling': false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const security = getService('security');
const config = getService('config');
const PageObjects = getPageObjects([
Expand All @@ -30,7 +31,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

describe('visualize feature controls security', () => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/visualize/default'
);
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
// ensure we're logged out so we can login as the appropriate users
await PageObjects.security.forceLogout();
Expand All @@ -40,8 +44,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
// logout, so the other tests don't accidentally run as the custom users we're testing below
// NOTE: Logout needs to happen before anything else to avoid flaky behavior
await PageObjects.security.forceLogout();

await esArchiver.unload('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
});

describe('global visualize all privileges', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,41 @@ import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const config = getService('config');
const spacesService = getService('spaces');
const PageObjects = getPageObjects(['common', 'visualize', 'security', 'spaceSelector', 'error']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');

describe('visualize', () => {
describe('visualize spaces', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/visualize/default');
});

describe('space with no features disabled', () => {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await esArchiver.load('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/visualize/default'
);
await spacesService.create({
id: 'custom_space',
name: 'custom_space',
disabledFeatures: [],
});
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/visualize/custom_space',
{ space: 'custom_space' }
);
});

after(async () => {
await spacesService.delete('custom_space');
await esArchiver.unload('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
});

it('shows visualize navlink', async () => {
Expand All @@ -50,7 +59,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
it(`can view existing Visualization`, async () => {
await PageObjects.common.navigateToActualUrl(
'visualize',
`${VisualizeConstants.EDIT_PATH}/i-exist`,
`${VisualizeConstants.EDIT_PATH}/custom_i-exist`,
{
basePath: '/s/custom_space',
ensureCurrentUrl: false,
Expand All @@ -67,7 +76,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await esArchiver.load('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/visualize/default'
);
await spacesService.create({
id: 'custom_space',
name: 'custom_space',
Expand All @@ -77,7 +89,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

after(async () => {
await spacesService.delete('custom_space');
await esArchiver.unload('x-pack/test/functional/es_archives/visualize/default');
await kibanaServer.savedObjects.cleanStandardList();
});

it(`doesn't show visualize navlink`, async () => {
Expand Down
229 changes: 0 additions & 229 deletions x-pack/test/functional/es_archives/visualize/default/data.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"attributes": {
"timeFieldName": "@timestamp",
"title": "logstash-*"
},
"coreMigrationVersion": "7.17.2",
"id": "custom_logstash-*",
"migrationVersion": {
"index-pattern": "7.11.0"
},
"references": [],
"type": "index-pattern",
"updated_at": "2018-12-21T00:43:07.096Z",
"version": "WzEyLDJd"
}

{
"attributes": {
"description": "",
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"
},
"title": "A Pie",
"uiStateJSON": "{}",
"version": 1,
"visState": "{\"title\":\"A Pie\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100},\"dimensions\":{\"metric\":{\"accessor\":0,\"format\":{\"id\":\"number\"},\"params\":{},\"aggType\":\"count\"}},\"palette\":{\"type\":\"palette\",\"name\":\"kibana_palette\"},\"distinctColors\":true},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"geo.src\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}"
},
"coreMigrationVersion": "7.17.2",
"id": "custom_i-exist",
"migrationVersion": {
"visualization": "7.17.0"
},
"references": [
{
"id": "custom_logstash-*",
"name": "kibanaSavedObjectMeta.searchSourceJSON.index",
"type": "index-pattern"
}
],
"type": "visualization",
"updated_at": "2019-01-22T19:32:31.206Z",
"version": "WzE0LDJd"
}
147 changes: 147 additions & 0 deletions x-pack/test/functional/fixtures/kbn_archiver/visualize/default.json

Large diffs are not rendered by default.

0 comments on commit 26f6095

Please sign in to comment.