Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,10 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security
/x-pack/platform/test/accessibility/ftr_provider_context.d.ts @elastic/appex-qa
/x-pack/platform/test/accessibility/page_objects.ts @elastic/appex-qa
/x-pack/platform/test/accessibility/services.ts @elastic/appex-qa
/x-pack/test_serverless/functional/page_objects/add_cis_integration_form_page.ts @elastic/appex-qa # temporarily due to SKA tests relocation
/x-pack/test_serverless/functional/page_objects/constants/test_subject_ids.ts @elastic/appex-qa # temporarily due to SKA tests relocation
/x-pack/test_serverless/functional/page_objects/csp_dashboard_page.ts @elastic/appex-qa # temporarily due to SKA tests relocation
/x-pack/test_serverless/functional/page_objects/security_common.ts @elastic/appex-qa # temporarily due to SKA tests relocation

# Core
/src/platform/test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json @elastic/kibana-core @elastic/kibana-data-discovery
Expand Down
8 changes: 4 additions & 4 deletions x-pack/platform/test/functional/services/ml/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
getCompressedModelDefinition(modelType: ModelType) {
return fs.readFileSync(
require.resolve(
`@kbn/test-suites-xpack-platform/api_integration/services/ml/resources/trained_model_definitions/minimum_valid_config_${modelType}.json.gz.b64`
`../../../api_integration/services/ml/resources/trained_model_definitions/minimum_valid_config_${modelType}.json.gz.b64`
),
'utf-8'
);
Expand All @@ -1681,7 +1681,7 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
getTrainedModelConfig(modelName: SupportedTrainedModelNamesType) {
const configFileContent = fs.readFileSync(
require.resolve(
`@kbn/test-suites-xpack-platform/api_integration/services/ml/resources/trained_model_definitions/${modelName}/config.json`
`../../../api_integration/services/ml/resources/trained_model_definitions/${modelName}/config.json`
),
'utf-8'
);
Expand All @@ -1691,7 +1691,7 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
getTrainedModelVocabulary(modelName: SupportedTrainedModelNamesType) {
const vocabularyFileContent = fs.readFileSync(
require.resolve(
`@kbn/test-suites-xpack-platform/api_integration/services/ml/resources/trained_model_definitions/${modelName}/vocabulary.json`
`../../../api_integration/services/ml/resources/trained_model_definitions/${modelName}/vocabulary.json`
),
'utf-8'
);
Expand All @@ -1700,7 +1700,7 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {

getTrainedModelDefinitionPath(modelName: SupportedTrainedModelNamesType) {
return require.resolve(
`@kbn/test-suites-xpack-platform/api_integration/services/ml/resources/trained_model_definitions/${modelName}/traced_pytorch_model.pt`
`../../../api_integration/services/ml/resources/trained_model_definitions/${modelName}/traced_pytorch_model.pt`
);
},

Expand Down
3 changes: 2 additions & 1 deletion x-pack/platform/test/serverless/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { CA_CERT_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils';
import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-utils';
import path from 'path';
import { fleetPackageRegistryDockerImage, defineDockerServersConfig } from '@kbn/test';
import { services as svlServices } from './services';

export default async () => {
const packageRegistryConfig = path.join(__dirname, './common/package_registry_config.yml');
Expand Down Expand Up @@ -184,7 +185,7 @@ export default async () => {
// Used by FTR to recognize serverless project and change its behavior accordingly
serverless: true,

services: {}, // define later
services: svlServices,
Copy link
Contributor Author

@dmlemeshko dmlemeshko Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config without services loaded was failing when Cypress tests started with FTR were trying to use KibanaServer call


// overriding default timeouts from src/platform/packages/shared/kbn-test/src/functional_test_runner/lib/config/schema.ts
// so we can easily adjust them for serverless where needed
Expand Down
13 changes: 13 additions & 0 deletions x-pack/platform/test/serverless/services/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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.
*/

import { services as deploymentAgnosticServices } from '../../api_integration_deployment_agnostic/services';

export const services = {
...deploymentAgnosticServices,
// Add any additional serverless-specific services here
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const svlSharedConfig = await readConfigFile(
require.resolve('@kbn/test-suites-serverless/shared/config.base')
require.resolve('@kbn/test-suites-xpack-platform/serverless/config.base')
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const svlSharedConfig = await readConfigFile(
require.resolve('@kbn/test-suites-serverless/shared/config.base')
require.resolve('@kbn/test-suites-xpack-platform/serverless/config.base')
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import type { GetBenchmarkResponse } from '@kbn/cloud-security-posture-plugin/common/types/latest';
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { createPackagePolicy } from '@kbn/test-suites-xpack-security/api_integration/apis/cloud_security_posture/helper';
import { createPackagePolicy } from '../helper';
import { FtrProviderContext } from '../../../../ftr_provider_context';
import { RoleCredentials } from '../../../../../shared/services';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from '@kbn/expect';
import type { GetBenchmarkResponse } from '@kbn/cloud-security-posture-plugin/common/types/latest';
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { createPackagePolicy } from '@kbn/test-suites-xpack-security/api_integration/apis/cloud_security_posture/helper';
import { createPackagePolicy } from '../helper';
import { FtrProviderContext } from '../../../../ftr_provider_context';
import { RoleCredentials } from '../../../../../shared/services';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* 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.
*/

export interface MockTelemetryFindings {
rule: {
benchmark: { id: string; posture_type?: string | undefined; version: string; name: string };
};
resource: { type: string; sub_type: string; id: string };
agent: { id: string };
result: { evaluation: string };
host: { name: string };
cluster_id?: string;
cloud?: { account?: { id: string } };
cloudbeat?: { kubernetes: { version: string } };
data_stream?: { namespace: string };
}

export interface MockTelemetryData {
[key: string]: MockTelemetryFindings[];
}

export const data: MockTelemetryData = {
cspmFindings: [
{
rule: {
benchmark: {
id: 'cis_aws',
posture_type: 'cspm',
version: 'v1.5.0',
name: 'CIS Amazon Web Services Foundations',
},
},
resource: {
type: 'identifyingType',
sub_type: 'aws-password-policy',
id: '15e450b7-8980-5bca-ade2-a0c795f9ea9d',
},
agent: { id: '07bd3686-98ef-4b23-99cb-9ff544b25ae2' },
result: { evaluation: 'failed' },
cloud: { account: { id: 'my-aws-12345' } },
host: { name: 'docker-fleet-agent' },
data_stream: { namespace: 'default' },
},
{
rule: {
benchmark: {
id: 'cis_aws',
posture_type: 'cspm',
version: 'v1.5.0',
name: 'CIS Amazon Web Services Foundations',
},
},
resource: {
type: 'identifyingType',
sub_type: 'aws-password-policy',
id: '15e450b7-8980-5bca-ade2-a0c795f9ea99',
},
agent: { id: '07bd3686-98ef-4b23-99cb-9ff544b25ae2' },
result: { evaluation: 'passed' },
cloud: { account: { id: 'my-aws-12345' } },
host: { name: 'docker-fleet-agent' },
data_stream: { namespace: 'default' },
},
],
kspmFindings: [
{
cluster_id: 'my-k8s-cluster-5555',
rule: {
benchmark: {
id: 'cis_k8s',
version: 'v1.0.0',
name: 'CIS Kubernetes V1.23',
posture_type: 'kspm',
},
},
resource: {
type: 'k8s_object',
sub_type: 'ServiceAccount',
id: '1111',
},
agent: { id: '07bd3686-98ef-4b23-99cb-9ff544b25ae2' },
result: { evaluation: 'passed' },
host: { name: 'docker-fleet-agent' },
cloudbeat: { kubernetes: { version: 'v1.23.0' } },
data_stream: { namespace: 'default' },
},
{
cluster_id: 'my-k8s-cluster-5555',
rule: {
benchmark: {
id: 'cis_k8s',
version: 'v1.0.0',
name: 'CIS Kubernetes V1.23',
posture_type: 'kspm',
},
},
resource: {
type: 'process',
sub_type: 'process',
id: '1111',
},
agent: { id: '07bd3686-98ef-4b23-99cb-9ff544b25ae3' },
result: { evaluation: 'passed' },
host: { name: 'control-plane' },
cloudbeat: { kubernetes: { version: 'v1.23.0' } },
data_stream: { namespace: 'default' },
},
],
kspmFindingsNoPostureType: [
{
cluster_id: 'my-k8s-cluster-5555',
rule: {
benchmark: {
id: 'cis_k8s',
version: 'v1.0.0',
name: 'CIS Kubernetes V1.23',
},
},
resource: {
type: 'k8s_object',
sub_type: 'ServiceAccount',
id: '1111',
},
agent: { id: '07bd3686-98ef-4b23-99cb-9ff544b25ae2' },
result: { evaluation: 'passed' },
host: { name: 'docker-fleet-agent' },
cloudbeat: { kubernetes: { version: 'v1.23.0' } },
},
{
cluster_id: 'my-k8s-cluster-5555',
rule: {
benchmark: {
id: 'cis_k8s',
version: 'v1.0.0',
name: 'CIS Kubernetes V1.23',
},
},
resource: {
type: 'process',
sub_type: 'process',
id: '1111',
},
agent: { id: '07bd3686-98ef-4b23-99cb-9ff544b25ae3' },
result: { evaluation: 'passed' },
host: { name: 'control-plane' },
cloudbeat: { kubernetes: { version: 'v1.23.0' } },
},
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
FindCspBenchmarkRuleResponse,
} from '@kbn/cloud-security-posture-common/schema/rules/latest';

import { createPackagePolicy } from '@kbn/test-suites-xpack-security/api_integration/apis/cloud_security_posture/helper';
import { createPackagePolicy } from './helper';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { RoleCredentials } from '../../../../shared/services';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
ELASTIC_HTTP_VERSION_HEADER,
X_ELASTIC_INTERNAL_ORIGIN_REQUEST,
} from '@kbn/core-http-common';
import { result } from '@kbn/test-suites-xpack-security/cloud_security_posture_api/utils';
import type { Agent } from 'supertest';
import type { GraphRequest } from '@kbn/cloud-security-posture-common/types/graph/v1';
import { result } from './utils';
import type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
Expand Down
Loading