From 2ad78b3e5106cc208b6e742665a9b6e873dd6e10 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 6 Dec 2017 17:15:02 -0800 Subject: [PATCH] use test utils in buffer_test --- tsdbutil/buffer_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tsdbutil/buffer_test.go b/tsdbutil/buffer_test.go index 3f3dc9b52..d8db139a7 100644 --- a/tsdbutil/buffer_test.go +++ b/tsdbutil/buffer_test.go @@ -5,7 +5,7 @@ import ( "sort" "testing" - "github.com/stretchr/testify/require" + "github.com/prometheus/tsdb/testutil" ) func TestSampleRing(t *testing.T) { @@ -79,12 +79,12 @@ func TestBufferedSeriesIterator(t *testing.T) { t, v := bit.At() b = append(b, sample{t: t, v: v}) } - require.Equal(t, exp, b, "buffer mismatch") + testutil.Equals(t, exp, b) } sampleEq := func(ets int64, ev float64) { ts, v := it.At() - require.Equal(t, ets, ts, "timestamp mismatch") - require.Equal(t, ev, v, "value mismatch") + testutil.Equals(t, ets, ts) + testutil.Equals(t, ev, v) } it = NewBuffer(newListSeriesIterator([]sample{ @@ -98,29 +98,29 @@ func TestBufferedSeriesIterator(t *testing.T) { {t: 101, v: 10}, }), 2) - require.True(t, it.Seek(-123), "seek failed") + testutil.Assert(t, it.Seek(-123) == true, "seek failed") sampleEq(1, 2) bufferEq(nil) - require.True(t, it.Next(), "next failed") + testutil.Assert(t, it.Next() == true, "next failed") sampleEq(2, 3) bufferEq([]sample{{t: 1, v: 2}}) - require.True(t, it.Next(), "next failed") - require.True(t, it.Next(), "next failed") - require.True(t, it.Next(), "next failed") + testutil.Assert(t, it.Next() == true, "next failed") + testutil.Assert(t, it.Next() == true, "next failed") + testutil.Assert(t, it.Next() == true, "next failed") sampleEq(5, 6) bufferEq([]sample{{t: 2, v: 3}, {t: 3, v: 4}, {t: 4, v: 5}}) - require.True(t, it.Seek(5), "seek failed") + testutil.Assert(t, it.Seek(5) == true, "seek failed") sampleEq(5, 6) bufferEq([]sample{{t: 2, v: 3}, {t: 3, v: 4}, {t: 4, v: 5}}) - require.True(t, it.Seek(101), "seek failed") + testutil.Assert(t, it.Seek(101) == true, "seek failed") sampleEq(101, 10) bufferEq([]sample{{t: 99, v: 8}, {t: 100, v: 9}}) - require.False(t, it.Next(), "next succeeded unexpectedly") + testutil.Assert(t, it.Next() == false, "next succeeded unexpectedly") } type listSeriesIterator struct {