From 95dc59ec7e4ee2885b8ffb809ba5cefed7f17202 Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Wed, 2 Oct 2019 01:28:08 -0400 Subject: [PATCH] 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 * Added period to meet contributing guidelines Signed-off-by: Joe Elliott * Removed fatal testutil method. Refactored test cases to use testutil.Assert Signed-off-by: Joe Elliott * Added if found condition for clarity Signed-off-by: Joe Elliott --- storage/buffer_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/buffer_test.go b/storage/buffer_test.go index b58e6321e0..9ef7f5da9a 100644 --- a/storage/buffer_test.go +++ b/storage/buffer_test.go @@ -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) } } }