Commit Graph

21 Commits

Author SHA1 Message Date
beorn7 dc79bd6093 Improve various comments
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-25 15:59:53 +02:00
beorn7 39dbb24d13 Add helper functions for linting to testutil
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-24 23:44:59 +02:00
beorn7 6433bcf819 Add the capability to lint MetricFamilies directly
Also, change all the `dto.MetricFamily` arguments to pointers to be
more consistent with what we do in client_golang in general.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-24 23:42:49 +02:00
RainbowMango 50cda505d1 fix static check warnings by Goland.
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2020-04-24 10:15:27 +08:00
RainbowMango 3c5e60edc1 Porting promlint from prometheus/prometheus.
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2020-04-23 14:09:29 +08:00
Bartlomiej Plotka 9e9cc003f8 Added testutil.CollectAndCount
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2020-01-09 11:20:19 +00:00
beorn7 8785922956 Revert "Fix tests to adhere to the recent change in prometheus/common"
This reverts commit 2c9811f88e.

This is necessary because the changes in prometheus/common got reverted.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-01-27 23:18:44 +01:00
beorn7 b3d6096432 Improve testutil error messages
This also satisfy newer staticcheck versions.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-01-06 00:22:03 +01:00
beorn7 2c9811f88e Fix tests to adhere to the recent change in prometheus/common
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-18 17:20:25 +01:00
beorn7 c4c1f3461e Fix tiny punctuation issue in doc comment
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-15 18:40:33 +01:00
PhilipGough f9739b3d97
Compare text strings directly in testutil
Signed-off-by: PhilipGough <philip.p.gough@gmail.com>
2018-11-15 16:03:57 +00:00
PhilipGough 30503fe98e
Exposes bug #498 - unexpected results for Histograms in testutil
Signed-off-by: PhilipGough <philip.p.gough@gmail.com>
2018-11-14 11:58:43 +00:00
beorn7 86702ea6b4 Fix metric comparison for empty labels
reflect.DeepEqual is not suitable for zero occurrences of repeated
proto messages. This changes the comparison to act on the string
representation of proto messages.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-13 16:25:02 +01:00
beorn7 1db43792db Expose bug #494
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-13 15:48:48 +01:00
beorn7 74a2f46d2c Add package documentation
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-04 14:02:20 +02:00
beorn7 1301cf8fcd Add helper function to extract a simple float value from a metric
Signed-off-by: beorn7 <beorn@soundcloud.com>

foo
2018-09-04 14:02:19 +02:00
beorn7 7be86f93c1 Create an internal package
This is for types we don't want to export but which are used in
different packages within client_golang.

Currently, that's only NormalizeMetricFamilies (used in the prometheus
package and in the testutil package). More to be added as needed.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-03 00:18:11 +02:00
beorn7 5ba0993f6f Improved interface
- Expected text format is now read from an io.Reader.
- Metrics are gathered from a Gatherer.
- Added a convenience wrapper to collect from a Collector.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-02 21:07:38 +02:00
beorn7 154f28a316 Fix import grouping
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-23 00:05:02 +02:00
beorn7 e60f998e9b Make license headers consistent
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-22 23:59:40 +02:00
beorn7 df0210c26c Rename testutils to testutil and move below prometheus dir
`testutil` is more in line with stdlib naming conventions.

The package should be below `prometheus` as it only provides utils to
test exposition code, not to test HTTP client code.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-22 23:57:08 +02:00