mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Fix hardcoded doclinks in SO migration integ tests (#137414)
* fix hardcoded doc links in SO migration IT * unskip tests * fix link value
This commit is contained in:
parent
371f091a14
commit
a8e5bf4c9f
5 changed files with 37 additions and 15 deletions
|
@ -16,7 +16,9 @@ import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
|
|||
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
|
||||
import { Root } from '../../../root';
|
||||
import { SearchTotalHits } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { getMigrationDocLink } from './test_utils';
|
||||
|
||||
const migrationDocLink = getMigrationDocLink().resolveMigrationFailures;
|
||||
const logFilePath = Path.join(__dirname, '7_13_corrupt_transform_failures.log');
|
||||
|
||||
const asyncUnlink = Util.promisify(Fs.unlink);
|
||||
|
@ -26,8 +28,7 @@ async function removeLogFile() {
|
|||
await asyncUnlink(logFilePath).catch(() => void 0);
|
||||
}
|
||||
|
||||
// FAILING ON 8.4: https://github.com/elastic/kibana/issues/137329
|
||||
describe.skip('migration v2', () => {
|
||||
describe('migration v2', () => {
|
||||
let esServer: kbnTestServer.TestElasticsearchUtils;
|
||||
let root: Root;
|
||||
|
||||
|
@ -87,7 +88,7 @@ describe.skip('migration v2', () => {
|
|||
|
||||
To allow migrations to proceed, please delete or fix these documents.
|
||||
Note that you can configure Kibana to automatically discard corrupt documents and transform errors for this migration.
|
||||
Please refer to https://www.elastic.co/guide/en/kibana/master/resolve-migrations-failures.html for more information."
|
||||
Please refer to ${migrationDocLink} for more information."
|
||||
`);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@ import Util from 'util';
|
|||
import JSON5 from 'json5';
|
||||
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
|
||||
import type { Root } from '../../../root';
|
||||
import { getMigrationDocLink } from './test_utils';
|
||||
|
||||
const migrationDocLink = getMigrationDocLink().resolveMigrationFailures;
|
||||
const logFilePath = Path.join(__dirname, 'cleanup.log');
|
||||
|
||||
const asyncUnlink = Util.promisify(Fs.unlink);
|
||||
|
@ -54,8 +56,7 @@ function createRoot() {
|
|||
);
|
||||
}
|
||||
|
||||
// FAILING ON 8.4: https://github.com/elastic/kibana/issues/137331
|
||||
describe.skip('migration v2', () => {
|
||||
describe('migration v2', () => {
|
||||
let esServer: kbnTestServer.TestElasticsearchUtils;
|
||||
let root: Root;
|
||||
|
||||
|
@ -119,7 +120,7 @@ describe.skip('migration v2', () => {
|
|||
|
||||
To allow migrations to proceed, please delete or fix these documents.
|
||||
Note that you can configure Kibana to automatically discard corrupt documents and transform errors for this migration.
|
||||
Please refer to https://www.elastic.co/guide/en/kibana/master/resolve-migrations-failures.html for more information."
|
||||
Please refer to ${migrationDocLink} for more information."
|
||||
`);
|
||||
|
||||
const logFileContent = await asyncReadFile(logFilePath, 'utf-8');
|
||||
|
|
|
@ -11,7 +11,9 @@ import Fs from 'fs';
|
|||
import Util from 'util';
|
||||
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
|
||||
import { Root } from '../../../root';
|
||||
import { getMigrationDocLink } from './test_utils';
|
||||
|
||||
const migrationDocLink = getMigrationDocLink().resolveMigrationFailures;
|
||||
const logFilePath = Path.join(__dirname, 'collects_corrupt_docs.log');
|
||||
|
||||
const asyncUnlink = Util.promisify(Fs.unlink);
|
||||
|
@ -21,8 +23,7 @@ async function removeLogFile() {
|
|||
await asyncUnlink(logFilePath).catch(() => void 0);
|
||||
}
|
||||
|
||||
// FAILING ON 8.4: https://github.com/elastic/kibana/issues/137330
|
||||
describe.skip('migration v2 with corrupt saved object documents', () => {
|
||||
describe('migration v2 with corrupt saved object documents', () => {
|
||||
let esServer: kbnTestServer.TestElasticsearchUtils;
|
||||
let root: Root;
|
||||
|
||||
|
@ -106,7 +107,7 @@ describe.skip('migration v2 with corrupt saved object documents', () => {
|
|||
|
||||
To allow migrations to proceed, please delete or fix these documents.
|
||||
Note that you can configure Kibana to automatically discard corrupt documents and transform errors for this migration.
|
||||
Please refer to https://www.elastic.co/guide/en/kibana/master/resolve-migrations-failures.html for more information."
|
||||
Please refer to ${migrationDocLink} for more information."
|
||||
`);
|
||||
|
||||
expectMatchOrder(errorLines, [
|
||||
|
|
|
@ -9,19 +9,15 @@
|
|||
import Path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
import JSON5 from 'json5';
|
||||
import { REPO_ROOT } from '@kbn/utils';
|
||||
import { Env } from '@kbn/config';
|
||||
import { getDocLinksMeta } from '@kbn/doc-links';
|
||||
import { getEnvOptions } from '@kbn/config-mocks';
|
||||
import * as kbnTestServer from '../../../../test_helpers/kbn_server';
|
||||
import { Root } from '../../../root';
|
||||
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
|
||||
import { LogRecord } from '@kbn/logging';
|
||||
import { getDocVersion } from './test_utils';
|
||||
import { retryAsync } from '../../../saved_objects/migrations/test_helpers/retry_async';
|
||||
|
||||
const logFilePath = Path.join(__dirname, 'incompatible_cluster_routing_allocation.log');
|
||||
const env = Env.createDefault(REPO_ROOT, getEnvOptions());
|
||||
const docVersion = getDocLinksMeta({ kibanaBranch: env.packageInfo.branch }).version;
|
||||
const docVersion = getDocVersion();
|
||||
|
||||
async function removeLogFile() {
|
||||
// ignore errors if it doesn't exist
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { Env } from '@kbn/config';
|
||||
import { getDocLinksMeta, getDocLinks } from '@kbn/doc-links';
|
||||
import { REPO_ROOT } from '@kbn/utils';
|
||||
import { getEnvOptions } from '@kbn/config-mocks';
|
||||
|
||||
export const getDocVersion = () => {
|
||||
const env = Env.createDefault(REPO_ROOT, getEnvOptions());
|
||||
return getDocLinksMeta({ kibanaBranch: env.packageInfo.branch }).version;
|
||||
};
|
||||
|
||||
export const getMigrationDocLink = () => {
|
||||
const env = Env.createDefault(REPO_ROOT, getEnvOptions());
|
||||
const docLinks = getDocLinks({ kibanaBranch: env.packageInfo.branch });
|
||||
return docLinks.kibanaUpgradeSavedObjects;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue