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
61d7d16e0e
commit
1431da0154
|
@ -23,12 +23,12 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"k8s.io/apiserver/pkg/apis/audit"
|
||||
|
||||
// import to call webhook's init() function to register audit.Policy to schema
|
||||
_ "k8s.io/apiserver/plugin/pkg/audit/webhook"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -113,7 +113,7 @@ func TestParser(t *testing.T) {
|
|||
|
||||
assert.Len(t, policy.Rules, 3) // Sanity check.
|
||||
if !reflect.DeepEqual(policy, expectedPolicy) {
|
||||
t.Errorf("Unexpected policy! Diff:\n%s", diff.ObjectDiff(policy, expectedPolicy))
|
||||
t.Errorf("Unexpected policy! Diff:\n%s", cmp.Diff(policy, expectedPolicy))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/emicklei/go-restful/v3"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
|
@ -2823,7 +2824,7 @@ func TestDeleteWithOptions(t *testing.T) {
|
|||
}
|
||||
simpleStorage.deleteOptions.GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
if !apiequality.Semantic.DeepEqual(simpleStorage.deleteOptions, item) {
|
||||
t.Errorf("unexpected delete options: %s", diff.ObjectDiff(simpleStorage.deleteOptions, item))
|
||||
t.Errorf("unexpected delete options: %s", cmp.Diff(simpleStorage.deleteOptions, item))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2863,7 +2864,7 @@ func TestDeleteWithOptionsQuery(t *testing.T) {
|
|||
}
|
||||
simpleStorage.deleteOptions.GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
if !apiequality.Semantic.DeepEqual(simpleStorage.deleteOptions, item) {
|
||||
t.Errorf("unexpected delete options: %s", diff.ObjectDiff(simpleStorage.deleteOptions, item))
|
||||
t.Errorf("unexpected delete options: %s", cmp.Diff(simpleStorage.deleteOptions, item))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2906,7 +2907,7 @@ func TestDeleteWithOptionsQueryAndBody(t *testing.T) {
|
|||
}
|
||||
simpleStorage.deleteOptions.GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{})
|
||||
if !apiequality.Semantic.DeepEqual(simpleStorage.deleteOptions, item) {
|
||||
t.Errorf("unexpected delete options: %s", diff.ObjectDiff(simpleStorage.deleteOptions, item))
|
||||
t.Errorf("unexpected delete options: %s", cmp.Diff(simpleStorage.deleteOptions, item))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"golang.org/x/net/websocket"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -41,7 +42,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
example "k8s.io/apiserver/pkg/apis/example"
|
||||
|
@ -397,7 +397,7 @@ func TestWatchRead(t *testing.T) {
|
|||
t.Fatalf("%s: Decode error: %v", name, err)
|
||||
}
|
||||
if e, a := object, gotObj; !apiequality.Semantic.DeepEqual(e, a) {
|
||||
t.Errorf("%s: different: %s", name, diff.ObjectDiff(e, a))
|
||||
t.Errorf("%s: different: %s", name, cmp.Diff(e, a))
|
||||
}
|
||||
}
|
||||
w.Stop()
|
||||
|
|
Loading…
Reference in New Issue