Skip to content

Commit 6a2e5fa

Browse files
committed
Fix FTR test and services
1 parent a65db69 commit 6a2e5fa

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

x-pack/solutions/security/test/security_solution_api_integration/test_suites/edr_workflows/artifacts/trial_license_complete_tier/endpoint_exceptions.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type TestAgent from 'supertest/lib/agent';
99
import expect from '@kbn/expect';
1010
import {
1111
ENDPOINT_ARTIFACT_LISTS,
12+
ENDPOINT_LIST_ID,
1213
EXCEPTION_LIST_ITEM_URL,
1314
EXCEPTION_LIST_URL,
1415
} from '@kbn/securitysolution-list-constants';
@@ -35,7 +36,7 @@ export default function ({ getService }: FtrProviderContext) {
3536

3637
describe(`and using Import API`, function () {
3738
const buildImportBuffer = (
38-
listId: (typeof ALL_ENDPOINT_ARTIFACT_LIST_IDS)[number]
39+
listId: (typeof ALL_ENDPOINT_ARTIFACT_LIST_IDS)[number] | typeof ENDPOINT_LIST_ID
3940
): Buffer => {
4041
const generator = new ExceptionsListItemGenerator();
4142
const listInfo = Object.values(ENDPOINT_ARTIFACT_LISTS).find((listDefinition) => {
@@ -48,7 +49,7 @@ export default function ({ getService }: FtrProviderContext) {
4849

4950
const createItem = () => {
5051
switch (listId) {
51-
case ENDPOINT_ARTIFACT_LISTS.endpointExceptions.id:
52+
case ENDPOINT_LIST_ID:
5253
return generator.generateEndpointException();
5354

5455
case ENDPOINT_ARTIFACT_LISTS.blocklists.id:
@@ -63,9 +64,6 @@ export default function ({ getService }: FtrProviderContext) {
6364
case ENDPOINT_ARTIFACT_LISTS.trustedApps.id:
6465
return generator.generateTrustedApp();
6566

66-
case ENDPOINT_ARTIFACT_LISTS.trustedDevices.id:
67-
return generator.generateTrustedDevice();
68-
6967
default:
7068
throw new Error(`Unknown listId: ${listId}. Unable to generate exception list item.`);
7169
}
@@ -88,9 +86,7 @@ ${JSON.stringify(createItem())}
8886
};
8987

9088
// All non-Endpoint exceptions artifacts are not allowed to import
91-
ALL_ENDPOINT_ARTIFACT_LIST_IDS.filter(
92-
(listId) => listId !== ENDPOINT_ARTIFACT_LISTS.endpointExceptions.id
93-
).forEach((listId) => {
89+
ALL_ENDPOINT_ARTIFACT_LIST_IDS.forEach((listId) => {
9490
it(`should error when importing ${listId} artifacts`, async () => {
9591
await endpointArtifactTestResources.deleteList(listId);
9692

@@ -108,19 +104,13 @@ ${JSON.stringify(createItem())}
108104
});
109105

110106
it('should import endpoint exceptions and add global artifact tag if missing', async () => {
111-
await endpointArtifactTestResources.deleteList(
112-
ENDPOINT_ARTIFACT_LISTS.endpointExceptions.id
113-
);
107+
await endpointArtifactTestResources.deleteList(ENDPOINT_LIST_ID);
114108

115109
await endpointOpsAnalystSupertest
116110
.post(`${EXCEPTION_LIST_URL}/_import`)
117111
.set('kbn-xsrf', 'true')
118112
.on('error', createSupertestErrorLogger(log))
119-
.attach(
120-
'file',
121-
buildImportBuffer(ENDPOINT_ARTIFACT_LISTS.endpointExceptions.id),
122-
'import_exceptions.ndjson'
123-
)
113+
.attach('file', buildImportBuffer(ENDPOINT_LIST_ID), 'import_exceptions.ndjson')
124114
.expect(200);
125115

126116
const { body } = await endpointOpsAnalystSupertest

x-pack/solutions/security/test/security_solution_endpoint/services/endpoint_artifacts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function EndpointArtifactsTestResourcesProvider({ getService }: FtrProvid
7373
* @param supertest
7474
*/
7575
async deleteList(
76-
listId: (typeof ENDPOINT_ARTIFACT_LIST_IDS)[number],
76+
listId: (typeof ENDPOINT_ARTIFACT_LIST_IDS)[number] | typeof ENDPOINT_LIST_ID,
7777
supertest: TestAgent = this.supertest
7878
): Promise<void> {
7979
await supertest

0 commit comments

Comments
 (0)