Skip to content

Commit

Permalink
Add Upgrade Assistant API integration test to ensure the reindex oper…
Browse files Browse the repository at this point in the history
…ation saved object can handle immense error messages (elastic#72347)
  • Loading branch information
cjcenizal committed Jul 21, 2020
1 parent b3635f7 commit a45a280
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/test/api_integration/apis/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ export default function ({ loadTestFile }) {
loadTestFile(require.resolve('./endpoint'));
loadTestFile(require.resolve('./ingest_manager'));
loadTestFile(require.resolve('./lists'));
loadTestFile(require.resolve('./upgrade_assistant'));
});
}
13 changes: 13 additions & 0 deletions x-pack/test/api_integration/apis/upgrade_assistant/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('Upgrade Assistant', () => {
loadTestFile(require.resolve('./upgrade_assistant'));
});
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { reindexOperationWithLargeErrorMessage } from './reindex_operation_with_large_error_message';

export default function ({ getService }: FtrProviderContext) {
const es = getService('legacyEs');

describe('Reindex operation saved object', function () {
const dotKibanaIndex = '.kibana';
const fakeSavedObjectId = 'fakeSavedObjectId';

after(async () => {
// Clean up the fake saved object we created. This will error if the test failed.
return await es.delete({ index: dotKibanaIndex, id: fakeSavedObjectId });
});

it('is indexed successfully with immense error message', async () => {
// Guards against regression of https://github.com/elastic/kibana/pull/71710.
const result = await es.create({
index: dotKibanaIndex, // In normal operation this would be the .kibana-n index.
id: fakeSavedObjectId,
body: reindexOperationWithLargeErrorMessage,
});
expect(result).to.be.ok();
});
});
}

0 comments on commit a45a280

Please sign in to comment.