Skip to content

Commit a45a280

Browse files
committed
Add Upgrade Assistant API integration test to ensure the reindex operation saved object can handle immense error messages (#72347)
1 parent b3635f7 commit a45a280

4 files changed

Lines changed: 69 additions & 0 deletions

File tree

x-pack/test/api_integration/apis/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ export default function ({ loadTestFile }) {
3232
loadTestFile(require.resolve('./endpoint'));
3333
loadTestFile(require.resolve('./ingest_manager'));
3434
loadTestFile(require.resolve('./lists'));
35+
loadTestFile(require.resolve('./upgrade_assistant'));
3536
});
3637
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { FtrProviderContext } from '../../ftr_provider_context';
8+
9+
export default function ({ loadTestFile }: FtrProviderContext) {
10+
describe('Upgrade Assistant', () => {
11+
loadTestFile(require.resolve('./upgrade_assistant'));
12+
});
13+
}

x-pack/test/api_integration/apis/upgrade_assistant/reindex_operation_with_large_error_message.ts

Lines changed: 21 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import expect from '@kbn/expect';
8+
9+
import { FtrProviderContext } from '../../ftr_provider_context';
10+
import { reindexOperationWithLargeErrorMessage } from './reindex_operation_with_large_error_message';
11+
12+
export default function ({ getService }: FtrProviderContext) {
13+
const es = getService('legacyEs');
14+
15+
describe('Reindex operation saved object', function () {
16+
const dotKibanaIndex = '.kibana';
17+
const fakeSavedObjectId = 'fakeSavedObjectId';
18+
19+
after(async () => {
20+
// Clean up the fake saved object we created. This will error if the test failed.
21+
return await es.delete({ index: dotKibanaIndex, id: fakeSavedObjectId });
22+
});
23+
24+
it('is indexed successfully with immense error message', async () => {
25+
// Guards against regression of https://github.com/elastic/kibana/pull/71710.
26+
const result = await es.create({
27+
index: dotKibanaIndex, // In normal operation this would be the .kibana-n index.
28+
id: fakeSavedObjectId,
29+
body: reindexOperationWithLargeErrorMessage,
30+
});
31+
expect(result).to.be.ok();
32+
});
33+
});
34+
}

0 commit comments

Comments
 (0)