From a48300699573183bd49ac6f2977be9eb1576be89 Mon Sep 17 00:00:00 2001 From: Vitalii Dmyterko Date: Tue, 14 Jun 2022 11:27:40 +0100 Subject: [PATCH] docs && refactoring --- .buildkite/pipelines/flaky_tests/pipeline.js | 3 ++- .../cli_config_parallel.ts | 8 ++++---- x-pack/test/security_solution_cypress/runner.ts | 13 +++++++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.buildkite/pipelines/flaky_tests/pipeline.js b/.buildkite/pipelines/flaky_tests/pipeline.js index a49a22d5a1f17d..1e70a5977db103 100644 --- a/.buildkite/pipelines/flaky_tests/pipeline.js +++ b/.buildkite/pipelines/flaky_tests/pipeline.js @@ -175,7 +175,8 @@ for (const testSuite of testSuites) { concurrency_group: process.env.UUID, concurrency_method: 'eager', env: { - SKIP_TEST_CASES_SPLITTING: true, + // disable split of test cases between parallel jobs when running them in flaky test runner + DISABLE_TEST_CASES_SPLITTING: true, }, }); break; diff --git a/x-pack/test/security_solution_cypress/cli_config_parallel.ts b/x-pack/test/security_solution_cypress/cli_config_parallel.ts index 5d5920801d408a..9286819d8489cf 100644 --- a/x-pack/test/security_solution_cypress/cli_config_parallel.ts +++ b/x-pack/test/security_solution_cypress/cli_config_parallel.ts @@ -10,7 +10,7 @@ import { FtrProviderContext } from './ftr_provider_context'; import { SecuritySolutionCypressCliTestRunnerCI } from './runner'; -const SKIP_TEST_CASES_SPLITTING = process.env.SKIP_TEST_CASES_SPLITTING === 'true'; +const isChunkingDisabled = process.env.DISABLE_TEST_CASES_SPLITTING === 'true'; const cliNumber = parseInt(process.env.CLI_NUMBER ?? '1', 10); const cliCount = parseInt(process.env.CLI_COUNT ?? '1', 10); @@ -21,9 +21,9 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { ...securitySolutionCypressConfig.getAll(), testRunner: (context: FtrProviderContext) => - // if SKIP_TEST_CASES_SPLITTING is true, we will run all existing tests instead splitting them between parallel jobs - SKIP_TEST_CASES_SPLITTING - ? SecuritySolutionCypressCliTestRunnerCI(context, 1, 1) + // if isChunkingDisabled is true, we will run all existing tests instead splitting them between parallel jobs + isChunkingDisabled + ? SecuritySolutionCypressCliTestRunnerCI(context) : SecuritySolutionCypressCliTestRunnerCI(context, cliCount, cliNumber), }; } diff --git a/x-pack/test/security_solution_cypress/runner.ts b/x-pack/test/security_solution_cypress/runner.ts index 2f4f76de53ced0..241a851355bf18 100644 --- a/x-pack/test/security_solution_cypress/runner.ts +++ b/x-pack/test/security_solution_cypress/runner.ts @@ -57,10 +57,19 @@ export async function SecuritySolutionConfigurableCypressTestRunner( }); } +/** + * Takes total CI jobs number(totalCiJobs) between which tests will be split and sequential number of the job(ciJobNumber). + * This helper will split file list cypress integrations into chunks, and run integrations in chunk which match ciJobNumber + * If both totalCiJobs === 1 && ciJobNumber === 1, this function will run all existing tests, without splitting them + * @param context FtrProviderContext + * @param {number} totalCiJobs - total number of jobs between which tests will be split + * @param {number} ciJobNumber - number of job + * @returns + */ export async function SecuritySolutionCypressCliTestRunnerCI( context: FtrProviderContext, - totalCiJobs: number, - ciJobNumber: number + totalCiJobs: number = 1, + ciJobNumber: number = 1 ) { const integrations = retrieveIntegrations(totalCiJobs, ciJobNumber); return SecuritySolutionConfigurableCypressTestRunner(context, 'cypress:run:spec', {