Skip to content

Commit

Permalink
docs && refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliidm committed Jun 14, 2022
1 parent 78ff4f1 commit a483006
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .buildkite/pipelines/flaky_tests/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions x-pack/test/security_solution_cypress/cli_config_parallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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),
};
}
13 changes: 11 additions & 2 deletions x-pack/test/security_solution_cypress/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down

0 comments on commit a483006

Please sign in to comment.