Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EDR Workflows] Reenable and improve endpoint FTR tests on serverless #189248

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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"target/**/*"
],
"kbn_references": [
{ "path": "../security_solution_endpoint/tsconfig.json" },
"@kbn/test-suites-serverless",
{ "path": "../../test_serverless/api_integration/**/*" },
{ "path": "../../test_serverless/shared/**/*" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { FtrProviderContext } from '../../configs/ftr_provider_context';
export default function (providerContext: FtrProviderContext) {
const { loadTestFile, getService, getPageObjects } = providerContext;

// Flaky: https://github.com/elastic/kibana/issues/186089
describe('@skipInServerless endpoint', function () {
describe('endpoint', function () {
const ingestManager = getService('ingestManager');
const log = getService('log');
const endpointTestResources = getService('endpointTestResources');
Expand All @@ -38,7 +37,7 @@ export default function (providerContext: FtrProviderContext) {
if (await isServerlessKibanaFlavor(kbnClient)) {
log.info('login for serverless environment');
const pageObjects = getPageObjects(['svlCommonPage']);
await pageObjects.svlCommonPage.login();
await pageObjects.svlCommonPage.loginWithRole('endpoint_operations_analyst');
}
});
loadTestFile(require.resolve('./endpoint_list'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { FtrProviderContext } from '../../configs/ftr_provider_context';
export default function (providerContext: FtrProviderContext) {
const { loadTestFile, getService, getPageObjects } = providerContext;

// Flaky: https://github.com/elastic/kibana/issues/186086
describe('endpoint', function () {
const ingestManager = getService('ingestManager');
const log = getService('log');
Expand All @@ -37,7 +36,7 @@ export default function (providerContext: FtrProviderContext) {
if (await isServerlessKibanaFlavor(kbnClient)) {
log.info('login for serverless environment');
const pageObjects = getPageObjects(['svlCommonPage']);
await pageObjects.svlCommonPage.login();
await pageObjects.svlCommonPage.loginWithRole('admin');
}
});
loadTestFile(require.resolve('./policy_list'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import { Config } from '@kbn/test';
import { FtrConfigProviderContext } from '@kbn/test';
import { SecuritySolutionEndpointRegistryHelpers } from '../../common/services/security_solution';
import { pageObjects } from '../page_objects';
import type { TargetTags } from '../target_tags';
import { PageObjects } from '../page_objects';
import { Services } from '../services';

export const SUITE_TAGS: Record<
'ess' | 'serverless',
Expand All @@ -33,14 +34,16 @@ export const generateConfig = async ({
kbnServerArgs = [],
target,
services,
pageObjects,
}: {
ftrConfigProviderContext: FtrConfigProviderContext;
baseConfig: Config;
testFiles: string[];
junitReportName: string;
kbnServerArgs?: string[];
target: keyof typeof SUITE_TAGS;
services: any;
services: Services;
pageObjects: PageObjects;
}): Promise<Config> => {
const { readConfigFile } = ftrConfigProviderContext;
// services are not ready yet, so we need to import them here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test';
import { resolve } from 'path';
import { generateConfig } from './config.base';
import { services } from '../services';
import { pageObjects } from '../page_objects';

// eslint-disable-next-line import/no-default-export
export default async function (ftrConfigProviderContext: FtrConfigProviderContext) {
Expand All @@ -25,5 +26,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex
junitReportName: 'X-Pack Endpoint Functional Tests on ESS',
target: 'ess',
services,
pageObjects,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

import { GenericFtrProviderContext } from '@kbn/test';

import { pageObjects } from '../page_objects';
import { services } from '../services';
import { pageObjects, svlPageObjects } from '../page_objects';
import { services, svlServices } from '../services';

export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;
export type FtrProviderContext = GenericFtrProviderContext<
typeof services & typeof svlServices,
typeof pageObjects & typeof svlPageObjects
>;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { resolve } from 'path';
import { FtrConfigProviderContext } from '@kbn/test';
import { generateConfig } from './config.base';
import { services } from '../services';
import { pageObjects } from '../page_objects';

// eslint-disable-next-line import/no-default-export
export default async function (ftrConfigProviderContext: FtrConfigProviderContext) {
Expand All @@ -29,5 +30,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex
'--xpack.securitySolution.packagerTaskInterval=5s',
],
services,
pageObjects,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FtrConfigProviderContext } from '@kbn/test';
import { resolve } from 'path';
import { generateConfig } from './config.base';
import { svlServices } from '../services';
import { svlPageObjects } from '../page_objects';

// eslint-disable-next-line import/no-default-export
export default async function (ftrConfigProviderContext: FtrConfigProviderContext) {
Expand All @@ -26,5 +27,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex
kbnServerArgs: ['--serverless=security'],
target: 'serverless',
services: svlServices,
pageObjects: svlPageObjects,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { resolve } from 'path';
import { FtrConfigProviderContext } from '@kbn/test';
import { generateConfig } from './config.base';
import { svlServices } from '../services';
import { svlPageObjects } from '../page_objects';

// eslint-disable-next-line import/no-default-export
export default async function (ftrConfigProviderContext: FtrConfigProviderContext) {
Expand All @@ -30,5 +31,6 @@ export default async function (ftrConfigProviderContext: FtrConfigProviderContex
'--xpack.securitySolution.packagerTaskInterval=5s',
],
services: svlServices,
pageObjects: svlPageObjects,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { SvlCommonPageProvider } from '@kbn/test-suites-serverless/functional/page_objects/svl_common_page';
import { pageObjects as xpackFunctionalPageObjects } from '../../functional/page_objects';
import { EndpointPageProvider } from './endpoint_page';
import { EndpointPageUtils } from './page_utils';
Expand All @@ -17,7 +18,6 @@ import { EndpointPolicyPageProvider } from './policy_page';
import { TrustedAppsPageProvider } from './trusted_apps_page';
import { FleetIntegrations } from './fleet_integrations_page';
import { ArtifactEntriesListPageProvider } from './artifact_entries_list_page';
import { SvlCommonPageProvider } from './svl_common_page';

export const pageObjects = {
...xpackFunctionalPageObjects,
Expand All @@ -33,6 +33,12 @@ export const pageObjects = {
trustedApps: TrustedAppsPageProvider,
artifactEntriesList: ArtifactEntriesListPageProvider,
fleetIntegrations: FleetIntegrations,
};

export const svlPageObjects = {
...pageObjects,

svlCommonPage: SvlCommonPageProvider,
};

export type PageObjects = typeof pageObjects | typeof svlPageObjects;

This file was deleted.

7 changes: 7 additions & 0 deletions x-pack/test/security_solution_endpoint/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* 2.0.
*/

import { SvlUserManagerProvider } from '@kbn/test-suites-serverless/shared/services/svl_user_manager';
import { SvlCommonApiServiceProvider } from '@kbn/test-suites-serverless/shared/services/svl_common_api';
import { services as xPackFunctionalServices } from '../../functional/services';
import { IngestManagerProvider } from '../../common/services/ingest_manager';
import { EndpointTelemetryTestResourcesProvider } from './endpoint_telemetry';
Expand Down Expand Up @@ -39,4 +41,9 @@ export const svlServices = {

supertest: KibanaSupertestWithCertProvider,
supertestWithoutAuth: KibanaSupertestWithCertWithoutAuthProvider,

svlCommonApi: SvlCommonApiServiceProvider,
svlUserManager: SvlUserManagerProvider,
};

export type Services = typeof services | typeof svlServices;
31 changes: 31 additions & 0 deletions x-pack/test/security_solution_endpoint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"node",
"@kbn/ambient-ftr-types"
],
"allowJs": false
},
"include": [
"**/*",
"../../../typings/**/*",
"../../../packages/kbn-test/types/ftr_globals/**/*"
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/test-suites-serverless",
"@kbn/expect",
"@kbn/security-solution-plugin",
"@kbn/repo-info",
"@kbn/securitysolution-list-constants",
"@kbn/fleet-plugin",
"@kbn/securitysolution-io-ts-list-types",
"@kbn/ftr-common-functional-ui-services",
"@kbn/test",
"@kbn/test-subj-selector",
]
}
4 changes: 2 additions & 2 deletions x-pack/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"*/plugins/**/*",
"*/packages/**/*",
"*/*/packages/**/*",
"security_solution_api_integration/**/*"
"security_solution_api_integration/**/*",
"security_solution_endpoint/**/*"
],
"kbn_references": [
"@kbn/test-suites-src",
Expand Down Expand Up @@ -166,7 +167,6 @@
"@kbn/alerting-state-types",
"@kbn/reporting-server",
"@kbn/data-quality-plugin",
"@kbn/securitysolution-io-ts-list-types",
"@kbn/ml-trained-models-utils",
"@kbn/openapi-common",
"@kbn/securitysolution-lists-common",
Expand Down