mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Add more test cases
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
This commit is contained in:
parent
be7a4c9b83
commit
2cd97c61e0
|
@ -63,6 +63,39 @@ func TestHistogramStatsDecoding(t *testing.T) {
|
||||||
histogram.NotCounterReset,
|
histogram.NotCounterReset,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "unknown counter reset at the beginning",
|
||||||
|
histograms: []*histogram.Histogram{
|
||||||
|
tsdbutil.GenerateTestHistogramWithHint(1, histogram.UnknownCounterReset),
|
||||||
|
},
|
||||||
|
expectedHints: []histogram.CounterResetHint{
|
||||||
|
histogram.NotCounterReset,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "detect real counter reset",
|
||||||
|
histograms: []*histogram.Histogram{
|
||||||
|
tsdbutil.GenerateTestHistogramWithHint(2, histogram.UnknownCounterReset),
|
||||||
|
tsdbutil.GenerateTestHistogramWithHint(1, histogram.UnknownCounterReset),
|
||||||
|
},
|
||||||
|
expectedHints: []histogram.CounterResetHint{
|
||||||
|
histogram.NotCounterReset,
|
||||||
|
histogram.CounterReset,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "detect real counter reset after stale NaN",
|
||||||
|
histograms: []*histogram.Histogram{
|
||||||
|
tsdbutil.GenerateTestHistogramWithHint(2, histogram.UnknownCounterReset),
|
||||||
|
{Sum: math.Float64frombits(value.StaleNaN)},
|
||||||
|
tsdbutil.GenerateTestHistogramWithHint(1, histogram.UnknownCounterReset),
|
||||||
|
},
|
||||||
|
expectedHints: []histogram.CounterResetHint{
|
||||||
|
histogram.NotCounterReset,
|
||||||
|
histogram.UnknownCounterReset,
|
||||||
|
histogram.CounterReset,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
|
Loading…
Reference in a new issue