yorker test now evaluates assertions (CLI 0.9.0)
yorker test runs each HTTP monitor's assertions locally with the same logic as hosted runs and exits non-zero on failure. This changes the command's exit code.
yorker test used to send each HTTP monitor's request and print the status
code. From @yorker/cli@0.9.0 it also evaluates the monitor's assertions,
using the same code the hosted runners use, and tells you which ones failed
and what the response actually contained:
HTTP Users API ... 200 (89ms) 1/3 assertions failed
✗ body_json_path: JSONPath $.data.total: expected equals 10, got undefined
A wrong field name or a stale threshold is now caught before you deploy, not by the first hosted run.
Breaking: the exit code
yorker test previously exited 0 whatever happened. It now exits 1 when
any HTTP monitor fails, whether the request failed or an assertion did not
hold. If a script or CI step runs yorker test only for information and must
not fail the job, change it to:
yorker test || truePrivate addresses need a flag
yorker test now refuses to request private, loopback, and link-local
addresses, the same policy hosted locations enforce. To test a monitor
against localhost or a host on your own network:
yorker test --allow-private-networkAlso in this release
- JSONPath assertions accept array indexes (
$.data.items[0].name) and quoted keys ($['content.type']). Indexed paths previously never matched, on hosted runs as well as locally. - A
body_matchespattern that is invalid, or that does not finish within one second, fails the assertion with a clear message instead of stalling the check. - Secret values from your config's
secrets:list are redacted fromyorker testoutput.