Skip to content

Commit

Permalink
[Migrations] Provide testing archives + tooling for migrations integr…
Browse files Browse the repository at this point in the history
…ation tests (#193328)

## Summary

Part of elastic/kibana-team#1113

* Creates zip packages that can be used by multiple tests.
* Provides tooling to easily create new packages with any desired data
and ES version.
* Fixes some of the failing tests with the newly created archives.
  • Loading branch information
gsoldevila authored Sep 23, 2024
1 parent d56a1bb commit 773e747
Show file tree
Hide file tree
Showing 22 changed files with 695 additions and 1,059 deletions.
4 changes: 3 additions & 1 deletion packages/kbn-test/src/es/test_es_cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface CreateTestEsClusterOptions {
* `['key.1=val1', 'key.2=val2']`
*/
esArgs?: string[];
esVersion?: string;
esFrom?: string;
esServerlessOptions?: Pick<
ServerlessOptions,
Expand Down Expand Up @@ -169,6 +170,7 @@ export function createTestEsCluster<
log,
writeLogsToPath,
basePath = Path.resolve(REPO_ROOT, '.es'),
esVersion = esTestConfig.getVersion(),
esFrom = esTestConfig.getBuildFrom(),
esServerlessOptions,
dataArchive,
Expand Down Expand Up @@ -196,7 +198,7 @@ export function createTestEsCluster<
const esArgs = assignArgs(defaultEsArgs, customEsArgs);

const config = {
version: esTestConfig.getVersion(),
version: esVersion,
installPath: Path.resolve(basePath, clusterName),
sourcePath: Path.resolve(REPO_ROOT, '../elasticsearch'),
password,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { getBaselineDocuments } from '../kibana_migrator_test_kit.fixtures';
import {
BASELINE_DOCUMENTS_PER_TYPE_1K,
BASELINE_DOCUMENTS_PER_TYPE_500K,
BASELINE_ELASTICSEARCH_VERSION,
BASELINE_TEST_ARCHIVE_1K,
BASELINE_TEST_ARCHIVE_500K,
createBaselineArchive,
} from '../kibana_migrator_archive_utils';

/**
* Enable and execute this test ONLY IN YOUR DEV MACHINE, in order to build new test packages
*/
describe.skip('migration tests toolkit', () => {
it('can create a 1k documents ZIP archive', async () => {
await createBaselineArchive({
esVersion: BASELINE_ELASTICSEARCH_VERSION,
documents: getBaselineDocuments({ documentsPerType: BASELINE_DOCUMENTS_PER_TYPE_1K }),
dataArchive: BASELINE_TEST_ARCHIVE_1K,
});
});

it('can create a 400k documents ZIP archive', async () => {
await createBaselineArchive({
esVersion: BASELINE_ELASTICSEARCH_VERSION,
documents: getBaselineDocuments({ documentsPerType: BASELINE_DOCUMENTS_PER_TYPE_500K }),
dataArchive: BASELINE_TEST_ARCHIVE_500K,
});
});
});
Loading

0 comments on commit 773e747

Please sign in to comment.