kibana/x-pack/test/security_solution_api_integration/scripts/index.js
Gloria Hornero c351e14e83
[Security Solution] Adds serverlessQA tag to the API tests (#180773)
Continues https://github.com/elastic/kibana/pull/179737 effort we are
aligning the tags on Cypress and API to have a unified experience.

## Summary

We want to start integrating our Cypress tests with the serverless
Kibana quality gate. However, not all the teams feel comfortable
enabling all the tests, to facilitate the effort of enabling tests in
the quality gate we are adding the `@serverlessQA` tag, now on API tests
as well.

We use tags to select which tests we want to execute on each environment
and pipeline.

`ess` - runs in ESS env
`serverless` - runs in serverless env and periodic pipeline (failures
don't block release)
`serverlessQA` - runs in kibana release process (failures block release)
`skipInEss` - skipped for ESS env
`skipInServerless` - skipped for all serverless related environments
`skipInServerlessMKI` - skipped for MKI environments

### Description

**Tests tagged as `@serverless`**

All the tests tagged as `@serverless` will be executed as part of the PR
validation process using the serverless FTR environment (not a real
one). That tests will be executed as well as part of the periodic
pipeline using a real serverless project. QA environment is used to do
so using the latest available commit in main at the time of the
execution.

**Tests tagged as `@serverlessQA`**

All the tests tagged as `@serverlessQA` will be executed as part of the
kibana release process using a real serverless project with the latest
image available in the QA environment

**Tests tagged as `@ess`**

All the tests tagged as `@ess` will be executed as part of the PR
validation process using an on-prem ESS environment.

**Tests tagged as `@skipInServerless`**

All the tests tagged as `@skipInServerless` will be excluded from the PR
validation process using the serverless FTR environment, the periodic
pipeline and kibana release process for Serverless.

**Tests tagged as `@skipInEss`**

All the tests tagged as `skipInEss` will be excluded from the PR
validation process using an on-prem ESS environment.

---------

Co-authored-by: Ryland Herrick <ryalnd@gmail.com>
2024-04-23 18:21:13 +02:00

51 lines
1.5 KiB
JavaScript

/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
const { spawn } = require('child_process');
const [, , type, area, licenseFolder, domain, projectType, environment, ...args] = process.argv;
const configPath = `./test_suites/${area}/${domain}/${licenseFolder}/configs/${projectType}.config.ts`;
const command =
type === 'server'
? '../../scripts/functional_tests_server.js'
: '../../scripts/functional_test_runner';
let grepArgs = [];
if (type !== 'server') {
switch (environment) {
case 'serverlessEnv':
grepArgs = ['--grep', '/^(?!.*@skipInServerless).*@serverless.*/'];
break;
case 'essEnv':
grepArgs = ['--grep', '/^(?!.*@skipInEss).*@ess.*/'];
break;
case 'qaPeriodicEnv':
grepArgs = ['--grep', '/^(?!.*@skipInServerless|.*@skipInServerlessMKI).*@serverless.*/'];
break;
case 'qaEnv':
grepArgs = ['--grep', '/^(?!.*@skipInServerless|.*@skipInServerlessMKI).*@serverlessQA.*/'];
break;
default:
console.error(`Unsupported environment: ${environment}`);
process.exit(1);
}
}
const child = spawn('node', [command, '--config', configPath, ...grepArgs, ...args], {
stdio: 'inherit',
});
child.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});