Commit Graph

46 Commits

Author SHA1 Message Date
Heitor
744d63abac
fix: Support hexadecimal integers in conditions (#563)
* Fix parsing hexadecimal integers in conditions

Remove the assumption that JSON contains only decimal integers and
instead identify the base from the prefix of the data.

`strconv.ParseInt` can identify the base of the integer based on its
"prefix":
- 0x -> hexadecimal
- 0o -> octal
- 0b -> binary
- decimal otherwise.

* core: add more tests for condiction.evaluate

* fix isEqual parsing integers as strings

* tests: extend conditions

* Test if we can compare equality of hex in JSON

* Test if we can have hex/oct/bin in conditions

---------

Co-authored-by: TwiN <twin@linux.com>
2023-10-04 20:25:18 -04:00
TwiN
038c8c8d8e fix: Print response body on failure if debug is set to true 2023-03-14 20:02:31 -04:00
TwiN
6ab8899dc6
fix(condition): Partially support numbers with floating point (#434)
* docs: Don't include Pushover in alerting provider examples

* fix(condition): Partially support numbers with floating point

Fixes #433

Does not add support for decimal numbers, but it converts float64 to int64.
The reason why I'm not just using float64 instead of int64 is because float64 does not support all the numbers that int64 supports, which means this would be a breaking change. Instead, this change at least supports the non-decimal part of floating point numbers.

This is an improvement over the current implementation, as right now, numbers with decimals are just converted to 0 when compared using a non-equal operator
2023-02-15 19:30:29 -05:00
TwiN
0db92f46da test: Add several tests for numerical conditions 2023-01-19 01:37:21 -05:00
TwiN
f6a621da28 chore: Bump module version to v5 2022-12-06 01:41:18 -05:00
TwiN
2346a6ee4f
fix!: Enforce mandatory space around condition operator (#382)
BREAKING CHANGE: The comparator in each condition must now be wrapped by a space (e.g. [STATUS] == 200) or the condition will not be valid.
2022-12-06 01:37:05 -05:00
TwiN
01484832fc
feat: Add [DOMAIN_EXPIRATION] placeholder for monitoring domain expiration using WHOIS (#325)
* feat: Add [DOMAIN_EXPIRATION] placeholder for monitoring domain expiration using WHOIS

* test: Fix issue caused by possibility of millisecond elapsed during previous tests

* test: Fix test with different behavior based on architecture

* docs: Revert accidental change to starttls example

* docs: Fix mistake in comment for Condition.hasIPPlaceholder()
2022-09-06 21:22:02 -04:00
TwiN
ab2bee9c4b chore!: Update module from v3 to v4 2022-06-20 21:25:14 -04:00
TwiN
a94c480c22 Fix typo in comment 2021-11-03 22:17:58 -04:00
TwiN
6ed93d4b82
Rename Service to Endpoint (#192)
* Add clarifications in comments

* #191: Rename Service to Endpoint
2021-10-23 16:47:12 -04:00
TwiN
6c45f5b99c ⚠ Migrate TwinProduction/gatus to TwiN/gatus 2021-10-07 21:28:04 -04:00
TwinProduction
2d3fe9795f Add v3 to module path
Gatus wasn't intended to be used as a library, but I have a use case now.
2021-10-03 21:53:59 -04:00
TwinProduction
f41560cd3e Add configuration for whether to resolve failed conditions or not 2021-09-14 19:34:46 -04:00
TwinProduction
8997eeef05 Fix #123: Deduplicate result errors 2021-06-05 18:50:24 -04:00
TwinProduction
50f530a05c Fix #107: Correctly parse placeholder when [BODY] is an array 2021-05-09 13:28:22 -04:00
TwinProduction
4e5a86031f Add comment for future breaking change 2021-03-27 21:22:34 -04:00
TwinProduction
c9acc83141 Extract magic number into a constant 2021-03-14 16:52:59 -04:00
TwinProduction
8c4c360472 Minor update 2021-03-14 13:36:54 -04:00
David Chidell
2c8714f1fa
Truncate long string when using pattern function (#100)
- Omits verbose responses when using pattern match
- Change contains to match prefix and suffix, add 2nd test
2021-03-14 13:05:16 -04:00
TwinProduction
8ec256edbf Implement has() function to determine if an element at a JSONPath exists 2021-03-10 21:49:13 -05:00
TwinProduction
541e0264ab Don't export, persist or retain result body after evaluation 2021-03-08 21:30:11 -05:00
TwinProduction
271c3dc91d Performance improvements 2021-01-14 22:49:48 -05:00
TwinProduction
819093cb7e Implement any function and prettify displayed condition on failure 2021-01-14 20:08:27 -05:00
TwinProduction
f1c0bbe73c Minor update 2021-01-04 18:00:36 -05:00
cemturker
8789a4ad55 Review changes 2020-11-19 09:31:30 +01:00
cemturker
cef94299e5 Merge branch 'master' into add-dns-feature
# Conflicts:
#	core/condition.go
2020-11-18 18:53:00 +01:00
cemturker
7f21fdee68 Change test structure into tabledriven
Review change
Update README.md
2020-11-18 18:51:22 +01:00
TwinProduction
7e35a6ebbd Rename PlaceHolder to Placeholder 2020-11-17 19:34:22 -05:00
cemturker
bc914e12b0 Add health check for DNS 2020-11-18 00:55:31 +01:00
TwinProduction
e79c849e6d Revert "Add day format support for duration comparison"
This reverts commit 21509428
2020-11-17 12:16:40 -05:00
Elouan Martinet
2150942876 Add day format support for duration comparison 2020-11-16 18:16:11 +01:00
TwinProduction
573b5f89e1 Improve test coverage 2020-11-16 10:10:02 -05:00
Elouan Martinet
121369d9c0 Add basic duration comparison 2020-11-16 09:32:37 +01:00
Elouan Martinet
7d97e83875 Add support for comparing duration before certificate expiration 2020-11-15 18:33:09 +01:00
Elouan Martinet
d50721c8f0 Compare numeric values as int64 2020-11-15 16:50:05 +01:00
TwinProduction
babc7f9f07 Fix issue with displayed condition when condition uses len() 2020-10-29 17:18:43 -04:00
TwinProduction
72e6d1cda9 Fix typo 2020-10-23 16:35:16 -04:00
TwinProduction
4655e74c2a Minor improvements 2020-10-23 16:31:49 -04:00
TwinProduction
77ad91a297 Fix Golint 2020-10-23 16:29:20 -04:00
TwinProduction
58b9b17944 Trim down size of condition to display on invalid path 2020-10-15 22:44:34 -04:00
TwinProduction
a66cfc094a Ignore "unexpected end of JSON input" errors 2020-10-15 22:43:24 -04:00
TwinProduction
3d7dbf4bba Improve documentation 2020-10-06 19:07:47 -04:00
TwinProduction
230c8821ec Merge util.go into condition.go 2020-10-04 20:00:24 -04:00
TwinProduction
8101646ba5 Work on #16: Support patterns 2020-10-01 19:57:11 -04:00
TwinProduction
da92907873 Add support for getting the length of the string or the slice of a json path 2020-08-12 21:42:13 -04:00
TwinProduction
fe3e60dbd4 Add support for headers, method, body and json path with arrays 2020-04-14 19:20:00 -04:00