mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Unskipped and added additional filters to test (#187869)
## Summary Unskipped and added additional filter for testing audit events when reading and writing saved objects. We were filtering event by action only (`http_request` and `saved_object_create`), which probably sometimes returned audit events logged for background tasks, that lack user information. ### 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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed __Fixes: https://github.com/elastic/kibana/issues/119267__ --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
a0b018b12c
commit
97e1163b49
1 changed files with 9 additions and 5 deletions
|
@ -23,23 +23,27 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
await logFile.reset();
|
||||
});
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/119267
|
||||
it.skip('logs audit events when reading and writing saved objects', async () => {
|
||||
it('logs audit events when reading and writing saved objects', async () => {
|
||||
await supertest.get('/audit_log?query=param').set('kbn-xsrf', 'foo').expect(204);
|
||||
await logFile.isWritten();
|
||||
const content = await logFile.readJSON();
|
||||
|
||||
const httpEvent = content.find((c) => c.event.action === 'http_request');
|
||||
const httpEvent = content.find(
|
||||
(c) => c.event.action === 'http_request' && c.url.path === '/audit_log'
|
||||
);
|
||||
expect(httpEvent).to.be.ok();
|
||||
expect(httpEvent.trace.id).to.be.ok();
|
||||
|
||||
expect(httpEvent.user.name).to.be(username);
|
||||
expect(httpEvent.kibana.space_id).to.be('default');
|
||||
expect(httpEvent.http.request.method).to.be('get');
|
||||
expect(httpEvent.url.path).to.be('/audit_log');
|
||||
expect(httpEvent.url.query).to.be('query=param');
|
||||
|
||||
const createEvent = content.find((c) => c.event.action === 'saved_object_create');
|
||||
const createEvent = content.find(
|
||||
(c) =>
|
||||
c.event.action === 'saved_object_create' && c.kibana.saved_object.type === 'dashboard'
|
||||
);
|
||||
|
||||
expect(createEvent).to.be.ok();
|
||||
expect(createEvent.trace.id).to.be.ok();
|
||||
expect(createEvent.user.name).to.be(username);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue