-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[ML] Cardinality validation API integration tests #65971
[ML] Cardinality validation API integration tests #65971
Conversation
Pinging @elastic/ml-ui (:ml) |
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.
LGTM, also did a local test. Only remark is about the non-null assertions, can we try to avoid them? (https://github.com/elastic/kibana/blob/master/STYLEGUIDE.md#avoid-non-null-assertions).
Yes, I tried to avoid it but didn't find a solution. The problem is |
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.
Added a couple of ts nitpicks, ignore if you want, otherwise LGTM.
It's nice to see further removal of lodash!
function isScriptField(job, fieldName) { | ||
const scriptFields = Object.keys(_.get(job, 'datafeed_config.script_fields', {})); | ||
function isScriptField(job: CombinedJob, fieldName: string): boolean { | ||
const scriptFields = Object.keys(job?.datafeed_config?.script_fields ?? {}); |
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.
nit, it doesn't look like job
will be undefined here, datafeed_config
also shouldn't be 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.
Done in 90ba7a4
const uniqueFieldNames = _.uniq(relevantDetectors.map(f => f[fieldName])); | ||
const uniqueFieldNames: string[] = [ | ||
...new Set(relevantDetectors.map(f => f[fieldName])), | ||
] as string[]; |
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.
nit, could be const uniqueFieldNames = [...new Set(relevantDetectors.map(f => f[fieldName] as string))];
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.
Done in 90ba7a4
@darnautov to make |
@walterra |
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.
LGTM
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.
LGTM
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* [ML] refactor validate_cardinality to TS * [ML] cardinality api integration tests * [ML] resolve PR comments, validateJobObject as TS guard
* [ML] refactor validate_cardinality to TS * [ML] cardinality api integration tests * [ML] resolve PR comments, validateJobObject as TS guard
Summary
Part of #63700.
Adds API integration tests for cardinality validation of anomaly detection jobs.
TS refactoring
Unit or functional tests were updated or added to match the most common scenarios