From f0bb0e656dcde967ed5e4a51d7fcee26db830823 Mon Sep 17 00:00:00 2001 From: seanrathier Date: Mon, 23 Sep 2024 10:46:15 -0400 Subject: [PATCH] [Cloud Security] [Agentless] Create Serverless Quality Gate tests for running Agentless sanity tests every 3 hours (#193078) (cherry picked from commit 946c26ea77a923463e52ca9887847fd9005ec149) --- .../cloud_security_posture/agentless_api/create_agent.ts | 2 ++ .../ftr/cloud_security_posture/agentless_api/index.ts | 2 +- .../functional/test_suites/security/index.ts | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts index d2d797a5c107d..b26581fb46dfd 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts @@ -29,6 +29,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { let cisIntegration: typeof pageObjects.cisAddIntegration; before(async () => { + // If process.env.TEST_CLOUD is set, then the test is running in the Serverless Quality Gates + // and this MSW server will be listening for a request that will never come. mockApiServer = mockAgentlessApiService.listen(8089); // Start the usage api mock server on port 8089 await pageObjects.svlCommonPage.loginAsAdmin(); cisIntegration = pageObjects.cisAddIntegration; diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/index.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/index.ts index 44aea818827d7..87008cadeff0d 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/index.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/index.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('cloud_security_posture', function () { - this.tags(['cloud_security_posture_agentless']); + this.tags(['cloud_security_posture']); loadTestFile(require.resolve('./create_agent')); }); } diff --git a/x-pack/test_serverless/functional/test_suites/security/index.ts b/x-pack/test_serverless/functional/test_suites/security/index.ts index e08dd6f3c89ce..daa34ff0c1e73 100644 --- a/x-pack/test_serverless/functional/test_suites/security/index.ts +++ b/x-pack/test_serverless/functional/test_suites/security/index.ts @@ -8,6 +8,8 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { + const isCloud = !!process.env.TEST_CLOUD; + describe('serverless security UI', function () { this.tags(['esGate']); @@ -16,5 +18,9 @@ export default function ({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./ftr/cases')); loadTestFile(require.resolve('./ftr/advanced_settings')); loadTestFile(require.resolve('./ml')); + if (isCloud) { + // only run the agentless API tests in the Serverless Quality Gates + loadTestFile(require.resolve('./ftr/cloud_security_posture/agentless_api')); + } }); }