goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.5k stars 470 forks source link

fix outcome label in goss_tests_run_outcomes_total #860

Closed sebhoss closed 6 months ago

sebhoss commented 6 months ago

The prometheus metric goss_tests_run_outcomes_total has a label called 'outcome' which suffers from two problems:

  1. It won't be set to 'pass' in case all tests succeed
  2. The order of test results determines the final value of the label, e.g. if there is a failed & skipped test then the outcome will be skipped, but if order of results is reversed the outcome will become failed.

This commit fixes both by introducing a helper function which determines whether the outcome can be changed and adds tests to verify that behavior.

fixes #789

Checklist

Description of change

sebhoss commented 6 months ago

pinging @petemounce @timeu since you guys were involved in the original implementation

timeu commented 6 months ago

From my point of view it looks good. Thanks for the fix

aelsabbahy commented 6 months ago

Merging based on @timeu review.

Thank you for the great contribution @sebhoss

sebhoss commented 6 months ago

Thanks everyone!