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

[QA] Switch discover tests to use kbnarchiver 2ND DRAFT #95667

Closed
wants to merge 13 commits into from
Closed
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
7 changes: 6 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 @@ -18,12 +18,14 @@ import { KbnClientSavedObjects } from './kbn_client_saved_objects';

interface ImportApiResponse {
success: boolean;

[key: string]: unknown;
}

interface SavedObject {
id: string;
type: string;

[key: string]: unknown;
}

Expand Down Expand Up @@ -80,7 +82,10 @@ 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)}`);
throw createFailError(
`failed to import all saved objects: ${inspect(resp.data, { depth: 100 })}`
);
}
}

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');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a new discover.ndjson file in this PR that gets loaded?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @@ -37,7 +37,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// FLAKY: https://github.com/elastic/kibana/issues/94545
describe.skip('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 @@ -26,7 +26,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 @@ -22,7 +22,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
2 changes: 1 addition & 1 deletion test/functional/apps/discover/_discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ 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.savedObjects.clean({ types: ['search', 'index-pattern'] });
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 @@ -27,7 +27,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
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

after(async function () {
await esArchiver.unload('invalid_scripted_field');
// ensure .kibana index exists for next suite
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 @@ -22,8 +22,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 @@ -22,8 +22,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
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ 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
2 changes: 2 additions & 0 deletions test/functional/apps/discover/_large_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => {
await security.testUser.restoreDefaults();
await esArchiver.unload('hamlet');
// ensure .kibana index exists for next suite
await esArchiver.load('empty_kibana');
});
});
}
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 @@ -37,7 +37,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
3 changes: 2 additions & 1 deletion x-pack/test/functional/apps/discover/error_handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

after(async function () {
await esArchiver.unload('invalid_scripted_field');
// ensure .kibana index exists for next suite
await esArchiver.load('empty_kibana');
});

// this is the same test as in OSS but it catches different error message issue in different licences
Expand Down