MM-19138 - Adjust test to use require. (#12585)

* Adjust test to use require.

* Use assert instead of require.
This commit is contained in:
Kevin Grandjean
2019-10-10 15:27:36 +02:00
committed by Harrison Healey
parent 7a0d9149eb
commit 1635eb6006

View File

@@ -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 = ""