Gabriel Filion
9f0b52d73a
docs: Describe how time() is set to start at 0 in unit tests
...
The return value of functions relating to the current time, e.g. time(),
is set by promtool to start at timestamp 0 at the start of a test's
evaluation.
This has the very nice consequence that tests can run reliably without
depending on when they are run.
It does, however, mean that tests will give out results that can be
unexpected by users.
If this behaviour is documented, then users will be empowered to write
tests for their rules that use time-dependent functions.
(Closes : prometheus/docs#1464 )
Signed-off-by: Gabriel Filion <lelutin@torproject.org>
2025-12-02 16:57:01 +01:00
shk1999
6851b1095c
chore(configuration.md): fix unit_testing_rules typo
...
Signed-off-by: shk1999 <sh.karimi@vasl.ir>
2025-08-13 16:48:28 +03:30
Rishi Jat
31e158b749
Add documentation for custom_values usage in NHCB ( #16757 )
...
Signed-off-by: rishi-jat <rishijat098@gmail.com>
Signed-off-by: Rishi Jat <rishijat098@gmail.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2025-06-24 21:52:55 +02:00
Julius Volz
13564c03ef
Standardize doc page title handling
...
See https://groups.google.com/g/prometheus-developers/c/cwL3cM66Em8
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-05-28 21:37:27 +02:00
Graham Reed
b6aaea22fb
promtool: Optional fuzzy float64 comparison in rules unittests ( #16395 )
...
Make fuzzy compare opt-in via fuzzy_compare boolean in each unittest file.
Signed-off-by: Graham Reed <greed@hypervolt.co.uk>
2025-05-01 17:58:12 +10:00
Charles Korn
7fab72a280
promqltest: add support for setting counter reset hint on histogram samples ( #14537 )
...
* promqltest: add support for setting counter reset hint on histogram samples
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2024-07-31 09:53:05 +02:00
Rens Groothuijsen
122f9506e9
Set test group interval default to evaluation interval ( #13011 )
...
Signed-off-by: Rens Groothuijsen <l.groothuijsen@alumni.maastrichtuniversity.nl>
2023-10-20 21:32:46 +11:00
Jonathan Ellithorpe
91650a32cc
Fix/clarify documentation for axn notation
...
Signed-off-by: Jonathan Ellithorpe <jelli@databricks.com>
2023-10-07 08:09:30 -07:00
Gregor Zeitlinger
f01718262a
Unit tests for native histograms ( #12668 )
...
promql: Extend testing framework to support native histograms
This includes both the internal testing framework as well as the rules unit test feature of promtool.
This also adds a bunch of basic tests. Many of the code level tests can now be converted to tests within the framework, and more tests can be added easily.
---------
Signed-off-by: Harold Dost <h.dost@criteo.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Stephen Lang <stephen.lang@grafana.com>
Co-authored-by: Harold Dost <h.dost@criteo.com>
Co-authored-by: Stephen Lang <stephen.lang@grafana.com>
Co-authored-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
2023-08-25 23:35:42 +02:00
Danny Staple
f3f800ea6f
Terminology amendment
...
Signed-off-by: Danny Staple <danny@orionrobots.co.uk>
2022-12-15 16:22:40 +00:00
Danny Staple
7269a6e21a
Fix the output example
...
(based on empirical unit testing)
Signed-off-by: Danny Staple <danny@orionrobots.co.uk>
2022-12-14 12:21:34 +00:00
Danny Staple
87b9f1d24a
Fix typo I introduced in unit testing rules.
...
Signed-off-by: Danny Staple <danny@orionrobots.co.uk>
2022-12-14 12:20:28 +00:00
Danny Staple
b614fdd8a7
Update unit_testing_rules.md
...
Update the shorthand, and note the different behaviour between missing samples and numbers.
Signed-off-by: Danny Staple <danny@orionrobots.co.uk>
2022-12-13 15:52:40 +00:00
Danny Staple
300d6e4390
Add an explanation to the expanding notation
...
After some team discussion, we found this to be a useful was to explain the samples.
Signed-off-by: Danny Staple <danny@orionrobots.co.uk>
2022-12-13 11:11:13 +00:00
Arunprasad Rajkumar
83a56e22ab
docs: update unit_testing_rules to cover missing and stale samples ( #9065 )
...
Signed-off-by: Arunprasad Rajkumar <arajkuma@redhat.com>
2021-07-19 15:46:14 +05:30
Levi Harrison
51e4e2a526
Updated docs
...
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-05-30 23:36:05 -04:00
Julien Pivotto
5742a18590
Fix subqueries with default resolution in promql unit tests
...
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-03-07 09:20:04 +01:00
misha
1c3e7b4241
Use strings.Builder for neater error formatting
...
Signed-off-by: misha <DL-OTTCloudPlatform-Nova@bskyb.internal>
2021-02-09 15:00:26 +00:00
Simon Pasquier
f6f23a2675
docs: update unit testing rules ( #6051 )
...
* docs: update unit testing rules
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* More nits fixed
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-09-25 09:26:53 +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
Ganesh Vernekar
420c0f5e46
Fix docs ( #4690 )
...
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2018-10-03 12:45:09 +01:00
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