diff --git a/model/cluster_discovery_test.go b/model/cluster_discovery_test.go index 0e4aaba4b0..28adfff2df 100644 --- a/model/cluster_discovery_test.go +++ b/model/cluster_discovery_test.go @@ -6,6 +6,8 @@ package model import ( "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestClusterDiscovery(t *testing.T) { @@ -18,9 +20,8 @@ func TestClusterDiscovery(t *testing.T) { json := o.ToJson() result1 := ClusterDiscoveryFromJson(strings.NewReader(json)) - if result1.ClusterName != "cluster_name" { - t.Fatal("should be set") - } + assert.NotNil(t, result1) + assert.Equal(t, "cluster_name", result1.ClusterName) result2 := ClusterDiscoveryFromJson(strings.NewReader(json)) result3 := ClusterDiscoveryFromJson(strings.NewReader(json)) @@ -31,9 +32,7 @@ func TestClusterDiscovery(t *testing.T) { result3.Id = "3" result3.Hostname = "something_diff" - if !o.IsEqual(result1) { - t.Fatal("Should be equal") - } + assert.True(t, o.IsEqual(result1)) list := make([]*ClusterDiscovery, 0) list = append(list, &o) @@ -45,9 +44,7 @@ func TestClusterDiscovery(t *testing.T) { return !o.IsEqual(in) }) - if len(rlist) != 1 { - t.Fatal("should only have 1 result") - } + assert.Len(t, rlist, 1) o.AutoFillHostname() o.Hostname = ""