Commit Graph

20 Commits

Author SHA1 Message Date
Jordan Neufeld 268b4c29e1
Support extended durations in promtool unit tests (Fixes #6285) (#6297)
* Fixed evaluation_time duration parsing in promtool unit tests (Fixes #6285)

Signed-off-by: Jordan Neufeld <jordan@neufeldtech.com>
2020-06-15 16:03:07 +01:00
Brian Brazil 7646cbca32
Use .UTC everywhere we use time.Unix (#7066)
time.Unix attaches the local timezone, which can then
leak out (e.g. in the alert json). While this is harmless,
we should be consistent.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2020-03-29 17:35:39 +01:00
Tobias Guggenmos 454ba12676 Fix build errors in promtool
Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
2020-02-17 16:09:23 +01:00
akerele abraham 9d39fdad0c unittest: check for rule files existence (#6075)
Signed-off-by: akerele abraham <abrahamakerele38@gmail.com>
2019-11-18 13:54:52 -08:00
Simon Pasquier ddff1480a7
cmd/promtool: improve output for PromQL tests (#6052)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-09-25 09:26:29 +02:00
Simon Pasquier 75886e0464 cmd/promtool: fix panic with empty exp_labels
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-07-17 17:02:31 +02:00
Björn Rabenstein dc22f74153
Merge pull request #5608 from simonpasquier/external-labels-for-alert-tests
cmd/promtool: add $externalLabels for alert unit tests
2019-06-20 16:48:12 +02:00
Keenan Romain 55f3a9fe4a Allows globs for rules when unit testing (#5595)
* Includes glob support when unit testing rule_files. 

Signed-off-by: Keenan Romain <Keenan.Romain@mailchimp.com>
2019-06-12 11:31:07 +01:00
Simon Pasquier 74ff35ccdd cmd/promtool: add $externalLabels for alert unit tests
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-05-29 16:40:01 +02:00
Simon Pasquier 9c69eec82a cmd/promtool: use log.NewNopLogger() (#5531)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-05-03 10:00:07 +01:00
Björn Rabenstein 0be9388f8d
Merge pull request #5463 from prometheus/beorn7/templating
Follow-up on #5009
2019-04-24 16:42:23 +02:00
Simon Pasquier abc1994bec
cmd/promtool: return errors from rule evaluations (#5483)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-23 09:59:03 +02:00
Bjoern Rabenstein 38d518c0fe Rework #5009 after comments
Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
2019-04-17 01:40:10 +02:00
David Symonds 7a60e22c2d cmd/promtool: resolve relative paths in alert test files (#5336)
Like `promtool check config <path/to/foo.yaml>`, which resolves relative
paths inside foo.yaml to be relative to `path/to`, this now makes
`promtool test rules <path/to/test.yaml>` do the same thing.

Signed-off-by: David Symonds <dsymonds@gmail.com>
2019-03-27 10:27:26 +01:00
Tariq Ibrahim 8fdfa8abea refine error handling in prometheus (#5388)
i) Uses the more idiomatic Wrap and Wrapf methods for creating nested errors.
ii) Fixes some incorrect usages of fmt.Errorf where the error messages don't have any formatting directives.
iii) Does away with the use of fmt package for errors in favour of pkg/errors

Signed-off-by: tariqibrahim <tariq181290@gmail.com>
2019-03-26 00:01:12 +01:00
Simon Pasquier f678e27eb6
*: use latest release of staticcheck (#5057)
* *: use latest release of staticcheck

It also fixes a couple of things in the code flagged by the additional
checks.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Use official release of staticcheck

Also run 'go list' before staticcheck to avoid failures when downloading packages.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-04 14:47:38 +01:00
Ganesh Vernekar 7d30ccd0eb Sort samples before comparing - PromQL unit test (#5052)
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2018-12-31 10:55:49 +00:00
Ganesh Vernekar fbadd88ba5 Get unique eval times for alert unit tests (#4964)
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2018-12-18 08:40:03 +00:00
Ganesh Vernekar cfb3769274 Lazily load samples for unit testing (#4851)
* Lazily load samples for unit testing

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* cleanup

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2018-11-22 14:21:38 +05:30
Ganesh Vernekar 5790d23fd8 Unit testing for rules (#4350)
* Unit testing for rules
* Specifying order of group evaluation in unit tests

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2018-09-25 17:06:26 +01:00