From b0ba8d3104bcf7ac39ef6f32d3b83524f8be9158 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 16 Nov 2023 18:49:06 +0100 Subject: [PATCH 1/9] clean FTR config, update kbn-test --- packages/kbn-test/src/es/test_es_cluster.ts | 10 ++-- .../functional_tests/lib/run_elasticsearch.ts | 48 ++++++++++++------- x-pack/test_serverless/shared/config.base.ts | 22 ++------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/packages/kbn-test/src/es/test_es_cluster.ts b/packages/kbn-test/src/es/test_es_cluster.ts index 461ad2b6f0df1..84c2da1e52f80 100644 --- a/packages/kbn-test/src/es/test_es_cluster.ts +++ b/packages/kbn-test/src/es/test_es_cluster.ts @@ -71,7 +71,10 @@ export interface CreateTestEsClusterOptions { */ esArgs?: string[]; esFrom?: string; - esServerlessOptions?: Pick; + esServerlessOptions?: Pick< + ServerlessOptions, + 'image' | 'tag' | 'resources' | 'host' | 'kibanaUrl' + >; esJavaOpts?: string; /** * License to run your cluster under. Keep in mind that a `trial` license @@ -242,10 +245,7 @@ export function createTestEsCluster< await firstNode.runServerless({ basePath, esArgs: customEsArgs, - image: esServerlessOptions?.image, - tag: esServerlessOptions?.tag, - host: esServerlessOptions?.host, - resources: esServerlessOptions?.resources, + ...esServerlessOptions, port, clean: true, background: true, diff --git a/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts b/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts index 742f729745d27..4f01321b82391 100644 --- a/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts +++ b/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import Url from 'url'; import { resolve } from 'path'; import type { ToolingLog } from '@kbn/tooling-log'; import getPort from 'get-port'; @@ -160,7 +161,18 @@ async function startEsNode({ return cluster; } -function getESServerlessOptions(esServerlessImageFromArg: string | undefined, config: Config) { +interface EsServerlessOptions { + host?: string; + resources: string[]; + kibanaUrl: string; + tag?: string; + image?: string; +} + +function getESServerlessOptions( + esServerlessImageFromArg: string | undefined, + config: Config +): EsServerlessOptions { const esServerlessImageUrlOrTag = esServerlessImageFromArg || esTestConfig.getESServerlessImage() || @@ -172,24 +184,24 @@ function getESServerlessOptions(esServerlessImageFromArg: string | undefined, co const serverlessHost: string | undefined = config.has('esServerlessOptions.host') && config.get('esServerlessOptions.host'); + const commonOptions = { + host: serverlessHost, + resources: serverlessResources, + kibanaUrl: Url.format({ + protocol: config.get('servers.kibana.protocol'), + hostname: config.get('servers.kibana.hostname'), + port: config.get('servers.kibana.port'), + }), + }; + if (esServerlessImageUrlOrTag) { - if (esServerlessImageUrlOrTag.includes(':')) { - return { - resources: serverlessResources, - image: esServerlessImageUrlOrTag, - host: serverlessHost, - }; - } else { - return { - resources: serverlessResources, - tag: esServerlessImageUrlOrTag, - host: serverlessHost, - }; - } + return { + ...commonOptions, + ...(esServerlessImageUrlOrTag.includes(':') + ? { image: esServerlessImageUrlOrTag } + : { tag: esServerlessImageUrlOrTag }), + }; } - return { - resources: serverlessResources, - host: serverlessHost, - }; + return commonOptions; } diff --git a/x-pack/test_serverless/shared/config.base.ts b/x-pack/test_serverless/shared/config.base.ts index ec11099f946c0..1426ba8315548 100644 --- a/x-pack/test_serverless/shared/config.base.ts +++ b/x-pack/test_serverless/shared/config.base.ts @@ -16,15 +16,17 @@ import { kibanaTestSuperuserServerless, getDockerFileMountPath, } from '@kbn/test'; -import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils'; +import { CA_CERT_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils'; import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { services } from './services'; +const MOCK_IDP_REALM_NAME = 'mock-idp'; + export default async () => { const servers = { kibana: { ...kbnTestConfig.getUrlParts(kibanaTestSuperuserServerless), - protocol: 'https', + protocol: process.env.TEST_CLOUD ? 'https' : 'http', certificateAuthorities: process.env.TEST_CLOUD ? undefined : [Fs.readFileSync(CA_CERT_PATH)], }, elasticsearch: { @@ -68,16 +70,6 @@ export default async () => { 'xpack.security.authc.realms.jwt.jwt1.order=-98', `xpack.security.authc.realms.jwt.jwt1.pkc_jwkset_path=${getDockerFileMountPath(jwksPath)}`, `xpack.security.authc.realms.jwt.jwt1.token_type=access_token`, - - 'xpack.security.authc.realms.saml.cloud-saml-kibana.attributes.principal=urn:oid:0.0.7', - 'xpack.security.authc.realms.saml.cloud-saml-kibana.idp.entity_id=http://www.elastic.co/saml1', - 'xpack.security.authc.realms.saml.cloud-saml-kibana.order=101', - `xpack.security.authc.realms.saml.cloud-saml-kibana.idp.metadata.path=${getDockerFileMountPath( - idpPath - )}`, - `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.acs=http://localhost:${servers.kibana.port}/api/security/saml/callback`, - `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.entity_id=http://localhost:${servers.kibana.port}`, - `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.logout=http://localhost:${servers.kibana.port}/logout`, ], ssl: true, // SSL is required for SAML realm }, @@ -89,10 +81,6 @@ export default async () => { }, sourceArgs: ['--no-base-path', '--env.name=development'], serverArgs: [ - '--server.ssl.enabled=true', - `--server.ssl.key=${KBN_KEY_PATH}`, - `--server.ssl.certificate=${KBN_CERT_PATH}`, - `--server.ssl.certificateAuthorities=${CA_CERT_PATH}`, `--server.restrictInternalApis=true`, `--server.port=${servers.kibana.port}`, '--status.allowAnonymous=true', @@ -147,7 +135,7 @@ export default async () => { // user navigates to `/login` page directly and enters username and password in the login form. '--xpack.security.authc.selector.enabled=false', `--xpack.security.authc.providers=${JSON.stringify({ - saml: { 'cloud-saml-kibana': { order: 0, realm: 'cloud-saml-kibana' } }, + saml: { 'cloud-saml-kibana': { order: 0, realm: MOCK_IDP_REALM_NAME } }, basic: { 'cloud-basic': { order: 1 } }, })}`, '--xpack.encryptedSavedObjects.encryptionKey="wuGNaIhoMpk5sO4UBxgr3NyW1sFcLgIf"', From d3c69c3dcc290be08d670c1065b0e94a974660df Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Mon, 20 Nov 2023 17:33:35 +0100 Subject: [PATCH 2/9] add mock idp realm back --- x-pack/test_serverless/shared/config.base.ts | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/x-pack/test_serverless/shared/config.base.ts b/x-pack/test_serverless/shared/config.base.ts index 1426ba8315548..46f5c7bb11973 100644 --- a/x-pack/test_serverless/shared/config.base.ts +++ b/x-pack/test_serverless/shared/config.base.ts @@ -21,6 +21,16 @@ import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { services } from './services'; const MOCK_IDP_REALM_NAME = 'mock-idp'; +const MOCK_IDP_ENTITY_ID = 'urn:mock-idp'; // Must match `entityID` in `metadata.xml` + +const MOCK_IDP_ATTRIBUTE_PRINCIPAL = 'http://saml.elastic-cloud.com/attributes/principal'; +const MOCK_IDP_ATTRIBUTE_ROLES = 'http://saml.elastic-cloud.com/attributes/roles'; +const MOCK_IDP_ATTRIBUTE_EMAIL = 'http://saml.elastic-cloud.com/attributes/email'; +const MOCK_IDP_ATTRIBUTE_NAME = 'http://saml.elastic-cloud.com/attributes/name'; + +const SERVERLESS_CONFIG_PATH = '/usr/share/elasticsearch/config/'; + +const trimTrailingSlash = (url: string) => (url.endsWith('/') ? url.slice(0, -1) : url); export default async () => { const servers = { @@ -36,6 +46,12 @@ export default async () => { }, }; + const kibanaUrl = formatUrl({ + protocol: servers.kibana.protocol, + hostname: servers.kibana.hostname, + port: servers.kibana.port, + }); + // "Fake" SAML provider const idpPath = resolve( __dirname, @@ -70,6 +86,23 @@ export default async () => { 'xpack.security.authc.realms.jwt.jwt1.order=-98', `xpack.security.authc.realms.jwt.jwt1.pkc_jwkset_path=${getDockerFileMountPath(jwksPath)}`, `xpack.security.authc.realms.jwt.jwt1.token_type=access_token`, + // Mock IDP Realm + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.order=0`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.idp.metadata.path=${SERVERLESS_CONFIG_PATH}secrets/idp_metadata.xml`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.idp.entity_id=${MOCK_IDP_ENTITY_ID}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.entity_id=${trimTrailingSlash( + kibanaUrl + )}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.acs=${trimTrailingSlash( + kibanaUrl + )}/api/security/saml/callback`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.logout=${trimTrailingSlash( + kibanaUrl + )}/logout`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.principal=${MOCK_IDP_ATTRIBUTE_PRINCIPAL}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.groups=${MOCK_IDP_ATTRIBUTE_ROLES}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.name=${MOCK_IDP_ATTRIBUTE_EMAIL}`, + `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.mail=${MOCK_IDP_ATTRIBUTE_NAME}`, ], ssl: true, // SSL is required for SAML realm }, From 39eeafdef01f42824fae68360d0b71bddfd49422 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 21 Nov 2023 15:12:42 +0100 Subject: [PATCH 3/9] Revert "add mock idp realm back" This reverts commit d3c69c3dcc290be08d670c1065b0e94a974660df. --- x-pack/test_serverless/shared/config.base.ts | 33 -------------------- 1 file changed, 33 deletions(-) diff --git a/x-pack/test_serverless/shared/config.base.ts b/x-pack/test_serverless/shared/config.base.ts index 46f5c7bb11973..1426ba8315548 100644 --- a/x-pack/test_serverless/shared/config.base.ts +++ b/x-pack/test_serverless/shared/config.base.ts @@ -21,16 +21,6 @@ import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; import { services } from './services'; const MOCK_IDP_REALM_NAME = 'mock-idp'; -const MOCK_IDP_ENTITY_ID = 'urn:mock-idp'; // Must match `entityID` in `metadata.xml` - -const MOCK_IDP_ATTRIBUTE_PRINCIPAL = 'http://saml.elastic-cloud.com/attributes/principal'; -const MOCK_IDP_ATTRIBUTE_ROLES = 'http://saml.elastic-cloud.com/attributes/roles'; -const MOCK_IDP_ATTRIBUTE_EMAIL = 'http://saml.elastic-cloud.com/attributes/email'; -const MOCK_IDP_ATTRIBUTE_NAME = 'http://saml.elastic-cloud.com/attributes/name'; - -const SERVERLESS_CONFIG_PATH = '/usr/share/elasticsearch/config/'; - -const trimTrailingSlash = (url: string) => (url.endsWith('/') ? url.slice(0, -1) : url); export default async () => { const servers = { @@ -46,12 +36,6 @@ export default async () => { }, }; - const kibanaUrl = formatUrl({ - protocol: servers.kibana.protocol, - hostname: servers.kibana.hostname, - port: servers.kibana.port, - }); - // "Fake" SAML provider const idpPath = resolve( __dirname, @@ -86,23 +70,6 @@ export default async () => { 'xpack.security.authc.realms.jwt.jwt1.order=-98', `xpack.security.authc.realms.jwt.jwt1.pkc_jwkset_path=${getDockerFileMountPath(jwksPath)}`, `xpack.security.authc.realms.jwt.jwt1.token_type=access_token`, - // Mock IDP Realm - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.order=0`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.idp.metadata.path=${SERVERLESS_CONFIG_PATH}secrets/idp_metadata.xml`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.idp.entity_id=${MOCK_IDP_ENTITY_ID}`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.entity_id=${trimTrailingSlash( - kibanaUrl - )}`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.acs=${trimTrailingSlash( - kibanaUrl - )}/api/security/saml/callback`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.sp.logout=${trimTrailingSlash( - kibanaUrl - )}/logout`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.principal=${MOCK_IDP_ATTRIBUTE_PRINCIPAL}`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.groups=${MOCK_IDP_ATTRIBUTE_ROLES}`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.name=${MOCK_IDP_ATTRIBUTE_EMAIL}`, - `xpack.security.authc.realms.saml.${MOCK_IDP_REALM_NAME}.attributes.mail=${MOCK_IDP_ATTRIBUTE_NAME}`, ], ssl: true, // SSL is required for SAML realm }, From 8c5970c3437f3250c2198d6f19cff41acb3783c3 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 23 Nov 2023 09:44:01 +0100 Subject: [PATCH 4/9] import realm name from @kbn/mock-idp-plugin --- x-pack/test_serverless/shared/config.base.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/test_serverless/shared/config.base.ts b/x-pack/test_serverless/shared/config.base.ts index 1426ba8315548..6dee26203b532 100644 --- a/x-pack/test_serverless/shared/config.base.ts +++ b/x-pack/test_serverless/shared/config.base.ts @@ -18,10 +18,9 @@ import { } from '@kbn/test'; import { CA_CERT_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils'; import { commonFunctionalServices } from '@kbn/ftr-common-functional-services'; +import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-plugin/common'; import { services } from './services'; -const MOCK_IDP_REALM_NAME = 'mock-idp'; - export default async () => { const servers = { kibana: { From da2ad1ceedd9551e759542ce93cd982bdae9388f Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 23 Nov 2023 13:17:57 +0100 Subject: [PATCH 5/9] fix cypress FTR config by removing SAML args --- .../scripts/run_cypress/get_ftr_config.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts b/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts index cc3972cba0b2f..fdc8cb7891831 100644 --- a/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts +++ b/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts @@ -172,15 +172,15 @@ export const getFTRConfig = ({ } // Serverless Specific - if (vars.serverless) { - log.info(`Serverless mode detected`); - - vars.esTestCluster.serverArgs.push( - `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.entity_id=http://host.docker.internal:${kibanaPort}`, - `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.logout=http://host.docker.internal:${kibanaPort}/logout`, - `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.acs=http://host.docker.internal:${kibanaPort}/api/security/saml/callback` - ); - } + // if (vars.serverless) { + // log.info(`Serverless mode detected`); + + // vars.esTestCluster.serverArgs.push( + // `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.entity_id=http://host.docker.internal:${kibanaPort}`, + // `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.logout=http://host.docker.internal:${kibanaPort}/logout`, + // `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.acs=http://host.docker.internal:${kibanaPort}/api/security/saml/callback` + // ); + // } if (specFileFTRConfig?.productTypes) { if (vars.serverless) { From 33db15fb1aa2f9dffc62feb9523c26b3ac0dfaad Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 23 Nov 2023 13:44:08 +0100 Subject: [PATCH 6/9] [ftr] fix saml_tools to use mock-idp-plugin --- .../api_integration/services/saml_tools.ts | 30 ++++++++++--------- x-pack/test_serverless/tsconfig.json | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/x-pack/test_serverless/api_integration/services/saml_tools.ts b/x-pack/test_serverless/api_integration/services/saml_tools.ts index 4756109fc667d..bd5cd03a7edbb 100644 --- a/x-pack/test_serverless/api_integration/services/saml_tools.ts +++ b/x-pack/test_serverless/api_integration/services/saml_tools.ts @@ -6,33 +6,35 @@ */ import expect from '@kbn/expect'; -// eslint-disable-next-line @kbn/imports/no_boundary_crossing -import { getSAMLResponse } from '@kbn/security-api-integration-helpers/saml/saml_tools'; -import { kbnTestConfig } from '@kbn/test'; - import { parse as parseCookie } from 'tough-cookie'; +import Url from 'url'; +import { createSAMLResponse } from '@kbn/mock-idp-plugin/common'; import { FtrProviderContext } from '../ftr_provider_context'; export function SamlToolsProvider({ getService }: FtrProviderContext) { const supertestWithoutAuth = getService('supertestWithoutAuth'); - const randomness = getService('randomness'); const svlCommonApi = getService('svlCommonApi'); - - function createSAMLResponse(options = {}) { - return getSAMLResponse({ - destination: `http://localhost:${kbnTestConfig.getPort()}/api/security/saml/callback`, - sessionIndex: String(randomness.naturalNumber()), - ...options, - }); - } + const config = getService('config'); return { async login(username: string) { + const kibanaUrl = Url.format({ + protocol: config.get('servers.kibana.protocol'), + hostname: config.get('servers.kibana.hostname'), + port: config.get('servers.kibana.port'), + pathname: '/api/security/saml/callback', + }); const samlAuthenticationResponse = await supertestWithoutAuth .post('/api/security/saml/callback') .set(svlCommonApi.getCommonRequestHeader()) - .send({ SAMLResponse: await createSAMLResponse({ username }) }); + .send({ + SAMLResponse: await createSAMLResponse({ + username, + roles: [], + kibanaUrl, + }), + }); expect(samlAuthenticationResponse.status).to.equal(302); expect(samlAuthenticationResponse.header.location).to.equal('/'); const sessionCookie = parseCookie(samlAuthenticationResponse.header['set-cookie'][0])!; diff --git a/x-pack/test_serverless/tsconfig.json b/x-pack/test_serverless/tsconfig.json index e825bff536d8e..7e87d073a035d 100644 --- a/x-pack/test_serverless/tsconfig.json +++ b/x-pack/test_serverless/tsconfig.json @@ -68,5 +68,6 @@ "@kbn/apm-synthtrace", "@kbn/apm-synthtrace-client", "@kbn/reporting-export-types-csv-common", + "@kbn/mock-idp-plugin", ] } From a662ccfc75e3783b217d5278d0cf509d4917f95c Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 23 Nov 2023 13:47:00 +0100 Subject: [PATCH 7/9] [security_solution] remove saml override for serverless --- .../scripts/run_cypress/get_ftr_config.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts b/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts index fdc8cb7891831..de5cb675a42e1 100644 --- a/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts +++ b/x-pack/plugins/security_solution/scripts/run_cypress/get_ftr_config.ts @@ -171,17 +171,6 @@ export const getFTRConfig = ({ } } - // Serverless Specific - // if (vars.serverless) { - // log.info(`Serverless mode detected`); - - // vars.esTestCluster.serverArgs.push( - // `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.entity_id=http://host.docker.internal:${kibanaPort}`, - // `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.logout=http://host.docker.internal:${kibanaPort}/logout`, - // `xpack.security.authc.realms.saml.cloud-saml-kibana.sp.acs=http://host.docker.internal:${kibanaPort}/api/security/saml/callback` - // ); - // } - if (specFileFTRConfig?.productTypes) { if (vars.serverless) { vars.kbnTestServer.serverArgs.push( From 2680564e1041287d7b23fb2eafd3e03c28e48f42 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:57:45 +0000 Subject: [PATCH 8/9] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/test_serverless/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/test_serverless/tsconfig.json b/x-pack/test_serverless/tsconfig.json index 7e87d073a035d..6f843b935d63f 100644 --- a/x-pack/test_serverless/tsconfig.json +++ b/x-pack/test_serverless/tsconfig.json @@ -48,7 +48,6 @@ "@kbn/rison", "@kbn/discover-plugin", "@kbn/data-plugin", - "@kbn/security-api-integration-helpers", "@kbn/std", "@kbn/data-view-field-editor-plugin", "@kbn/data-plugin", From 7227fcdc1a38b7b8404602024022850cc2032b61 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 23 Nov 2023 15:56:49 +0100 Subject: [PATCH 9/9] fix protocol in group_by_fired test --- .../observability/custom_threshold_rule/group_by_fired.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/custom_threshold_rule/group_by_fired.ts b/x-pack/test_serverless/api_integration/test_suites/observability/custom_threshold_rule/group_by_fired.ts index 90dba040be18f..0f7b7a019cc83 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/custom_threshold_rule/group_by_fired.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/custom_threshold_rule/group_by_fired.ts @@ -232,8 +232,7 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.hits.hits[0]._source?.ruleType).eql('observability.rules.custom_threshold'); expect(resp.hits.hits[0]._source?.alertDetailsUrl).eql( - // Added the S to protocol.getUrlParts as not returning the correct value. - `${protocol}s://${hostname}:${port}/app/observability/alerts?_a=(kuery:%27kibana.alert.uuid:%20%22${alertId}%22%27%2CrangeFrom:%27${rangeFrom}%27%2CrangeTo:now%2Cstatus:all)` + `${protocol}://${hostname}:${port}/app/observability/alerts?_a=(kuery:%27kibana.alert.uuid:%20%22${alertId}%22%27%2CrangeFrom:%27${rangeFrom}%27%2CrangeTo:now%2Cstatus:all)` ); expect(resp.hits.hits[0]._source?.reason).eql( `Average system.cpu.total.norm.pct is 80%, above the threshold of 20%. (duration: 1 min, data view: ${DATE_VIEW}, group: host-0)`