diff options
author | Jesse Hallam <jesse.hallam@gmail.com> | 2018-08-09 05:26:38 -0400 |
---|---|---|
committer | Jesús Espino <jespinog@gmail.com> | 2018-08-09 11:26:38 +0200 |
commit | d8c8a19d355fdd67a984fc696269521919bb58b5 (patch) | |
tree | cb32477ac9031ae9e742434f7a2455d42e56da65 /store/storetest/status_store.go | |
parent | 0bbabd137bdbe04653426a1731bd8eb9225e0249 (diff) | |
download | chat-d8c8a19d355fdd67a984fc696269521919bb58b5.tar.gz chat-d8c8a19d355fdd67a984fc696269521919bb58b5.tar.bz2 chat-d8c8a19d355fdd67a984fc696269521919bb58b5.zip |
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".
Diffstat (limited to 'store/storetest/status_store.go')
-rw-r--r-- | store/storetest/status_store.go | 5 |
1 files changed, 2 insertions, 3 deletions
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) } } |