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

[Security Solution] fixes flaky-test-runner Cypress Security Solution tests #134205

Merged
Merged
4 changes: 4 additions & 0 deletions .buildkite/pipelines/flaky_tests/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ for (const testSuite of testSuites) {
concurrency: concurrency,
concurrency_group: process.env.UUID,
concurrency_method: 'eager',
env: {
// disable split of test cases between parallel jobs when running them in flaky test runner
DISABLE_TEST_CASES_SPLITTING: true,
vitaliidm marked this conversation as resolved.
Show resolved Hide resolved
},
});
break;
default:
Expand Down
6 changes: 5 additions & 1 deletion x-pack/test/security_solution_cypress/cli_config_parallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FtrProviderContext } from './ftr_provider_context';

import { SecuritySolutionCypressCliTestRunnerCI } from './runner';

const isChunkingDisabled = process.env.DISABLE_TEST_CASES_SPLITTING === 'true';
cavokz marked this conversation as resolved.
Show resolved Hide resolved
const cliNumber = parseInt(process.env.CLI_NUMBER ?? '1', 10);
const cliCount = parseInt(process.env.CLI_COUNT ?? '1', 10);

Expand All @@ -20,6 +21,9 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
...securitySolutionCypressConfig.getAll(),

testRunner: (context: FtrProviderContext) =>
SecuritySolutionCypressCliTestRunnerCI(context, cliCount, cliNumber),
// if isChunkingDisabled is true, we will run all existing tests instead splitting them between parallel jobs
isChunkingDisabled
? SecuritySolutionCypressCliTestRunnerCI(context)
: SecuritySolutionCypressCliTestRunnerCI(context, cliCount, cliNumber),
cavokz marked this conversation as resolved.
Show resolved Hide resolved
};
}
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
vitaliidm marked this conversation as resolved.
Show resolved Hide resolved
) {
const integrations = retrieveIntegrations(totalCiJobs, ciJobNumber);
return SecuritySolutionConfigurableCypressTestRunner(context, 'cypress:run:spec', {
Expand Down