-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Resolver] node list and node detail tests #74421
Conversation
* | ||
* NB: the logic to short-circuit the loop is here because knowledge of state is a concern of the simulator, not tests. | ||
*/ | ||
public async *map<R>(mapper: () => R): AsyncIterable<R> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this replaces mapStateTransitions
const title = titles.at(index).text(); | ||
const description = descriptions.at(index).text(); | ||
|
||
// Exclude timestamp since we can't currently calculate the expected description for it from tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the timestamp is wrong anyway
@@ -82,27 +84,24 @@ describe('Resolver, when analyzing a tree that has 1 ancestor and 2 children', ( | |||
.first() | |||
.simulate('click'); | |||
}); | |||
it('should render the second child node as selected, and the first child not as not selected, and the query string should indicate that the second child is selected', async () => { | |||
it('should render the second child node as selected, and the origin as not selected, and the query string should indicate that the second child is selected', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wording was wrong, test was right.
const eventTime = event.eventTimestamp(processEvent); | ||
const dateTime = eventTime ? formatDate(eventTime) : ''; | ||
const dateTime = eventTime === undefined ? null : formatDate(eventTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Show the timestamp even if it's the unix epoch
@@ -107,7 +108,7 @@ export const ProcessDetails = memo(function ProcessDetails({ | |||
commandLineEntry, | |||
] | |||
.filter((entry) => { | |||
return entry.description; | |||
return entry.description !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show the pid and timestamp if they are present
@@ -43,24 +40,11 @@ interface Metadata { | |||
/** | |||
* A simple mock dataAccessLayer possible that returns a tree with 0 ancestors and 2 direct children. 1 related event is returned. The parameter to `entities` is ignored. | |||
*/ | |||
export function oneAncestorTwoChildren( | |||
{ withRelatedEvents }: { withRelatedEvents: Iterable<[string, string]> | null } = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed options from this function, split that behavior off into its own function.
secondChildID, | ||
}); | ||
const withRelatedEvents: Array<[string, string]> = [ | ||
['registry', 'access'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ I was hoping to make this a little more reusable, e.g. being able to pass in the set of related events from the test,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was hoping for the opposite :) let's discuss in office hours?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we followed up. README with recommendations for writing mocks will be added next PR
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
* Change the way the resolver simulator works * refactor resolver tree and data access layer mocks * Fix bug where timestamp and pid sometimes don't show in the node detail view * add a few tests for the panel (not done, but worth committing.)
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
* Change the way the resolver simulator works * refactor resolver tree and data access layer mocks * Fix bug where timestamp and pid sometimes don't show in the node detail view * add a few tests for the panel (not done, but worth committing.) Co-authored-by: Elastic Machine <[email protected]>
const eventTime = event.eventTimestamp(processEvent); | ||
const dateTime = eventTime ? formatDate(eventTime) : ''; | ||
const dateTime = eventTime === undefined ? null : formatDate(eventTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By checking if the value is undefined
we can support showing the date even if it is the unix epoch (00:00:00 UTC on 1 January 1970.)
@@ -107,7 +108,7 @@ export const ProcessDetails = memo(function ProcessDetails({ | |||
commandLineEntry, | |||
] | |||
.filter((entry) => { | |||
return entry.description; | |||
return entry.description !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By checking for undefined
here we will show the PID of a process if it is 0
Summary
Checklist
Delete any items that are not applicable to this PR.
For maintainers