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

[kbn-test] extract ES logs only for svl #202927

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
7 changes: 3 additions & 4 deletions packages/kbn-scout/src/servers/run_elasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { resolve } from 'path';
import type { ToolingLog } from '@kbn/tooling-log';
import { REPO_ROOT } from '@kbn/repo-info';
import type { ArtifactLicense, ServerlessProjectType } from '@kbn/es';
import { isServerlessProjectType, extractAndArchiveLogs } from '@kbn/es/src/utils';
import { createTestEsCluster, esTestConfig } from '@kbn/test';
import { isServerlessProjectType } from '@kbn/es/src/utils';
import { createTestEsCluster, esTestConfig, cleanupElasticsearch } from '@kbn/test';
import { Config } from '../config';

interface RunElasticsearchOptions {
Expand Down Expand Up @@ -82,8 +82,7 @@ export async function runElasticsearch(
config,
});
return async () => {
await node.cleanup();
await extractAndArchiveLogs({ outputFolder: logsDir, log });
await cleanupElasticsearch(node, config.serverless, logsDir, log);
};
}

Expand Down
1 change: 1 addition & 0 deletions packages/kbn-test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export {
remapPluginPaths,
getKibanaCliArg,
getKibanaCliLoggers,
cleanupElasticsearch,
} from './src/functional_tests/lib';

export { initLogsDir } from './src/functional_tests/lib';
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/src/functional_tests/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

export { runKibanaServer } from './run_kibana_server';
export { runElasticsearch } from './run_elasticsearch';
export { runElasticsearch, cleanupElasticsearch } from './run_elasticsearch';
export * from './run_ftr';
export {
parseRawFlags,
Expand Down
18 changes: 15 additions & 3 deletions packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { REPO_ROOT } from '@kbn/repo-info';
import type { ArtifactLicense, ServerlessProjectType } from '@kbn/es';
import { isServerlessProjectType, extractAndArchiveLogs } from '@kbn/es/src/utils';
import type { Config } from '../../functional_test_runner';
import { createTestEsCluster, esTestConfig } from '../../es';
import { ICluster, createTestEsCluster, esTestConfig } from '../../es';

interface RunElasticsearchOptions {
log: ToolingLog;
Expand Down Expand Up @@ -77,6 +77,19 @@ function getEsConfig({
};
}

export async function cleanupElasticsearch(
node: ICluster,
isServerless: boolean,
logsDir: string | undefined,
log: ToolingLog
): Promise<void> {
await node.cleanup();

if (isServerless) {
await extractAndArchiveLogs({ outputFolder: logsDir, log });
}
}

export async function runElasticsearch(
options: RunElasticsearchOptions
): Promise<() => Promise<void>> {
Expand All @@ -91,8 +104,7 @@ export async function runElasticsearch(
config,
});
return async () => {
await node.cleanup();
await extractAndArchiveLogs({ outputFolder: logsDir, log });
await cleanupElasticsearch(node, config.serverless, logsDir, log);
};
}

Expand Down
Loading