Replaced t.Fatalf() with testutil.Assert() in buffer_test.go (#6084)

* Added Fatal method and used it in buffer_test

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added period to meet contributing guidelines

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Removed fatal testutil method.  Refactored test cases to use testutil.Assert

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Added if found condition for clarity

Signed-off-by: Joe Elliott <number101010@gmail.com>
This commit is contained in:
Joe Elliott 2019-10-02 01:28:08 -04:00 committed by Bartlomiej Plotka
parent 188917a16a
commit 95dc59ec7e

View file

@ -77,11 +77,11 @@ func TestSampleRing(t *testing.T) {
break
}
}
if sold.t >= s.t-c.delta && !found {
t.Fatalf("%d: expected sample %d to be in buffer but was not; buffer %v", i, sold.t, buffered)
}
if sold.t < s.t-c.delta && found {
t.Fatalf("%d: unexpected sample %d in buffer; buffer %v", i, sold.t, buffered)
if found {
testutil.Assert(t, sold.t >= s.t-c.delta, "%d: unexpected sample %d in buffer; buffer %v", i, sold.t, buffered)
} else {
testutil.Assert(t, sold.t < s.t-c.delta, "%d: expected sample %d to be in buffer but was not; buffer %v", i, sold.t, buffered)
}
}
}