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

[Security Solution][Resolver] Check event id instead of full lifecycle events #72624

Merged
Merged
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
11 changes: 9 additions & 2 deletions x-pack/test/api_integration/apis/endpoint/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {
ResolverNodeStats,
ResolverRelatedAlerts,
} from '../../../../plugins/security_solution/common/endpoint/types';
import { parentEntityId } from '../../../../plugins/security_solution/common/endpoint/models/event';
import {
parentEntityId,
eventId,
} from '../../../../plugins/security_solution/common/endpoint/models/event';
import { FtrProviderContext } from '../../ftr_provider_context';
import {
Event,
Expand Down Expand Up @@ -167,10 +170,14 @@ const compareArrays = (
if (lengthCheck) {
expect(expected.length).to.eql(toTest.length);
}

toTest.forEach((toTestEvent) => {
expect(
expected.find((arrEvent) => {
return JSON.stringify(arrEvent) === JSON.stringify(toTestEvent);
// we're only checking that the event ids are the same here. The reason we can't check the entire document
// is because ingest pipelines are used to add fields to the document when it is received by elasticsearch,
// therefore it will not be the same as the document created by the generator
return eventId(toTestEvent) === eventId(arrEvent);
})
).to.be.ok();
});
Expand Down