Signed-off-by: Vanshikav123 <vanshikav928@gmail.com>
This commit is contained in:
Vanshikav123 2024-08-28 16:16:18 +05:30
parent 4ecdfe0d72
commit 60b0d1c012

View file

@ -1206,6 +1206,8 @@ func TestSetHintsHandlingStaleness(t *testing.T) {
go func() {
runScrapeLoop(ctx, t, capp, 2, func(sl *scrapeLoop) {
go sl.stop()
// Wait a bit then start a new target.
time.Sleep(5 * time.Millisecond)
go func() {
runScrapeLoop(ctx, t, capp, 4, func(_ *scrapeLoop) {
cancel()
@ -1228,9 +1230,10 @@ func TestSetHintsHandlingStaleness(t *testing.T) {
for _, v := range capp.resultFloats {
if v.metric.Get("__name__") == "metric_a" {
// Check for out-of-order samples
//fmt.Println(v)
fmt.Println(v)
if v.t <= prevT {
// Ensure out-of-order sample's value is NaN
//fmt.Println(prevT)
require.True(t, math.IsNaN(v.f), "Expected NaN value for out-of-order sample at timestamp %d", v.t)
}
prevT = v.t