Using assert for equality checks

This commit is contained in:
Ajay Kelkar
2018-10-03 14:19:54 +05:30
parent 27a0b2460d
commit 68bce4f57c

View File

@@ -3,25 +3,19 @@ package cri_test
import (
"testing"
"github.com/bmizerany/assert"
"github.com/weaveworks/scope/probe/cri"
)
func TestParseHttpEndpointUrl(t *testing.T) {
_, err := cri.NewCRIClient("http://xyz.com")
if err == nil {
t.Fatal("Should not create client with Http protocol")
}
assert.Equal(t, "protocol \"http\" not supported", err.Error())
}
func TestParseTcpEndpointUrl(t *testing.T) {
client, err := cri.NewCRIClient("127.0.0.1")
if err != nil {
t.Fatal("Should have created service client")
}
if client == nil {
t.Fatal("Should have created service client")
}
assert.Equal(t, nil, err)
assert.NotEqual(t, nil, client)
}