Skip to content

Commit

Permalink
[QA] Switch tests to use importExport - discover (#94006) (#97886)
Browse files Browse the repository at this point in the history
Switch es archiver for kbn archiver everywhere possible

Partially closes #93797

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
wayneseymour and kibanamachine authored Apr 22, 2021
1 parent 7bcc18f commit d5c8bd3
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 365 deletions.
9 changes: 8 additions & 1 deletion packages/kbn-test/src/kbn_client/kbn_client_import_export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ export class KbnClientImportExport {
if (resp.data.success) {
this.log.success('import success');
} else {
throw createFailError(`failed to import all saved objects: ${inspect(resp.data)}`);
throw createFailError(
`failed to import all saved objects: ${inspect(resp.data, {
compact: false,
depth: 99,
breakLength: 80,
sorted: true,
})}`
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default function ({
const testSubjects = getService('testSubjects');

before(async function () {
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.common.navigateToApp('discover');
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_data_grid_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('discover data grid context tests', () => {
before(async () => {
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update(defaultSettings);
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_data_grid_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover data grid doc table', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_data_grid_field_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover data grid field data tests', function describeIndexTests() {
this.tags('includeFirefox');
before(async function () {
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update(defaultSettings);
Expand Down
1 change: 0 additions & 1 deletion test/functional/apps/discover/_discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before(async function () {
log.debug('load kibana index with default index pattern');

await kibanaServer.savedObjects.clean({ types: ['search'] });
await kibanaServer.importExport.load('discover');

// and load a set of makelogs data
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_discover_fields_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover uses fields API test', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
log.debug('discover');
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

before(async function () {
log.debug('load kibana index with default index pattern');
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');

// and load a set of makelogs data
await esArchiver.loadIfNeeded('logstash_functional');
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

after(async function () {
await esArchiver.unload('invalid_scripted_field');
await esArchiver.load('empty_kibana');
});

describe('invalid scripted field error', () => {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_field_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover tab', function describeIndexTests() {
this.tags('includeFirefox');
before(async function () {
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('discover');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
'discover:searchFieldsFromSource': true,
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_field_data_with_fields_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover tab with new fields API', function describeIndexTests() {
this.tags('includeFirefox');
before(async function () {
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('discover');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
'discover:searchFieldsFromSource': false,
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_filter_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('discover filter editor', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await esArchiver.loadIfNeeded('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');

// and load a set of makelogs data
await esArchiver.loadIfNeeded('logstash_functional');
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/discover/_inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('inspect', () => {
before(async () => {
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });

await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('discover');
// delete .kibana index and update configDoc
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/discover/_large_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('test large strings', function () {
before(async function () {
await security.testUser.setRoles(['kibana_admin', 'kibana_large_strings']);
await esArchiver.load('empty_kibana');

await kibanaServer.importExport.load('testlargestring');
await esArchiver.loadIfNeeded('hamlet');
await kibanaServer.uiSettings.replace({
defaultIndex: 'testlargestring',
Expand Down Expand Up @@ -76,6 +77,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => {
await security.testUser.restoreDefaults();
await esArchiver.unload('hamlet');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
});
});
}
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_saved_queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('saved queries saved objects', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');

// and load a set of makelogs data
await esArchiver.loadIfNeeded('logstash_functional');
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_shared_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

log.debug('load kibana index with default index pattern');
await esArchiver.load('discover');
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
await kibanaServer.importExport.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');

await kibanaServer.uiSettings.replace({
Expand Down
Binary file modified test/functional/fixtures/es_archiver/hamlet/data.json.gz
Binary file not shown.
Loading

0 comments on commit d5c8bd3

Please sign in to comment.