Skip to content

Commit 21e5229

Browse files
committed
tests: remove dependency on github.com/d4l3k/messagediff
Testify, which we already import and that I trust, has the same functionality. github.com/d4l3k/messagediff is a relatively small Go project (250 stars) that hasn't been updated since Nov 11, 2020.
1 parent 0e8875d commit 21e5229

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

pkg/agent/config_test.go

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"testing"
1111
"time"
1212

13-
"github.com/d4l3k/messagediff"
1413
"github.com/jetstack/preflight/pkg/client"
1514
"github.com/kylelemons/godebug/diff"
1615
"github.com/stretchr/testify/assert"
@@ -213,9 +212,7 @@ func TestValidConfigLoad(t *testing.T) {
213212
`
214213

215214
loadedConfig, err := ParseConfig([]byte(configFileContents), false)
216-
if err != nil {
217-
t.Fatalf("unexpected error: %v", err)
218-
}
215+
assert.NoError(t, err)
219216

220217
expected := Config{
221218
Server: "http://localhost:8080",
@@ -235,9 +232,7 @@ func TestValidConfigLoad(t *testing.T) {
235232
OutputPath: "/nothome",
236233
}
237234

238-
if diff, equal := messagediff.PrettyDiff(expected, loadedConfig); !equal {
239-
t.Errorf("Diff %s", diff)
240-
}
235+
assert.Equal(t, expected, loadedConfig)
241236
}
242237

243238
func TestValidConfigWithEndpointLoad(t *testing.T) {
@@ -256,9 +251,7 @@ func TestValidConfigWithEndpointLoad(t *testing.T) {
256251
`
257252

258253
loadedConfig, err := ParseConfig([]byte(configFileContents), false)
259-
if err != nil {
260-
t.Errorf("unexpected error: %v", err)
261-
}
254+
assert.NoError(t, err)
262255

263256
expected := Config{
264257
Endpoint: Endpoint{
@@ -280,9 +273,7 @@ func TestValidConfigWithEndpointLoad(t *testing.T) {
280273
},
281274
}
282275

283-
if diff, equal := messagediff.PrettyDiff(expected, loadedConfig); !equal {
284-
t.Errorf("Diff %s", diff)
285-
}
276+
assert.Equal(t, expected, loadedConfig)
286277
}
287278

288279
func TestValidVenafiCloudConfigLoad(t *testing.T) {
@@ -302,9 +293,7 @@ func TestValidVenafiCloudConfigLoad(t *testing.T) {
302293
`
303294

304295
loadedConfig, err := ParseConfig([]byte(configFileContents), false)
305-
if err != nil {
306-
t.Fatalf("unexpected error: %v", err)
307-
}
296+
assert.NoError(t, err)
308297

309298
expected := Config{
310299
Server: "http://localhost:8080",
@@ -328,9 +317,7 @@ func TestValidVenafiCloudConfigLoad(t *testing.T) {
328317
},
329318
}
330319

331-
if diff, equal := messagediff.PrettyDiff(expected, loadedConfig); !equal {
332-
t.Errorf("Diff %s", diff)
333-
}
320+
assert.Equal(t, expected, loadedConfig)
334321
}
335322

336323
func TestInvalidConfigError(t *testing.T) {

0 commit comments

Comments
 (0)