Replace uses of diff.ObjectDiff with cmp.Diff
ObjectDiff is already a shim over cmp.Diff, so no actual output or behavior changes Kubernetes-commit: 29c0b73d640b6e50c4f2dfeee7b07ca66a530dbd
This commit is contained in:
parent
a431fc3d05
commit
ece694d5d1
|
@ -24,8 +24,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"k8s.io/cli-runtime/pkg/genericiooptions"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
|
@ -896,7 +896,7 @@ func (test configCommandTest) run(t *testing.T) string {
|
|||
testClearLocationOfOrigin(&actualConfig)
|
||||
|
||||
if !apiequality.Semantic.DeepEqual(test.expectedConfig, actualConfig) {
|
||||
t.Errorf("diff: %v", diff.ObjectDiff(test.expectedConfig, actualConfig))
|
||||
t.Errorf("diff: %v", cmp.Diff(test.expectedConfig, actualConfig))
|
||||
t.Errorf("expected: %#v\n actual: %#v", test.expectedConfig, actualConfig)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
)
|
||||
|
||||
|
@ -102,7 +102,7 @@ func (test stepParserTest) run(t *testing.T) {
|
|||
}
|
||||
|
||||
if !reflect.DeepEqual(test.expectedNavigationSteps, *actualSteps) {
|
||||
t.Errorf("diff: %v", diff.ObjectDiff(test.expectedNavigationSteps, *actualSteps))
|
||||
t.Errorf("diff: %v", cmp.Diff(test.expectedNavigationSteps, *actualSteps))
|
||||
t.Errorf("expected: %#v\n actual: %#v", test.expectedNavigationSteps, *actualSteps)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
@ -29,7 +30,6 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
fakeexternal "k8s.io/client-go/kubernetes/fake"
|
||||
testclient "k8s.io/client-go/testing"
|
||||
"k8s.io/kubectl/pkg/cmd/util/podcmd"
|
||||
|
@ -422,7 +422,7 @@ func TestLogsForObject(t *testing.T) {
|
|||
got := fakeClientset.Actions()[i]
|
||||
want := test.actions[i]
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("%s: unexpected diff for action: %s", test.name, diff.ObjectDiff(got, want))
|
||||
t.Errorf("%s: unexpected diff for action: %s", test.name, cmp.Diff(got, want))
|
||||
}
|
||||
}
|
||||
for i++; i < len(fakeClientset.Actions()); i++ {
|
||||
|
|
|
@ -19,11 +19,11 @@ package scheme
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/api/batch/v1"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
v1 "k8s.io/api/batch/v1"
|
||||
"k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
)
|
||||
|
||||
func TestCronJob(t *testing.T) {
|
||||
|
@ -48,6 +48,6 @@ func TestCronJob(t *testing.T) {
|
|||
uncastDst.(*v1.CronJob).TypeMeta = metav1.TypeMeta{}
|
||||
|
||||
if !equality.Semantic.DeepEqual(src, uncastDst) {
|
||||
t.Fatal(diff.ObjectDiff(src, uncastDst))
|
||||
t.Fatal(cmp.Diff(src, uncastDst))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue