[ska] relocate x-pack/test/cases_api_integration (#225056)

## Summary

Part of https://github.com/elastic/kibana-team/issues/1503

This PR is mostly about moving tests from
x-pack/test/cases_api_integration and updating related imports

Before:

```
x-pack/test/
     | - cases_api_integration/
```

After: 
```
x-pack/platform/test/
     | - cases_api_integration/
 
x-pack/solutions/security/test/
     | - cases_api_integration/
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Dzmitry Lemechko 2025-06-25 20:04:29 +03:00 committed by GitHub
parent 385a9df4da
commit bb7cce6d7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
204 changed files with 1755 additions and 318 deletions

View file

@ -158,11 +158,11 @@ enabled:
- x-pack/test/api_integration/apis/cases/config.ts - x-pack/test/api_integration/apis/cases/config.ts
- x-pack/test/api_integration/apis/security/config.ts - x-pack/test/api_integration/apis/security/config.ts
- x-pack/test/banners_functional/config.ts - x-pack/test/banners_functional/config.ts
- x-pack/test/cases_api_integration/security_and_spaces/config_basic.ts - x-pack/platform/test/cases_api_integration/security_and_spaces/config_basic.ts
- x-pack/test/cases_api_integration/security_and_spaces/config_trial.ts - x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial.ts
- x-pack/test/cases_api_integration/security_and_spaces/config_trial_common.ts - x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial_common.ts
- x-pack/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts - x-pack/platform/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts
- x-pack/test/cases_api_integration/spaces_only/config.ts - x-pack/platform/test/cases_api_integration/spaces_only/config.ts
- x-pack/test/disable_ems/config.ts - x-pack/test/disable_ems/config.ts
- x-pack/test/examples/config.ts - x-pack/test/examples/config.ts
- x-pack/test/fleet_api_integration/config.agent.ts - x-pack/test/fleet_api_integration/config.agent.ts

View file

@ -123,3 +123,5 @@ enabled:
- x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group1/config.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group1/config.ts
- x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config.ts
- x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config_non_dedicated_task_runner.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config_non_dedicated_task_runner.ts
- x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial.ts
- x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial_common.ts

View file

@ -1806,7 +1806,8 @@ module.exports = {
'x-pack/platform/packages/shared/kbn-alerting-comparators/**/*.{ts, tsx}', 'x-pack/platform/packages/shared/kbn-alerting-comparators/**/*.{ts, tsx}',
'x-pack/platform/plugins/shared/embeddable_alerts_table/**/*.{ts,tsx}', 'x-pack/platform/plugins/shared/embeddable_alerts_table/**/*.{ts,tsx}',
'x-pack/platform/test/alerting_api_integration/**/*.{ts, tsx}', 'x-pack/platform/test/alerting_api_integration/**/*.{ts, tsx}',
'x-pack/test/cases_api_integration/**/*.{ts, tsx}', 'x-pack/platform/test/cases_api_integration/**/*.{ts, tsx}',
'x-pack/solutions/**/test/cases_api_integration/**/*.{ts, tsx}',
'x-pack/test/rule_registry/**/*.{ts, tsx}', 'x-pack/test/rule_registry/**/*.{ts, tsx}',
'x-pack/test/api_integration/apis/cases/**/*.{ts, tsx}', 'x-pack/test/api_integration/apis/cases/**/*.{ts, tsx}',
], ],

9
.github/CODEOWNERS vendored
View file

@ -977,6 +977,9 @@ x-pack/platform/test/alerting_api_integration/common/plugins/alerts_restricted @
x-pack/platform/test/alerting_api_integration/common/plugins/task_manager_fixture @elastic/response-ops x-pack/platform/test/alerting_api_integration/common/plugins/task_manager_fixture @elastic/response-ops
x-pack/platform/test/alerting_api_integration/packages/helpers @elastic/response-ops x-pack/platform/test/alerting_api_integration/packages/helpers @elastic/response-ops
x-pack/platform/test/api_integration/apis/entity_manager/fixture_plugin @elastic/obs-entities x-pack/platform/test/api_integration/apis/entity_manager/fixture_plugin @elastic/obs-entities
x-pack/platform/test/cases_api_integration/common/plugins/cases @elastic/response-ops
x-pack/platform/test/cases_api_integration/common/plugins/observability @elastic/response-ops
x-pack/platform/test/cases_api_integration/common/plugins/security_solution @elastic/response-ops
x-pack/platform/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin @elastic/kibana-security x-pack/platform/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin @elastic/kibana-security
x-pack/platform/test/plugin_api_integration/plugins/elasticsearch_client @elastic/kibana-core x-pack/platform/test/plugin_api_integration/plugins/elasticsearch_client @elastic/kibana-core
x-pack/platform/test/plugin_api_integration/plugins/event_log @elastic/response-ops x-pack/platform/test/plugin_api_integration/plugins/event_log @elastic/response-ops
@ -1095,9 +1098,6 @@ x-pack/solutions/security/plugins/session_view @elastic/kibana-cloud-security-po
x-pack/solutions/security/test x-pack/solutions/security/test
x-pack/test x-pack/test
x-pack/test_serverless x-pack/test_serverless
x-pack/test/cases_api_integration/common/plugins/cases @elastic/response-ops
x-pack/test/cases_api_integration/common/plugins/observability @elastic/response-ops
x-pack/test/cases_api_integration/common/plugins/security_solution @elastic/response-ops
x-pack/test/cloud_integration/plugins/saml_provider @elastic/kibana-core x-pack/test/cloud_integration/plugins/saml_provider @elastic/kibana-core
x-pack/test/functional_cors/plugins/kibana_cors_test @elastic/kibana-security x-pack/test/functional_cors/plugins/kibana_cors_test @elastic/kibana-security
x-pack/test/functional_embedded/plugins/iframe_embedded @elastic/kibana-core x-pack/test/functional_embedded/plugins/iframe_embedded @elastic/kibana-core
@ -2136,7 +2136,8 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi
/x-pack/platform/test/task_manager_claimer_update_by_query/ @elastic/response-ops /x-pack/platform/test/task_manager_claimer_update_by_query/ @elastic/response-ops
/docs/user/alerting/ @elastic/response-ops /docs/user/alerting/ @elastic/response-ops
/docs/management/connectors/ @elastic/response-ops /docs/management/connectors/ @elastic/response-ops
/x-pack/test/cases_api_integration/ @elastic/response-ops /x-pack/platform/test/cases_api_integration/ @elastic/response-ops
/x-pack/solutions/security/test/cases_api_integration/ @elastic/response-ops
/x-pack/test/functional/services/cases/ @elastic/response-ops @elastic/kibana-cases /x-pack/test/functional/services/cases/ @elastic/response-ops @elastic/kibana-cases
/x-pack/test/functional_with_es_ssl/apps/cases/ @elastic/response-ops @elastic/kibana-cases /x-pack/test/functional_with_es_ssl/apps/cases/ @elastic/response-ops @elastic/kibana-cases
/x-pack/test/api_integration/apis/cases/ @elastic/response-ops @elastic/kibana-cases /x-pack/test/api_integration/apis/cases/ @elastic/response-ops @elastic/kibana-cases

View file

@ -218,7 +218,7 @@
"@kbn/calculate-auto": "link:src/platform/packages/shared/kbn-calculate-auto", "@kbn/calculate-auto": "link:src/platform/packages/shared/kbn-calculate-auto",
"@kbn/calculate-width-from-char-count": "link:src/platform/packages/shared/kbn-calculate-width-from-char-count", "@kbn/calculate-width-from-char-count": "link:src/platform/packages/shared/kbn-calculate-width-from-char-count",
"@kbn/canvas-plugin": "link:x-pack/platform/plugins/private/canvas", "@kbn/canvas-plugin": "link:x-pack/platform/plugins/private/canvas",
"@kbn/cases-api-integration-test-plugin": "link:x-pack/test/cases_api_integration/common/plugins/cases", "@kbn/cases-api-integration-test-plugin": "link:x-pack/platform/test/cases_api_integration/common/plugins/cases",
"@kbn/cases-components": "link:src/platform/packages/shared/kbn-cases-components", "@kbn/cases-components": "link:src/platform/packages/shared/kbn-cases-components",
"@kbn/cases-plugin": "link:x-pack/platform/plugins/shared/cases", "@kbn/cases-plugin": "link:x-pack/platform/plugins/shared/cases",
"@kbn/cbor": "link:src/platform/packages/shared/kbn-cbor", "@kbn/cbor": "link:src/platform/packages/shared/kbn-cbor",
@ -727,7 +727,7 @@
"@kbn/observability-ai-server": "link:x-pack/solutions/observability/packages/observability-ai/observability-ai-server", "@kbn/observability-ai-server": "link:x-pack/solutions/observability/packages/observability-ai/observability-ai-server",
"@kbn/observability-alert-details": "link:x-pack/solutions/observability/packages/alert-details", "@kbn/observability-alert-details": "link:x-pack/solutions/observability/packages/alert-details",
"@kbn/observability-alerting-test-data": "link:x-pack/solutions/observability/packages/alerting-test-data", "@kbn/observability-alerting-test-data": "link:x-pack/solutions/observability/packages/alerting-test-data",
"@kbn/observability-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/observability", "@kbn/observability-fixtures-plugin": "link:x-pack/platform/test/cases_api_integration/common/plugins/observability",
"@kbn/observability-get-padded-alert-time-range-util": "link:x-pack/solutions/observability/packages/get-padded-alert-time-range-util", "@kbn/observability-get-padded-alert-time-range-util": "link:x-pack/solutions/observability/packages/get-padded-alert-time-range-util",
"@kbn/observability-logs-explorer-plugin": "link:x-pack/solutions/observability/plugins/observability_logs_explorer", "@kbn/observability-logs-explorer-plugin": "link:x-pack/solutions/observability/plugins/observability_logs_explorer",
"@kbn/observability-onboarding-plugin": "link:x-pack/solutions/observability/plugins/observability_onboarding", "@kbn/observability-onboarding-plugin": "link:x-pack/solutions/observability/plugins/observability_onboarding",
@ -873,7 +873,7 @@
"@kbn/security-solution-distribution-bar": "link:x-pack/solutions/security/packages/distribution-bar", "@kbn/security-solution-distribution-bar": "link:x-pack/solutions/security/packages/distribution-bar",
"@kbn/security-solution-ess": "link:x-pack/solutions/security/plugins/security_solution_ess", "@kbn/security-solution-ess": "link:x-pack/solutions/security/plugins/security_solution_ess",
"@kbn/security-solution-features": "link:x-pack/solutions/security/packages/features", "@kbn/security-solution-features": "link:x-pack/solutions/security/packages/features",
"@kbn/security-solution-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/security_solution", "@kbn/security-solution-fixtures-plugin": "link:x-pack/platform/test/cases_api_integration/common/plugins/security_solution",
"@kbn/security-solution-navigation": "link:x-pack/solutions/security/packages/navigation", "@kbn/security-solution-navigation": "link:x-pack/solutions/security/packages/navigation",
"@kbn/security-solution-plugin": "link:x-pack/solutions/security/plugins/security_solution", "@kbn/security-solution-plugin": "link:x-pack/solutions/security/plugins/security_solution",
"@kbn/security-solution-serverless": "link:x-pack/solutions/security/plugins/security_solution_serverless", "@kbn/security-solution-serverless": "link:x-pack/solutions/security/plugins/security_solution_serverless",

View file

@ -138,8 +138,8 @@
"@kbn/canvas-plugin/*": ["x-pack/platform/plugins/private/canvas/*"], "@kbn/canvas-plugin/*": ["x-pack/platform/plugins/private/canvas/*"],
"@kbn/capture-oas-snapshot-cli": ["packages/kbn-capture-oas-snapshot-cli"], "@kbn/capture-oas-snapshot-cli": ["packages/kbn-capture-oas-snapshot-cli"],
"@kbn/capture-oas-snapshot-cli/*": ["packages/kbn-capture-oas-snapshot-cli/*"], "@kbn/capture-oas-snapshot-cli/*": ["packages/kbn-capture-oas-snapshot-cli/*"],
"@kbn/cases-api-integration-test-plugin": ["x-pack/test/cases_api_integration/common/plugins/cases"], "@kbn/cases-api-integration-test-plugin": ["x-pack/platform/test/cases_api_integration/common/plugins/cases"],
"@kbn/cases-api-integration-test-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/cases/*"], "@kbn/cases-api-integration-test-plugin/*": ["x-pack/platform/test/cases_api_integration/common/plugins/cases/*"],
"@kbn/cases-components": ["src/platform/packages/shared/kbn-cases-components"], "@kbn/cases-components": ["src/platform/packages/shared/kbn-cases-components"],
"@kbn/cases-components/*": ["src/platform/packages/shared/kbn-cases-components/*"], "@kbn/cases-components/*": ["src/platform/packages/shared/kbn-cases-components/*"],
"@kbn/cases-plugin": ["x-pack/platform/plugins/shared/cases"], "@kbn/cases-plugin": ["x-pack/platform/plugins/shared/cases"],
@ -1380,8 +1380,8 @@
"@kbn/observability-alert-details/*": ["x-pack/solutions/observability/packages/alert-details/*"], "@kbn/observability-alert-details/*": ["x-pack/solutions/observability/packages/alert-details/*"],
"@kbn/observability-alerting-test-data": ["x-pack/solutions/observability/packages/alerting-test-data"], "@kbn/observability-alerting-test-data": ["x-pack/solutions/observability/packages/alerting-test-data"],
"@kbn/observability-alerting-test-data/*": ["x-pack/solutions/observability/packages/alerting-test-data/*"], "@kbn/observability-alerting-test-data/*": ["x-pack/solutions/observability/packages/alerting-test-data/*"],
"@kbn/observability-fixtures-plugin": ["x-pack/test/cases_api_integration/common/plugins/observability"], "@kbn/observability-fixtures-plugin": ["x-pack/platform/test/cases_api_integration/common/plugins/observability"],
"@kbn/observability-fixtures-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/observability/*"], "@kbn/observability-fixtures-plugin/*": ["x-pack/platform/test/cases_api_integration/common/plugins/observability/*"],
"@kbn/observability-get-padded-alert-time-range-util": ["x-pack/solutions/observability/packages/get-padded-alert-time-range-util"], "@kbn/observability-get-padded-alert-time-range-util": ["x-pack/solutions/observability/packages/get-padded-alert-time-range-util"],
"@kbn/observability-get-padded-alert-time-range-util/*": ["x-pack/solutions/observability/packages/get-padded-alert-time-range-util/*"], "@kbn/observability-get-padded-alert-time-range-util/*": ["x-pack/solutions/observability/packages/get-padded-alert-time-range-util/*"],
"@kbn/observability-logs-explorer-plugin": ["x-pack/solutions/observability/plugins/observability_logs_explorer"], "@kbn/observability-logs-explorer-plugin": ["x-pack/solutions/observability/plugins/observability_logs_explorer"],
@ -1726,8 +1726,8 @@
"@kbn/security-solution-ess/*": ["x-pack/solutions/security/plugins/security_solution_ess/*"], "@kbn/security-solution-ess/*": ["x-pack/solutions/security/plugins/security_solution_ess/*"],
"@kbn/security-solution-features": ["x-pack/solutions/security/packages/features"], "@kbn/security-solution-features": ["x-pack/solutions/security/packages/features"],
"@kbn/security-solution-features/*": ["x-pack/solutions/security/packages/features/*"], "@kbn/security-solution-features/*": ["x-pack/solutions/security/packages/features/*"],
"@kbn/security-solution-fixtures-plugin": ["x-pack/test/cases_api_integration/common/plugins/security_solution"], "@kbn/security-solution-fixtures-plugin": ["x-pack/platform/test/cases_api_integration/common/plugins/security_solution"],
"@kbn/security-solution-fixtures-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/security_solution/*"], "@kbn/security-solution-fixtures-plugin/*": ["x-pack/platform/test/cases_api_integration/common/plugins/security_solution/*"],
"@kbn/security-solution-navigation": ["x-pack/solutions/security/packages/navigation"], "@kbn/security-solution-navigation": ["x-pack/solutions/security/packages/navigation"],
"@kbn/security-solution-navigation/*": ["x-pack/solutions/security/packages/navigation/*"], "@kbn/security-solution-navigation/*": ["x-pack/solutions/security/packages/navigation/*"],
"@kbn/security-solution-plugin": ["x-pack/solutions/security/plugins/security_solution"], "@kbn/security-solution-plugin": ["x-pack/solutions/security/plugins/security_solution"],

View file

@ -34,7 +34,7 @@ export const CASE_ID_INCREMENTER_SAVED_OBJECT = 'cases-incrementing-id' as const
export const CASES_UI_SETTING_ID_DISPLAY_INCREMENTAL_ID = 'cases:incrementalIdDisplay:enabled'; export const CASES_UI_SETTING_ID_DISPLAY_INCREMENTAL_ID = 'cases:incrementalIdDisplay:enabled';
/** /**
* If more values are added here please also add them here: x-pack/test/cases_api_integration/common/plugins * If more values are added here please also add them here: x-pack/platform/test/cases_api_integration/common/plugins
*/ */
export const SAVED_OBJECT_TYPES = [ export const SAVED_OBJECT_TYPES = [
CASE_SAVED_OBJECT, CASE_SAVED_OBJECT,

View file

@ -12,7 +12,7 @@ import type { FtrConfigProviderContext } from '@kbn/test';
import { findTestPluginPaths } from '@kbn/test'; import { findTestPluginPaths } from '@kbn/test';
import { ScoutTestRunConfigCategory } from '@kbn/scout-info'; import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import { getAllExternalServiceSimulatorPaths } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib/actions_simulations_utils'; import { getAllExternalServiceSimulatorPaths } from '../../alerting_api_integration/common/lib/actions_simulations_utils';
import { services } from './services'; import { services } from './services';
interface CreateTestConfigOptions { interface CreateTestConfigOptions {
@ -93,10 +93,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
.map((key) => `--xpack.${key}.enabled=false`), .map((key) => `--xpack.${key}.enabled=false`),
...findTestPluginPaths([ ...findTestPluginPaths([
path.resolve(__dirname, 'plugins'), path.resolve(__dirname, 'plugins'),
path.resolve( path.resolve(__dirname, '../../alerting_api_integration/common/plugins'),
__dirname,
'../../../platform/test/alerting_api_integration/common/plugins'
),
]), ]),
`--xpack.actions.preconfigured=${JSON.stringify({ `--xpack.actions.preconfigured=${JSON.stringify({
'preconfigured-servicenow': { 'preconfigured-servicenow': {

View file

@ -7,22 +7,9 @@
import expect from '@kbn/expect'; import expect from '@kbn/expect';
import type SuperTest from 'supertest'; import type SuperTest from 'supertest';
import type { estypes } from '@elastic/elasticsearch';
import type { ToolingLog } from '@kbn/tooling-log';
import { DETECTION_ENGINE_QUERY_SIGNALS_URL } from '@kbn/security-solution-plugin/common/constants';
import type { DetectionAlert } from '@kbn/security-solution-plugin/common/api/detection_engine';
import type { RiskEnrichmentFields } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/enrichments/types';
import type { Case } from '@kbn/cases-plugin/common'; import type { Case } from '@kbn/cases-plugin/common';
import { AttachmentType } from '@kbn/cases-plugin/common'; import { AttachmentType } from '@kbn/cases-plugin/common';
import { ALERT_CASE_IDS } from '@kbn/rule-data-utils'; import { ALERT_CASE_IDS } from '@kbn/rule-data-utils';
import {
getRuleForAlertTesting,
createRule,
waitForRuleSuccess,
waitForAlertsToBePresent,
getAlertsByIds,
getQueryAlertIds,
} from '../../../common/utils/security_solution';
import { superUser } from './authentication/users'; import { superUser } from './authentication/users';
import type { User } from './authentication/types'; import type { User } from './authentication/types';
import { getSpaceUrlPrefix } from './api/helpers'; import { getSpaceUrlPrefix } from './api/helpers';
@ -30,36 +17,6 @@ import { createCase, deleteCases } from './api/case';
import { createComment, deleteAllComments } from './api'; import { createComment, deleteAllComments } from './api';
import { postCaseReq } from './mock'; import { postCaseReq } from './mock';
export const createSecuritySolutionAlerts = async (
supertest: SuperTest.Agent,
log: ToolingLog,
numberOfSignals: number = 1
): Promise<estypes.SearchResponse<DetectionAlert & RiskEnrichmentFields>> => {
const rule = {
...getRuleForAlertTesting(['auditbeat-*']),
query: 'process.executable: "/usr/bin/sudo"',
};
const { id } = await createRule(supertest, log, rule);
await waitForRuleSuccess({ supertest, log, id });
await waitForAlertsToBePresent(supertest, log, numberOfSignals, [id]);
const signals = await getAlertsByIds(supertest, log, [id]);
return signals;
};
export const getSecuritySolutionAlerts = async (
supertest: SuperTest.Agent,
alertIds: string[]
): Promise<estypes.SearchResponse<DetectionAlert & RiskEnrichmentFields>> => {
const { body: updatedAlert } = await supertest
.post(DETECTION_ENGINE_QUERY_SIGNALS_URL)
.set('kbn-xsrf', 'true')
.send(getQueryAlertIds(alertIds))
.expect(200);
return updatedAlert;
};
interface AlertResponse { interface AlertResponse {
'kibana.alert.case_ids'?: string[]; 'kibana.alert.case_ids'?: string[];
} }

View file

@ -13,12 +13,10 @@ import type {
CasesPatchRequest, CasesPatchRequest,
} from '@kbn/cases-plugin/common/types/api'; } from '@kbn/cases-plugin/common/types/api';
import type SuperTest from 'supertest'; import type SuperTest from 'supertest';
import type { ToolingLog } from '@kbn/tooling-log';
import type { User } from '../authentication/types'; import type { User } from '../authentication/types';
import { superUser } from '../authentication/users'; import { superUser } from '../authentication/users';
import { getSpaceUrlPrefix, setupAuth } from './helpers'; import { getSpaceUrlPrefix, setupAuth } from './helpers';
import { waitFor } from '../../../../common/utils/security_solution/detections_response';
export const createCase = async ( export const createCase = async (
supertest: SuperTest.Agent, supertest: SuperTest.Agent,
@ -41,18 +39,6 @@ export const createCase = async (
return theCase; return theCase;
}; };
export const waitForCases = async (supertest: SuperTest.Agent, log: ToolingLog): Promise<void> => {
await waitFor(
async () => {
const response = await getCases(supertest);
const cases = response;
return cases != null && cases.cases.length > 0 && cases?.cases[0]?.totalAlerts > 0;
},
'waitForCaseToAttachAlert',
log
);
};
export const getCases = async ( export const getCases = async (
supertest: SuperTest.Agent, supertest: SuperTest.Agent,
expectedHttpCode: number = 200, expectedHttpCode: number = 200,

View file

@ -16,10 +16,6 @@ import type {
ActionTypeExecutorResult, ActionTypeExecutorResult,
FindActionResult, FindActionResult,
} from '@kbn/actions-plugin/server/types'; } from '@kbn/actions-plugin/server/types';
import {
getServiceNowServer,
RecordingServiceNowSimulator,
} from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib/actions_simulations_utils';
import type { import type {
Case, Case,
CaseConnector, CaseConnector,
@ -31,7 +27,11 @@ import type {
GetCaseConnectorsResponse, GetCaseConnectorsResponse,
} from '@kbn/cases-plugin/common/types/api'; } from '@kbn/cases-plugin/common/types/api';
import { camelCase, mapKeys } from 'lodash'; import { camelCase, mapKeys } from 'lodash';
import type { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; import {
getServiceNowServer,
RecordingServiceNowSimulator,
} from '../../../../alerting_api_integration/common/lib/actions_simulations_utils';
import type { ObjectRemover as ActionsRemover } from '../../../../alerting_api_integration/common/lib';
import type { User } from '../authentication/types'; import type { User } from '../authentication/types';
import { superUser } from '../authentication/users'; import { superUser } from '../authentication/users';
import { getPostCaseRequest } from '../mock'; import { getPostCaseRequest } from '../mock';

View file

@ -28,7 +28,6 @@ import {
} from '@kbn/cases-plugin/common/constants'; } from '@kbn/cases-plugin/common/constants';
import type { CaseMetricsFeature } from '@kbn/cases-plugin/common'; import type { CaseMetricsFeature } from '@kbn/cases-plugin/common';
import type { SingleCaseMetricsResponse, CasesMetricsResponse } from '@kbn/cases-plugin/common'; import type { SingleCaseMetricsResponse, CasesMetricsResponse } from '@kbn/cases-plugin/common';
import type { SignalHit } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/types';
import type { CasePersistedAttributes } from '@kbn/cases-plugin/server/common/types/case'; import type { CasePersistedAttributes } from '@kbn/cases-plugin/server/common/types/case';
import type { SavedObjectsRawDocSource } from '@kbn/core/server'; import type { SavedObjectsRawDocSource } from '@kbn/core/server';
import type { ConfigurationPersistedAttributes } from '@kbn/cases-plugin/server/common/types/configure'; import type { ConfigurationPersistedAttributes } from '@kbn/cases-plugin/server/common/types/configure';
@ -76,57 +75,6 @@ export * from './telemetry';
export { getSpaceUrlPrefix } from './helpers'; export { getSpaceUrlPrefix } from './helpers';
function toArray<T>(input: T | T[]): T[] {
if (Array.isArray(input)) {
return input;
}
return [input];
}
/**
* Query Elasticsearch for a set of signals within a set of indices
*/
// TODO: fix this to use new API/schema
export const getSignalsWithES = async ({
es,
indices,
ids,
}: {
es: Client;
indices: string | string[];
ids: string | string[];
}): Promise<Map<string, Map<string, estypes.SearchHit<SignalHit>>>> => {
const signals: TransportResult<estypes.SearchResponse<SignalHit>, unknown> = await es.search(
{
index: indices,
size: 10000,
query: {
bool: {
filter: [
{
ids: {
values: toArray(ids),
},
},
],
},
},
},
{ meta: true }
);
return signals.body.hits.hits.reduce((acc, hit) => {
let indexMap = acc.get(hit._index);
if (indexMap === undefined) {
indexMap = new Map<string, estypes.SearchHit<SignalHit>>([[hit._id!, hit]]);
} else {
indexMap.set(hit._id!, hit);
}
acc.set(hit._index, indexMap);
return acc;
}, new Map<string, Map<string, estypes.SearchHit<SignalHit>>>());
};
interface SetStatusCasesParams { interface SetStatusCasesParams {
id: string; id: string;
version: string; version: string;

View file

@ -1,5 +1,5 @@
{ {
"extends": "../../../../../../tsconfig.base.json", "extends": "../../../../../../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"outDir": "target/types", "outDir": "target/types",
"isolatedModules": true "isolatedModules": true

View file

@ -1,5 +1,5 @@
{ {
"extends": "../../../../../../tsconfig.base.json", "extends": "../../../../../../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"outDir": "target/types", "outDir": "target/types",
"isolatedModules": true "isolatedModules": true

View file

@ -1,5 +1,5 @@
{ {
"extends": "../../../../../../tsconfig.base.json", "extends": "../../../../../../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"outDir": "target/types", "outDir": "target/types",
"isolatedModules": true "isolatedModules": true

View file

@ -0,0 +1,951 @@
/*
* 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 type { Role } from './lib/authentication/types';
/**
* Roles for Cases in Security Solution
*/
export const secAllCasesOnlyDelete: Role = {
name: 'sec_all_cases_only_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCases: ['cases_delete'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secAllCasesOnlyReadDelete: Role = {
name: 'sec_all_cases_only_read_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCases: ['read', 'cases_delete'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secAllCasesNoDelete: Role = {
name: 'sec_all_cases_no_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCases: ['minimal_all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secAll: Role = {
name: 'sec_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCases: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secCasesV2All: Role = {
name: 'sec_cases_v2_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCasesV2: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secCasesV3All: Role = {
name: 'sec_cases_v3_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCasesV3: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secCasesV2NoReopenWithCreateComment: Role = {
name: 'sec_cases_v2_no_reopen_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCasesV2: ['read', 'update', 'create', 'cases_delete', 'create_comment'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secCasesV2NoCreateCommentWithReopen: Role = {
name: 'sec_cases_v2_create_comment_no_reopen_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCasesV2: ['read', 'update', 'create', 'delete', 'case_reopen'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secAllSpace1: Role = {
name: 'sec_all_role_space1_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCases: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['space1'],
},
],
},
};
export const secAllCasesRead: Role = {
name: 'sec_all_cases_read_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
securitySolutionCases: ['read'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secAllCasesNone: Role = {
name: 'sec_all_cases_none_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secReadCasesAll: Role = {
name: 'sec_read_cases_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['read'],
securitySolutionCases: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secReadCasesRead: Role = {
name: 'sec_read_cases_read_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['read'],
securitySolutionCases: ['read'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secRead: Role = {
name: 'sec_read_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['read'],
securitySolutionCases: ['read'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secReadCasesNone: Role = {
name: 'sec_read_cases_none_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: ['read'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const secNone: Role = {
name: 'sec_none_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
siem: [],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
/**
* Roles for Cases in the stack
*/
export const casesOnlyDelete: Role = {
name: 'cases_only_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
generalCases: ['cases_delete'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const casesOnlyReadDelete: Role = {
name: 'cases_only_read_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
generalCases: ['read', 'cases_delete'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const casesNoDelete: Role = {
name: 'cases_no_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
generalCases: ['minimal_all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const casesAll: Role = {
name: 'cases_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
generalCases: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const casesV2All: Role = {
name: 'cases_v2_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
generalCasesV2: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const casesV3All: Role = {
name: 'cases_v3_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
generalCasesV3: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const casesV3NoAssignee: Role = {
name: 'cases_v3_no_assignee_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
generalCasesV3: ['minimal_read', 'cases_delete', 'case_reopen', 'create_comment'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const casesV3ReadAndAssignee: Role = {
name: 'cases_v3_read_assignee_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
generalCasesV3: ['minimal_read', 'cases_assign'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const casesV2NoReopenWithCreateComment: Role = {
name: 'cases_v2_no_reopen_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
generalCasesV2: ['read', 'update', 'create', 'cases_delete', 'create_comment'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const casesV2NoCreateCommentWithReopen: Role = {
name: 'cases_v2_no_create_comment_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
generalCasesV2: ['read', 'update', 'create', 'cases_delete', 'case_reopen'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const casesRead: Role = {
name: 'cases_read_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
generalCases: ['read'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
/**
* Roles for Cases in Observability
*/
export const obsCasesOnlyDelete: Role = {
name: 'obs_cases_only_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
observabilityCases: ['cases_delete'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const obsCasesOnlyReadDelete: Role = {
name: 'obs_cases_only_read_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
observabilityCases: ['read', 'cases_delete'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const obsCasesNoDelete: Role = {
name: 'obs_cases_no_delete_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
observabilityCases: ['minimal_all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const obsCasesAll: Role = {
name: 'obs_cases_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
observabilityCases: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const obsCasesV2All: Role = {
name: 'obs_cases_v2_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
observabilityCasesV2: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const obsCasesV3All: Role = {
name: 'obs_cases_v3_all_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
observabilityCasesV3: ['all'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const obsCasesV2NoReopenWithCreateComment: Role = {
name: 'obs_cases_v2_no_reopen_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
observabilityCasesV2: [
'read',
'cases_update',
'create',
'cases_delete',
'create_comment',
],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const obsCasesV2NoCreateCommentWithReopen: Role = {
name: 'obs_cases_v2_no_create_comment_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
spaces: ['*'],
base: [],
feature: {
observabilityCasesV2: ['read', 'update', 'create', 'cases_delete', 'case_reopen'],
actions: ['all'],
actionsSimulators: ['all'],
},
},
],
},
};
export const obsCasesRead: Role = {
name: 'obs_cases_read_role_api_int',
privileges: {
elasticsearch: {
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [
{
feature: {
observabilityCases: ['read'],
actions: ['all'],
actionsSimulators: ['all'],
},
spaces: ['*'],
},
],
},
};
export const roles = [
secAllCasesOnlyDelete,
secAllCasesOnlyReadDelete,
secAllCasesNoDelete,
secAll,
secCasesV2All,
secCasesV3All,
secCasesV2NoReopenWithCreateComment,
secCasesV2NoCreateCommentWithReopen,
secAllSpace1,
secAllCasesRead,
secAllCasesNone,
secReadCasesAll,
secReadCasesRead,
secReadCasesNone,
secRead,
casesOnlyDelete,
casesOnlyReadDelete,
casesNoDelete,
casesAll,
casesV2All,
casesV3All,
casesV3NoAssignee,
casesV3ReadAndAssignee,
casesV2NoReopenWithCreateComment,
casesV2NoCreateCommentWithReopen,
casesRead,
obsCasesOnlyDelete,
obsCasesOnlyReadDelete,
obsCasesNoDelete,
obsCasesAll,
obsCasesV2All,
obsCasesV3All,
obsCasesV2NoReopenWithCreateComment,
obsCasesV2NoCreateCommentWithReopen,
obsCasesRead,
];

View file

@ -0,0 +1,331 @@
/*
* 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 type { User } from './lib/authentication/types';
import {
casesAll,
casesV2All,
casesV3All,
casesV3NoAssignee,
casesV3ReadAndAssignee,
casesNoDelete,
casesOnlyDelete,
casesOnlyReadDelete,
casesRead,
obsCasesAll,
obsCasesV2All,
obsCasesV3All,
obsCasesNoDelete,
obsCasesOnlyDelete,
obsCasesOnlyReadDelete,
obsCasesRead,
secAll,
secCasesV2All,
secCasesV3All,
secAllCasesNoDelete,
secAllCasesNone,
secAllCasesOnlyDelete,
secAllCasesOnlyReadDelete,
secAllCasesRead,
secAllSpace1,
secRead,
secReadCasesAll,
secReadCasesNone,
secReadCasesRead,
secNone,
casesV2NoReopenWithCreateComment,
obsCasesV2NoReopenWithCreateComment,
secCasesV2NoReopenWithCreateComment,
secCasesV2NoCreateCommentWithReopen,
casesV2NoCreateCommentWithReopen,
obsCasesV2NoCreateCommentWithReopen,
} from './roles';
/**
* Users for Cases in Security Solution
*/
export const secAllCasesOnlyDeleteUser: User = {
username: 'sec_all_cases_only_delete_user_api_int',
password: 'password',
roles: [secAllCasesOnlyDelete.name],
};
export const secAllCasesOnlyReadDeleteUser: User = {
username: 'sec_all_cases_only_read_delete_user_api_int',
password: 'password',
roles: [secAllCasesOnlyReadDelete.name],
};
export const secAllCasesNoDeleteUser: User = {
username: 'sec_all_cases_no_delete_user_api_int',
password: 'password',
roles: [secAllCasesNoDelete.name],
};
export const secAllUser: User = {
username: 'sec_all_user_api_int',
password: 'password',
roles: [secAll.name],
};
export const secCasesV2AllUser: User = {
username: 'sec_cases_v2_all_user_api_int',
password: 'password',
roles: [secCasesV2All.name],
};
export const secCasesV3AllUser: User = {
username: 'sec_cases_v3_all_user_api_int',
password: 'password',
roles: [secCasesV3All.name],
};
export const secCasesV2NoReopenWithCreateCommentUser: User = {
username: 'sec_cases_v2_no_reopen_with_create_comment_user_api_int',
password: 'password',
roles: [secCasesV2NoReopenWithCreateComment.name],
};
export const secCasesV2NoCreateCommentWithReopenUser: User = {
username: 'sec_cases_v2_no_create_comment_with_reopen_user_api_int',
password: 'password',
roles: [secCasesV2NoCreateCommentWithReopen.name],
};
export const secAllSpace1User: User = {
username: 'sec_all_space1_user_api_int',
password: 'password',
roles: [secAllSpace1.name],
};
export const secAllCasesReadUser: User = {
username: 'sec_all_cases_read_user_api_int',
password: 'password',
roles: [secAllCasesRead.name],
};
export const secAllCasesNoneUser: User = {
username: 'sec_all_cases_none_user_api_int',
password: 'password',
roles: [secAllCasesNone.name],
};
export const secReadCasesAllUser: User = {
username: 'sec_read_cases_all_user_api_int',
password: 'password',
roles: [secReadCasesAll.name],
};
export const secReadCasesReadUser: User = {
username: 'sec_read_cases_read_user_api_int',
password: 'password',
roles: [secReadCasesRead.name],
};
export const secReadUser: User = {
username: 'sec_read_user_api_int',
password: 'password',
roles: [secRead.name],
};
export const secNoneUser: User = {
username: 'sec_none_user_api_int',
password: 'password',
roles: [secNone.name],
};
export const secReadCasesNoneUser: User = {
username: 'sec_read_cases_none_user_api_int',
password: 'password',
roles: [secReadCasesNone.name],
};
/**
* Users for Cases in the Stack
*/
export const casesOnlyDeleteUser: User = {
username: 'cases_only_delete_user_api_int',
password: 'password',
roles: [casesOnlyDelete.name],
};
export const casesOnlyReadDeleteUser: User = {
username: 'cases_only_read_delete_user_api_int',
password: 'password',
roles: [casesOnlyReadDelete.name],
};
export const casesNoDeleteUser: User = {
username: 'cases_no_delete_user_api_int',
password: 'password',
roles: [casesNoDelete.name],
};
export const casesAllUser: User = {
username: 'cases_all_user_api_int',
password: 'password',
roles: [casesAll.name],
};
export const casesV2AllUser: User = {
username: 'cases_v2_all_user_api_int',
password: 'password',
roles: [casesV2All.name],
};
export const casesV3AllUser: User = {
username: 'cases_v3_all_user_api_int',
password: 'password',
roles: [casesV3All.name],
};
export const casesV3NoAssigneeUser: User = {
username: 'cases_v3_no_assignee_user_api_int',
password: 'password',
roles: [casesV3NoAssignee.name],
};
export const casesV3ReadAndAssignUser: User = {
username: 'cases_v3_read_and_assignee_user_api_int',
password: 'password',
roles: [casesV3ReadAndAssignee.name],
};
export const casesV2NoReopenWithCreateCommentUser: User = {
username: 'cases_v2_no_reopen_with_create_comment_user_api_int',
password: 'password',
roles: [casesV2NoReopenWithCreateComment.name],
};
export const casesV2NoCreateCommentWithReopenUser: User = {
username: 'cases_v2_no_create_comment_with_reopen_user_api_int',
password: 'password',
roles: [casesV2NoCreateCommentWithReopen.name],
};
export const casesReadUser: User = {
username: 'cases_read_user_api_int',
password: 'password',
roles: [casesRead.name],
};
/**
* Users for Cases in Observability
*/
export const obsCasesOnlyDeleteUser: User = {
username: 'obs_cases_only_delete_user_api_int',
password: 'password',
roles: [obsCasesOnlyDelete.name],
};
export const obsCasesOnlyReadDeleteUser: User = {
username: 'obs_cases_only_read_delete_user_api_int',
password: 'password',
roles: [obsCasesOnlyReadDelete.name],
};
export const obsCasesNoDeleteUser: User = {
username: 'obs_cases_no_delete_user_api_int',
password: 'password',
roles: [obsCasesNoDelete.name],
};
export const obsCasesAllUser: User = {
username: 'obs_cases_all_user_api_int',
password: 'password',
roles: [obsCasesAll.name],
};
export const obsCasesV2AllUser: User = {
username: 'obs_cases_v2_all_user_api_int',
password: 'password',
roles: [obsCasesV2All.name],
};
export const obsCasesV3AllUser: User = {
username: 'obs_cases_v3_all_user_api_int',
password: 'password',
roles: [obsCasesV3All.name],
};
export const obsCasesV2NoReopenWithCreateCommentUser: User = {
username: 'obs_cases_v2_no_reopen_with_create_comment_user_api_int',
password: 'password',
roles: [obsCasesV2NoReopenWithCreateComment.name],
};
export const obsCasesV2NoCreateCommentWithReopenUser: User = {
username: 'obs_cases_v2_no_create_comment_with_reopen_user_api_int',
password: 'password',
roles: [obsCasesV2NoCreateCommentWithReopen.name],
};
export const obsCasesReadUser: User = {
username: 'obs_cases_read_user_api_int',
password: 'password',
roles: [obsCasesRead.name],
};
/**
* Users for Observability and Security Solution
*/
export const obsSecCasesAllUser: User = {
username: 'obs_sec_cases_all_user_api_int',
password: 'password',
roles: [obsCasesAll.name, secAll.name],
};
export const obsSecCasesReadUser: User = {
username: 'obs_sec_cases_read_user_api_int',
password: 'password',
roles: [obsCasesRead.name, secRead.name],
};
export const users = [
secAllCasesOnlyDeleteUser,
secAllCasesOnlyReadDeleteUser,
secAllCasesNoDeleteUser,
secAllUser,
secCasesV2AllUser,
secCasesV3AllUser,
secCasesV2NoReopenWithCreateCommentUser,
secCasesV2NoCreateCommentWithReopenUser,
secAllSpace1User,
secAllCasesReadUser,
secAllCasesNoneUser,
secReadCasesAllUser,
secReadCasesReadUser,
secReadUser,
secNoneUser,
secReadCasesNoneUser,
casesOnlyDeleteUser,
casesOnlyReadDeleteUser,
casesNoDeleteUser,
casesAllUser,
casesV2AllUser,
casesV3AllUser,
casesV3NoAssigneeUser,
casesV3ReadAndAssignUser,
casesV2NoReopenWithCreateCommentUser,
casesV2NoCreateCommentWithReopenUser,
casesReadUser,
obsCasesOnlyDeleteUser,
obsCasesOnlyReadDeleteUser,
obsCasesNoDeleteUser,
obsCasesAllUser,
obsCasesV2AllUser,
obsCasesV3AllUser,
obsCasesV2NoReopenWithCreateCommentUser,
obsCasesV2NoCreateCommentWithReopenUser,
obsCasesReadUser,
obsSecCasesAllUser,
obsSecCasesReadUser,
];

View file

@ -15,7 +15,7 @@ export default ({ getService }: FtrProviderContext): void => {
/** /**
* Attachment types are being registered in * Attachment types are being registered in
* x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts * x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts
*/ */
describe('Persistable state attachments', () => { describe('Persistable state attachments', () => {
// This test is intended to fail when new persistable state attachment types are registered. // This test is intended to fail when new persistable state attachment types are registered.

View file

@ -17,7 +17,7 @@ export default ({ getService }: FtrProviderContext): void => {
describe('get_connectors', () => { describe('get_connectors', () => {
/** /**
* A ServiceNow preconfigured connector is registered here * A ServiceNow preconfigured connector is registered here
* x-pack/test/cases_api_integration/common/config.ts * x-pack/platform/test/cases_api_integration/common/config.ts
* *
* The license for this test is set to basic. ServiceNow connectors * The license for this test is set to basic. ServiceNow connectors
* needs license >= platinum. The test below ensures * needs license >= platinum. The test below ensures

View file

@ -41,7 +41,7 @@ export default ({ getService }: FtrProviderContext): void => {
/** /**
* Attachment types are being registered in * Attachment types are being registered in
* x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts * x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts
*/ */
describe('External references', () => { describe('External references', () => {
afterEach(async () => { afterEach(async () => {

View file

@ -39,7 +39,7 @@ export default ({ getService }: FtrProviderContext): void => {
/** /**
* Attachment types are being registered in * Attachment types are being registered in
* x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts * x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts
*/ */
describe('Persistable state attachments', () => { describe('Persistable state attachments', () => {
describe('references', () => { describe('references', () => {

View file

@ -44,7 +44,7 @@ export default ({ getService }: FtrProviderContext): void => {
* is to test the bulkCreate method of the cases client in * is to test the bulkCreate method of the cases client in
* x-pack/platform/plugins/shared/cases/server/client/cases/bulk_create.ts * x-pack/platform/plugins/shared/cases/server/client/cases/bulk_create.ts
* *
* The test route is configured here x-pack/test/cases_api_integration/common/plugins/cases/server/routes.ts * The test route is configured here x-pack/platform/test/cases_api_integration/common/plugins/cases/server/routes.ts
*/ */
describe('bulk_create_cases', () => { describe('bulk_create_cases', () => {
const bulkCreateCases = async ({ const bulkCreateCases = async ({

View file

@ -31,7 +31,7 @@ import type {
PushedUserAction, PushedUserAction,
} from '@kbn/cases-plugin/common/types/domain'; } from '@kbn/cases-plugin/common/types/domain';
import type { CasePostRequest } from '@kbn/cases-plugin/common'; import type { CasePostRequest } from '@kbn/cases-plugin/common';
import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib';
import { import {
deleteAllCaseItems, deleteAllCaseItems,
createCase, createCase,

View file

@ -12,7 +12,7 @@ import {
CustomFieldTypes, CustomFieldTypes,
} from '@kbn/cases-plugin/common/types/domain'; } from '@kbn/cases-plugin/common/types/domain';
import type { ConfigurationPatchRequest } from '@kbn/cases-plugin/common/types/api'; import type { ConfigurationPatchRequest } from '@kbn/cases-plugin/common/types/api';
import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib';
import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context';
import { import {

View file

@ -12,7 +12,7 @@ import {
CustomFieldTypes, CustomFieldTypes,
} from '@kbn/cases-plugin/common/types/domain'; } from '@kbn/cases-plugin/common/types/domain';
import { MAX_CUSTOM_FIELD_LABEL_LENGTH } from '@kbn/cases-plugin/common/constants'; import { MAX_CUSTOM_FIELD_LABEL_LENGTH } from '@kbn/cases-plugin/common/constants';
import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib';
import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context';
import { import {

View file

@ -13,21 +13,15 @@ export default ({ loadTestFile }: FtrProviderContext): void => {
/** /**
* Public routes * Public routes
*/ */
loadTestFile(require.resolve('./client/update_alert_status'));
loadTestFile(require.resolve('./comments/delete_comment'));
loadTestFile(require.resolve('./comments/delete_comments'));
loadTestFile(require.resolve('./comments/find_comments')); loadTestFile(require.resolve('./comments/find_comments'));
loadTestFile(require.resolve('./comments/get_comment')); loadTestFile(require.resolve('./comments/get_comment'));
loadTestFile(require.resolve('./comments/patch_comment')); loadTestFile(require.resolve('./comments/patch_comment'));
loadTestFile(require.resolve('./comments/post_comment'));
loadTestFile(require.resolve('./files/post_file')); loadTestFile(require.resolve('./files/post_file'));
loadTestFile(require.resolve('./alerts/get_cases')); loadTestFile(require.resolve('./alerts/get_cases'));
loadTestFile(require.resolve('./alerts/get_alerts_attached_to_case')); loadTestFile(require.resolve('./alerts/get_alerts_attached_to_case'));
loadTestFile(require.resolve('./cases/delete_cases'));
loadTestFile(require.resolve('./cases/import_export')); loadTestFile(require.resolve('./cases/import_export'));
loadTestFile(require.resolve('./cases/find_cases')); loadTestFile(require.resolve('./cases/find_cases'));
loadTestFile(require.resolve('./cases/get_case')); loadTestFile(require.resolve('./cases/get_case'));
loadTestFile(require.resolve('./cases/patch_cases'));
loadTestFile(require.resolve('./cases/post_case')); loadTestFile(require.resolve('./cases/post_case'));
loadTestFile(require.resolve('./cases/resolve_case')); loadTestFile(require.resolve('./cases/resolve_case'));
loadTestFile(require.resolve('./cases/reporters/get_reporters')); loadTestFile(require.resolve('./cases/reporters/get_reporters'));
@ -47,7 +41,6 @@ export default ({ loadTestFile }: FtrProviderContext): void => {
/** /**
* Internal routes * Internal routes
*/ */
loadTestFile(require.resolve('./internal/bulk_create_attachments'));
loadTestFile(require.resolve('./internal/bulk_get_cases')); loadTestFile(require.resolve('./internal/bulk_get_cases'));
loadTestFile(require.resolve('./internal/bulk_get_attachments')); loadTestFile(require.resolve('./internal/bulk_get_attachments'));
loadTestFile(require.resolve('./internal/get_connectors')); loadTestFile(require.resolve('./internal/get_connectors'));

View file

@ -41,8 +41,8 @@ import {
secAllUser, secAllUser,
secReadUser, secReadUser,
users as api_int_users, users as api_int_users,
} from '../../../../../api_integration/apis/cases/common/users'; } from '../../../../common/users';
import { roles as api_int_roles } from '../../../../../api_integration/apis/cases/common/roles'; import { roles as api_int_roles } from '../../../../common/roles';
// eslint-disable-next-line import/no-default-export // eslint-disable-next-line import/no-default-export
export default ({ getService }: FtrProviderContext): void => { export default ({ getService }: FtrProviderContext): void => {

View file

@ -8,7 +8,7 @@
import expect from '@kbn/expect'; import expect from '@kbn/expect';
import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain';
import { CaseMetricsFeature } from '@kbn/cases-plugin/common'; import { CaseMetricsFeature } from '@kbn/cases-plugin/common';
import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; import { ObjectRemover as ActionsRemover } from '../../../../../../alerting_api_integration/common/lib';
import { getPostCaseRequest } from '../../../../../common/lib/mock'; import { getPostCaseRequest } from '../../../../../common/lib/mock';
import type { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import type { FtrProviderContext } from '../../../../../common/ftr_provider_context';

Some files were not shown because too many files have changed in this diff Show more