@ -1342,7 +1342,7 @@ func TestScrapeLoopAppend(t *testing.T) {
scrapeLabels : ` metric NaN ` ,
discoveryLabels : nil ,
expLset : labels . FromStrings ( "__name__" , "metric" ) ,
expValue : float64 ( value . NormalNaN ) ,
expValue : math . Float64frombits ( value . NormalNaN ) ,
} ,
}
@ -1376,13 +1376,6 @@ func TestScrapeLoopAppend(t *testing.T) {
} ,
}
// When the expected value is NaN
// DeepEqual will report NaNs as being different,
// so replace it with the expected one.
if test . expValue == float64 ( value . NormalNaN ) {
app . resultFloats [ 0 ] . f = expected [ 0 ] . f
}
t . Logf ( "Test:%s" , test . title )
requireEqual ( t , expected , app . resultFloats )
}
@ -1390,7 +1383,7 @@ func TestScrapeLoopAppend(t *testing.T) {
func requireEqual ( t * testing . T , expected , actual interface { } , msgAndArgs ... interface { } ) {
testutil . RequireEqualWithOptions ( t , expected , actual ,
[ ] cmp . Option { cmp . AllowUnexported ( floatSample { } ) , cmp . AllowUnexported ( histogramSample { } ) } ,
[ ] cmp . Option { cmp . Comparer ( equalFloatSamples ) , cmp . AllowUnexported ( histogramSample { } ) } ,
msgAndArgs ... )
}
@ -1691,7 +1684,6 @@ func TestScrapeLoop_ChangingMetricString(t *testing.T) {
require . NoError ( t , err )
require . NoError ( t , slApp . Commit ( ) )
// DeepEqual will report NaNs as being different, so replace with a different value.
want := [ ] floatSample {
{
metric : labels . FromStrings ( "__name__" , "metric_a" , "a" , "1" , "b" , "1" ) ,
@ -1723,11 +1715,6 @@ func TestScrapeLoopAppendStaleness(t *testing.T) {
require . NoError ( t , err )
require . NoError ( t , slApp . Commit ( ) )
ingestedNaN := math . Float64bits ( app . resultFloats [ 1 ] . f )
require . Equal ( t , value . StaleNaN , ingestedNaN , "Appended stale sample wasn't as expected" )
// DeepEqual will report NaNs as being different, so replace with a different value.
app . resultFloats [ 1 ] . f = 42
want := [ ] floatSample {
{
metric : labels . FromStrings ( model . MetricNameLabel , "metric_a" ) ,
@ -1737,10 +1724,10 @@ func TestScrapeLoopAppendStaleness(t *testing.T) {
{
metric : labels . FromStrings ( model . MetricNameLabel , "metric_a" ) ,
t : timestamp . FromTime ( now . Add ( time . Second ) ) ,
f : 42 ,
f : math . Float64frombits ( value . StaleNaN ) ,
} ,
}
require . Equal ( t , want , app . resultFloats , "Appended samples not as expected:\n%s" , appender )
require Equal( t , want , app . resultFloats , "Appended samples not as expected:\n%s" , appender )
}
func TestScrapeLoopAppendNoStalenessIfTimestamp ( t * testing . T ) {
@ -1783,8 +1770,6 @@ func TestScrapeLoopAppendStalenessIfTrackTimestampStaleness(t *testing.T) {
require . NoError ( t , err )
require . NoError ( t , slApp . Commit ( ) )
// DeepEqual will report NaNs as being different, so replace with a different value.
app . resultFloats [ 1 ] . f = 42
want := [ ] floatSample {
{
metric : labels . FromStrings ( model . MetricNameLabel , "metric_a" ) ,
@ -1794,10 +1779,10 @@ func TestScrapeLoopAppendStalenessIfTrackTimestampStaleness(t *testing.T) {
{
metric : labels . FromStrings ( model . MetricNameLabel , "metric_a" ) ,
t : timestamp . FromTime ( now . Add ( time . Second ) ) ,
f : 42 ,
f : math . Float64frombits ( value . StaleNaN ) ,
} ,
}
require . Equal ( t , want , app . resultFloats , "Appended samples not as expected:\n%s" , appender )
require Equal( t , want , app . resultFloats , "Appended samples not as expected:\n%s" , appender )
}
func TestScrapeLoopAppendExemplar ( t * testing . T ) {