From 5a6e17df442cd05fb910f2cda3fd021cd0083ca2 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Wed, 15 Nov 2023 10:53:13 +0100 Subject: [PATCH] last adjusments --- config/serverless.security.yml | 1 - .../run_cypress/parallel_serverless.ts | 33 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/config/serverless.security.yml b/config/serverless.security.yml index 4a5be14efd0f1..7f749afc7626d 100644 --- a/config/serverless.security.yml +++ b/config/serverless.security.yml @@ -18,7 +18,6 @@ xpack.securitySolutionServerless.productTypes: [ { product_line: 'security', product_tier: 'complete' }, { product_line: 'endpoint', product_tier: 'complete' }, - { product_line: 'cloud', product_tier: 'complete'}, ] xpack.securitySolution.offeringSettings: { diff --git a/x-pack/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts b/x-pack/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts index ab49b40c71690..7b71400ec5408 100644 --- a/x-pack/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts +++ b/x-pack/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts @@ -48,7 +48,7 @@ interface Project { product: string; } -interface ProjectConfigurationOverride { +interface ProjectConfigurationParameters { tier: string; ignoreEndpoint: boolean; ignoreCloud: boolean; @@ -59,6 +59,12 @@ interface Credentials { password: string; } +const DEFAULT_CONFIGURATION: ProductType[] = [ + { product_line: 'security', product_tier: 'complete' }, + { product_line: 'cloud', product_tier: 'complete' }, + { product_line: 'endpoint', product_tier: 'complete' }, +] as const; + const DEFAULT_REGION = 'aws-eu-west-1'; const PROJECT_NAME_PREFIX = 'kibana-cypress-security-solution-ephemeral'; const BASE_ENV_URL = 'https://global.qa.cld.elstc.co'; @@ -326,21 +332,21 @@ function waitForKibanaLogin(kbUrl: string, credentials: Credentials): Promise { - let productTypes = parseTestFileConfig(filePath).productTypes as ProductType[]; - if (projectConfigurationOverride.tier) { + let productTypes = DEFAULT_CONFIGURATION; + + if (projectConfigurationParameters.tier) { productTypes = productTypes.map((product) => ({ ...product, - product_tier: projectConfigurationOverride.tier, + product_tier: projectConfigurationParameters.tier, })); } - if (projectConfigurationOverride.ignoreEndpoint) { + if (projectConfigurationParameters.ignoreEndpoint) { productTypes = productTypes.filter((product) => product.product_line !== 'endpoint'); } - if (projectConfigurationOverride.ignoreCloud) { + if (projectConfigurationParameters.ignoreCloud) { productTypes = productTypes.filter((product) => product.product_line !== 'cloud'); } return productTypes; @@ -409,10 +415,10 @@ ${JSON.stringify(argv, null, 2)} const cypressConfigFilePath = require.resolve(`../../${argv.configFile}`) as string; const cypressConfigFile = await import(cypressConfigFilePath); - const projectConfigurationOverride: ProjectConfigurationOverride = { + const projectConfigurationParameters: ProjectConfigurationParameters = { tier: argv.tier as string, ignoreEndpoint: argv.ignoreEndpoint as boolean, - ignoreCloud: argv.ignoreClous as boolean, + ignoreCloud: argv.ignoreCloud as boolean, }; log.info(` @@ -483,7 +489,10 @@ ${JSON.stringify(cypressConfigFile, null, 2)} await withProcRunner(log, async (procs) => { const id = crypto.randomBytes(8).toString('hex'); const PROJECT_NAME = `${PROJECT_NAME_PREFIX}-${id}`; - const productTypes = getProductTypes(filePath, projectConfigurationOverride); + + const productTypes = isOpen + ? getOverridedProductTypes(projectConfigurationParameters) + : (parseTestFileConfig(filePath).productTypes as ProductType[]); if (!API_KEY) { log.info('API KEY to create project could not be retrieved.');