Use go-spew to display diffs.

This commit is contained in:
Timo Reimann 2017-04-21 16:06:05 +02:00
parent 592a12dca2
commit e615e833bc

View file

@ -1,7 +1,6 @@
package marathon package marathon
import ( import (
"encoding/json"
"errors" "errors"
"reflect" "reflect"
"testing" "testing"
@ -11,6 +10,7 @@ import (
"github.com/containous/traefik/mocks" "github.com/containous/traefik/mocks"
"github.com/containous/traefik/testhelpers" "github.com/containous/traefik/testhelpers"
"github.com/containous/traefik/types" "github.com/containous/traefik/types"
"github.com/davecgh/go-spew/spew"
"github.com/gambol99/go-marathon" "github.com/gambol99/go-marathon"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
) )
@ -360,14 +360,10 @@ func TestMarathonLoadConfig(t *testing.T) {
} else { } else {
// Compare backends // Compare backends
if !reflect.DeepEqual(actualConfig.Backends, c.expectedBackends) { if !reflect.DeepEqual(actualConfig.Backends, c.expectedBackends) {
expected, _ := json.Marshal(c.expectedBackends) t.Errorf("got %v, want %v", spew.Sdump(actualConfig.Backends), spew.Sdump(c.expectedBackends))
actual, _ := json.Marshal(actualConfig.Backends)
t.Fatalf("expected\t %s\n, \tgot %s\n", expected, actual)
} }
if !reflect.DeepEqual(actualConfig.Frontends, c.expectedFrontends) { if !reflect.DeepEqual(actualConfig.Frontends, c.expectedFrontends) {
expected, _ := json.Marshal(c.expectedFrontends) t.Errorf("got %v, want %v", spew.Sdump(actualConfig.Frontends), spew.Sdump(c.expectedFrontends))
actual, _ := json.Marshal(actualConfig.Frontends)
t.Fatalf("expected\t %s\n, got\t %s\n", expected, actual)
} }
} }
}) })