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

[RAC][Rule Registry] Adds test for required and optional alert fields #120475

Merged
merged 5 commits into from
Jan 25, 2022

Conversation

claudiopro
Copy link
Contributor

@claudiopro claudiopro commented Dec 6, 2021

Summary

The PR adds some test coverage for the parseTechnicalFields utility function:

/*
* 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 { isLeft } from 'fp-ts/lib/Either';
import { PathReporter } from 'io-ts/lib/PathReporter';
import { technicalRuleFieldMap } from './assets/field_maps/technical_rule_field_map';
import { runtimeTypeFromFieldMap } from './field_map';
const technicalFieldRuntimeType = runtimeTypeFromFieldMap(technicalRuleFieldMap);
export const parseTechnicalFields = (input: unknown) => {
const validate = technicalFieldRuntimeType.decode(input);
if (isLeft(validate)) {
throw new Error(PathReporter.report(validate).join('\n'));
}
return technicalFieldRuntimeType.encode(validate.right);
};
export type ParsedTechnicalFields = ReturnType<typeof parseTechnicalFields>;

This addition helps troubleshoot the issue #120465.

Checklist

@claudiopro claudiopro marked this pull request as ready for review December 13, 2021 17:31
@claudiopro claudiopro added auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" Theme: rac label obsolete v8.1.0 labels Dec 13, 2021
@claudiopro claudiopro changed the title [RAC][Rule Registry] Fixes parse error when alert reason field is missing [RAC][Rule Registry] Adds test for required and optional alert fields Dec 13, 2021
@jasonrhodes jasonrhodes requested a review from mgiota January 19, 2022 17:16
@simianhacker simianhacker requested a review from mgiota January 24, 2022 20:20
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @simianhacker

Copy link
Contributor

@mgiota mgiota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@simianhacker simianhacker merged commit 469e461 into elastic:main Jan 25, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 25, 2022
@kibanamachine
Copy link
Contributor

💔 Backport failed

The pull request could not be backported due to the following error:
There are no branches to backport to. Aborting.

How to fix

Re-run the backport manually:

node scripts/backport --pr 120475

Questions ?

Please refer to the Backport tool documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" Theme: rac label obsolete v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants