* Refactor test assertions
This pull request gets rid of assert.True where possible to use
fine-grained assertions.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
assert.True(t,len(test.result)==len(filteredRes),"%d. Number of samples in expected and actual output don't match (%d vs. %d)",i,len(test.result),len(res))
assert.Equal(t,len(test.result),len(filteredRes),"%d. Number of samples in expected and actual output don't match (%d vs. %d)",i,len(test.result),len(res))
assert.True(t,len(test.result)==len(filteredRes),"%d. Number of samples in expected and actual output don't match (%d vs. %d)",i,len(test.result),len(res))
assert.Equal(t,len(test.result),len(filteredRes),"%d. Number of samples in expected and actual output don't match (%d vs. %d)",i,len(test.result),len(res))
assert.True(t,!hashExists,"The queue for the first remote write configuration should have been restarted because the relabel configuration has changed.")
assert.False(t,hashExists,"The queue for the first remote write configuration should have been restarted because the relabel configuration has changed.")
q,hashExists:=s.queues[hashes[1]]
assert.True(t,hashExists,"Hash of unchanged queue should have remained the same")
assert.True(t,q==queues[1],"Pointer of unchanged queue should have remained the same")
assert.Equal(t,q,queues[1],"Pointer of unchanged queue should have remained the same")
_,hashExists=s.queues[hashes[2]]
assert.True(t,!hashExists,"The queue for the third remote write configuration should have been restarted because the timeout has changed.")
assert.False(t,hashExists,"The queue for the third remote write configuration should have been restarted because the timeout has changed.")
assert.True(t,expAfterDelete>expSizeInit,"after a delete the block size should be bigger as the tombstone file should grow %v > %v",expAfterDelete,expSizeInit)
assert.Greater(t,expAfterDelete,expSizeInit,"after a delete the block size should be bigger as the tombstone file should grow %v > %v",expAfterDelete,expSizeInit)
assert.Equal(t,int64(DefaultOptions().WALSegmentSize),f.Size(),"WAL file size doesn't match WALSegmentSize option, filename: %v",f.Name())
}
lastFile:=files[len(files)-1]
assert.True(t,int64(DefaultOptions().WALSegmentSize)>lastFile.Size(),"last WAL file size is not smaller than the WALSegmentSize option, filename: %v",lastFile.Name())
assert.Greater(t,int64(DefaultOptions().WALSegmentSize),lastFile.Size(),"last WAL file size is not smaller than the WALSegmentSize option, filename: %v",lastFile.Name())
// Verify that the segment is the same or smaller than the expected size.
assert.True(t,chunks.SegmentHeaderSize+test.expSegmentSizes[i]>=size,"Segment:%v should NOT be bigger than:%v actual:%v",i,chunks.SegmentHeaderSize+test.expSegmentSizes[i],size)
assert.GreaterOrEqual(t,chunks.SegmentHeaderSize+test.expSegmentSizes[i],size,"Segment:%v should NOT be bigger than:%v actual:%v",i,chunks.SegmentHeaderSize+test.expSegmentSizes[i],size)
assert.True(t,float64(uncompressedSize)*0.75>float64(compressedSize),"Compressing zeroes should save at least 25%% space - uncompressedSize: %d, compressedSize: %d",uncompressedSize,compressedSize)
assert.Greater(t,float64(uncompressedSize)*0.75,float64(compressedSize),"Compressing zeroes should save at least 25%% space - uncompressedSize: %d, compressedSize: %d",uncompressedSize,compressedSize)