-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Notes] Make MAX_UNASSOCIATED_NOTES an advanced Ki…
…bana setting (#194947) ## Summary Fixes: #193097 Adds a new Kibana advanced setting that allows users to limit the maximum amount of unassociated notes. The max value for that used to be hard coded before. https://github.com/user-attachments/assets/34af7f67-9109-4251-a5a3-a1af68f123fe ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
424ffba
commit 925329e
Showing
16 changed files
with
220 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
x-pack/plugins/security_solution/public/notes/api/api.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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 { PersistNoteRouteResponse } from '../../../common/api/timeline'; | ||
import { KibanaServices } from '../../common/lib/kibana'; | ||
import * as api from './api'; | ||
|
||
jest.mock('../../common/lib/kibana', () => { | ||
return { | ||
KibanaServices: { | ||
get: jest.fn(), | ||
}, | ||
}; | ||
}); | ||
|
||
describe('Notes API client', () => { | ||
beforeAll(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
describe('create note', () => { | ||
it('should throw an error when a response code other than 200 is returned', async () => { | ||
const errorResponse: PersistNoteRouteResponse = { | ||
data: { | ||
persistNote: { | ||
code: 500, | ||
message: 'Internal server error', | ||
note: { | ||
timelineId: '1', | ||
noteId: '2', | ||
version: '3', | ||
}, | ||
}, | ||
}, | ||
}; | ||
(KibanaServices.get as jest.Mock).mockReturnValue({ | ||
http: { | ||
patch: jest.fn().mockReturnValue(errorResponse), | ||
}, | ||
}); | ||
|
||
expect(async () => | ||
api.createNote({ | ||
note: { | ||
timelineId: '1', | ||
}, | ||
}) | ||
).rejects.toThrow(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.