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

Fix: Validation on Alert Assertion #1179

Merged

Conversation

haricnugraha
Copy link
Contributor

Monika Pull Request (PR)

What feature/issue does this PR add?

Fix alert assertion validation. This will resolves #1177.

How did you implement / how did you fix it?

  • Add some tests.
  • Compile alert assertion expression to the data with default value instead of empty array.
  • Move manual validation into Joi.

How to test

Standalone

Run with the following configuration

probes:
  - id: "1"
    requests:
      - url: https://github.com
        alerts:
          - assertion: response.size >= 10000 ms
            message: Response size is {{ response.size }}, expecting less than 10000

Symon

Use response.size >= 10000 ms as an alert assertion in a probe.

Video

Standalone

invalid-alerts-monika.mp4

Symon mode

symon-mode.mp4

Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (1e5cf52) 61.31% compared to head (5eaabc8) 61.09%.

❗ Current head 5eaabc8 differs from pull request most recent head a5e610d. Consider uploading reports for the commit a5e610d to get more accurate results

Files Patch % Lines
...rc/components/config/validation/validator/probe.ts 89.74% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1179      +/-   ##
==========================================
- Coverage   61.31%   61.09%   -0.22%     
==========================================
  Files         107      107              
  Lines        3151     3131      -20     
  Branches      535      530       -5     
==========================================
- Hits         1932     1913      -19     
- Misses       1035     1036       +1     
+ Partials      184      182       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@haricnugraha haricnugraha marked this pull request as ready for review November 15, 2023 03:57
@haricnugraha haricnugraha merged commit a9a2df4 into hyperjumptech:main Nov 15, 2023
5 checks passed
@haricnugraha haricnugraha deleted the fix/1177-validate-alert-assertion branch November 15, 2023 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alert Assertion Validation Does not Working as Expected
3 participants