From d8c8a19d355fdd67a984fc696269521919bb58b5 Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Thu, 9 Aug 2018 05:26:38 -0400 Subject: avoid t.Fatal() in tests (#9189) I've been burned a few times by tests that simply fatal, requiring me to run another build to learn more about what the mismatch was. Avoid this. This is part of a long running goal of mine to make testing "better". --- store/storetest/status_store.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'store/storetest/status_store.go') diff --git a/store/storetest/status_store.go b/store/storetest/status_store.go index b26be4c19..5231bc29a 100644 --- a/store/storetest/status_store.go +++ b/store/storetest/status_store.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/store" @@ -103,9 +104,7 @@ func testActiveUserCount(t *testing.T, ss store.Store) { t.Fatal(result.Err) } else { count := result.Data.(int64) - if count <= 0 { - t.Fatal() - } + require.True(t, count > 0, "expected count > 0, got %d", count) } } -- cgit v1.2.3-1-g7c22