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

Fix 8.x 9 forward compat tests #206624

Merged
merged 6 commits into from
Jan 15, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
import semver from 'semver';
import { kibanaPackageJson } from '@kbn/repo-info';

interface GetDefaultArgs {
integrationTest: boolean;
}

export class EsVersion {
static getDefault() {
if (typeof jest === 'object' && jest) {
static getDefault(args?: GetDefaultArgs) {
if (!args?.integrationTest && typeof jest === 'object' && jest) {
return new EsVersion('9.9.9');
}

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { getEnvOptions } from '@kbn/config-mocks';
import { LogRecord } from '@kbn/logging';
import { retryAsync } from '@kbn/core-saved-objects-migration-server-mocks';
import { delay } from '../test_utils';
import { EsVersion } from '@kbn/test';

const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;
const targetIndex = `.kibana_${kibanaVersion}_001`;
Expand Down Expand Up @@ -61,8 +62,18 @@ describe('migration v2', () => {
let esServer: TestElasticsearchUtils;
let root: Root;
let startES: () => Promise<TestElasticsearchUtils>;
let dataArchive: string;

beforeAll(async () => {
const willRunESv9 = EsVersion.getDefault({ integrationTest: true }).matchRange('9');
dataArchive = Path.join(
__dirname,
'..',
'archives',
willRunESv9
? '8.18.0_xpack_sample_saved_objects.zip'
: '7.14.0_xpack_sample_saved_objects.zip'
Comment on lines +73 to +75
Copy link
Member

Choose a reason for hiding this comment

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

🧡

);
await removeLogFile();
});

Expand All @@ -72,12 +83,7 @@ describe('migration v2', () => {
settings: {
es: {
license: 'basic',
dataArchive: Path.join(
__dirname,
'..',
'archives',
'7.14.0_xpack_sample_saved_objects.zip'
),
dataArchive,
esArgs: ['http.max_content_length=1715329b'],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '@kbn/core-test-helpers-kbn-server';
import { InternalCoreStart } from '@kbn/core-lifecycle-server-internal';
import { Root } from '@kbn/core-root-server-internal';
import { EsVersion } from '@kbn/test';

const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;

Expand Down Expand Up @@ -59,7 +60,11 @@ async function fetchDocuments(esClient: ElasticsearchClient, index: string) {
.sort(sortByTypeAndId);
}

describe('migrating from 7.3.0-xpack which used v1 migrations', () => {
const willRunESv8 = EsVersion.getDefault({ integrationTest: true }).matchRange('8');

const describeIf = willRunESv8 ? describe : describe.skip;

describeIf('migrating from 7.3.0-xpack which used v1 migrations', () => {
const migratedIndex = `.kibana_${kibanaVersion}_001`;
const originalIndex = `.kibana_1`; // v1 migrations index

Expand Down
Loading