mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Migrations] Upgrade integration tests - follow up work (#194151)
## Summary * Fix issue with `docVersion` on link (prevent future failure) * Add a package to `actions.test.ts` (some of the actions targeted a pre-existing index). * Addresses https://github.com/elastic/kibana/issues/166190 * Addresses https://github.com/elastic/kibana/issues/166199 * Fix flakiness in `fail_on_rollback.test.ts` * Addresses https://github.com/elastic/kibana/issues/193756
This commit is contained in:
parent
a80335e378
commit
c70757ce86
3 changed files with 18 additions and 33 deletions
|
@ -34,10 +34,11 @@ import {
|
|||
getReindexingMigratorTestKit,
|
||||
getUpToDateMigratorTestKit,
|
||||
} from '../kibana_migrator_test_kit.fixtures';
|
||||
import { delay } from '../test_utils';
|
||||
import { delay, getDocVersion } from '../test_utils';
|
||||
import { expectDocumentsMigratedToHighestVersion } from '../kibana_migrator_test_kit.expect';
|
||||
|
||||
const logFilePath = join(__dirname, 'v2_migration.log');
|
||||
const docVersion = getDocVersion();
|
||||
|
||||
describe('v2 migration', () => {
|
||||
let esServer: TestElasticsearchUtils;
|
||||
|
@ -127,7 +128,7 @@ describe('v2 migration', () => {
|
|||
await expect(unknownTypesKit.runMigrations()).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Unable to complete saved object migrations for the [.kibana_migrator] index: Migration failed because some documents were found which use unknown saved object types: deprecated
|
||||
To proceed with the migration you can configure Kibana to discard unknown saved objects for this migration.
|
||||
Please refer to https://www.elastic.co/guide/en/kibana/master/resolve-migrations-failures.html for more information."
|
||||
Please refer to https://www.elastic.co/guide/en/kibana/${docVersion}/resolve-migrations-failures.html for more information."
|
||||
`);
|
||||
logs = await readLog(logFilePath);
|
||||
expect(logs).toMatch(
|
||||
|
|
|
@ -46,11 +46,14 @@ import {
|
|||
createBulkIndexOperationTuple,
|
||||
checkClusterRoutingAllocationEnabled,
|
||||
} from '@kbn/core-saved-objects-migration-server-internal';
|
||||
import { BASELINE_TEST_ARCHIVE_1K } from '../../kibana_migrator_archive_utils';
|
||||
import { defaultKibanaIndex } from '../../kibana_migrator_test_kit';
|
||||
|
||||
const { startES } = createTestServers({
|
||||
adjustTimeout: (t: number) => jest.setTimeout(t),
|
||||
settings: {
|
||||
es: {
|
||||
dataArchive: BASELINE_TEST_ARCHIVE_1K,
|
||||
license: 'basic',
|
||||
esArgs: ['http.max_content_length=10Kb'],
|
||||
},
|
||||
|
@ -1090,13 +1093,13 @@ describe.skip('migration actions', () => {
|
|||
it('resolves left wait_for_task_completion_timeout when the task does not finish within the timeout', async () => {
|
||||
await waitForIndexStatus({
|
||||
client,
|
||||
index: '.kibana_1',
|
||||
index: defaultKibanaIndex,
|
||||
status: 'yellow',
|
||||
})();
|
||||
|
||||
const res = (await reindex({
|
||||
client,
|
||||
sourceIndex: '.kibana_1',
|
||||
sourceIndex: defaultKibanaIndex,
|
||||
targetIndex: 'reindex_target',
|
||||
reindexScript: Option.none,
|
||||
requireAlias: false,
|
||||
|
@ -1433,7 +1436,7 @@ describe.skip('migration actions', () => {
|
|||
it('resolves left wait_for_task_completion_timeout when the task does not complete within the timeout', async () => {
|
||||
const res = (await pickupUpdatedMappings(
|
||||
client,
|
||||
'.kibana_1',
|
||||
defaultKibanaIndex,
|
||||
1000
|
||||
)()) as Either.Right<UpdateByQueryResponse>;
|
||||
|
||||
|
|
|
@ -7,52 +7,36 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import Path from 'path';
|
||||
import type { TestElasticsearchUtils } from '@kbn/core-test-helpers-kbn-server';
|
||||
import {
|
||||
clearLog,
|
||||
startElasticsearch,
|
||||
getKibanaMigratorTestKit,
|
||||
nextMinor,
|
||||
defaultKibanaIndex,
|
||||
defaultKibanaTaskIndex,
|
||||
currentVersion,
|
||||
} from '../kibana_migrator_test_kit';
|
||||
import '../jest_matchers';
|
||||
import { delay, parseLogFile } from '../test_utils';
|
||||
import { baselineTypes as types } from '../kibana_migrator_test_kit.fixtures';
|
||||
|
||||
export const logFilePath = Path.join(__dirname, 'fail_on_rollback.test.log');
|
||||
import { delay } from '../test_utils';
|
||||
import { getUpToDateMigratorTestKit } from '../kibana_migrator_test_kit.fixtures';
|
||||
import { BASELINE_TEST_ARCHIVE_1K } from '../kibana_migrator_archive_utils';
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/193756
|
||||
describe.skip('when rolling back to an older version', () => {
|
||||
let esServer: TestElasticsearchUtils['es'];
|
||||
|
||||
beforeAll(async () => {
|
||||
esServer = await startElasticsearch();
|
||||
esServer = await startElasticsearch({ dataArchive: BASELINE_TEST_ARCHIVE_1K });
|
||||
});
|
||||
|
||||
beforeEach(async () => {});
|
||||
|
||||
it('kibana should detect that a later version alias exists, and abort', async () => {
|
||||
// create a current version baseline
|
||||
const { runMigrations: createBaseline } = await getKibanaMigratorTestKit({
|
||||
types,
|
||||
logFilePath,
|
||||
});
|
||||
await createBaseline();
|
||||
|
||||
// migrate to next minor
|
||||
const { runMigrations: upgrade } = await getKibanaMigratorTestKit({
|
||||
kibanaVersion: nextMinor,
|
||||
types,
|
||||
logFilePath,
|
||||
});
|
||||
const { runMigrations: upgrade } = await getUpToDateMigratorTestKit();
|
||||
await upgrade();
|
||||
|
||||
// run migrations for the current version again (simulate rollback)
|
||||
const { runMigrations: rollback } = await getKibanaMigratorTestKit({ types, logFilePath });
|
||||
|
||||
await clearLog(logFilePath);
|
||||
const { runMigrations: rollback } = await getUpToDateMigratorTestKit({
|
||||
kibanaVersion: currentVersion,
|
||||
});
|
||||
|
||||
try {
|
||||
await rollback();
|
||||
|
@ -63,9 +47,6 @@ describe.skip('when rolling back to an older version', () => {
|
|||
`Unable to complete saved object migrations for the [${defaultKibanaTaskIndex}] index: The ${defaultKibanaTaskIndex}_${nextMinor} alias refers to a newer version of Kibana: v${nextMinor}`,
|
||||
]).toContain(error.message);
|
||||
}
|
||||
|
||||
const logs = await parseLogFile(logFilePath);
|
||||
expect(logs).toContainLogEntry(`[${defaultKibanaIndex}] INIT -> FATAL.`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue