diff --git a/pkg/cmd/edit/edit_test.go b/pkg/cmd/edit/edit_test.go index 42acf702..c4746f4e 100644 --- a/pkg/cmd/edit/edit_test.go +++ b/pkg/cmd/edit/edit_test.go @@ -27,12 +27,12 @@ import ( "strings" "testing" + "github.com/google/go-cmp/cmp" "github.com/spf13/cobra" yaml "gopkg.in/yaml.v2" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" @@ -124,7 +124,7 @@ func TestEdit(t *testing.T) { // Convenience to allow recapturing the input and persisting it here os.WriteFile(inputFile, body, os.FileMode(0644)) } else { - t.Errorf("%s, step %d: diff in edit content:\n%s", name, i, diff.StringDiff(string(body), string(expectedInput))) + t.Errorf("%s, step %d: diff in edit content:\n%s", name, i, cmp.Diff(string(body), string(expectedInput))) t.Logf("If the change in input is expected, rerun tests with %s=true to update input fixtures", updateEnvVar) } } @@ -147,7 +147,7 @@ func TestEdit(t *testing.T) { // Convenience to allow recapturing the input and persisting it here os.WriteFile(inputFile, body, os.FileMode(0644)) } else { - t.Errorf("%s, step %d: diff in edit content:\n%s", name, i, diff.StringDiff(string(body), string(expectedInput))) + t.Errorf("%s, step %d: diff in edit content:\n%s", name, i, cmp.Diff(string(body), string(expectedInput))) t.Logf("If the change in input is expected, rerun tests with %s=true to update input fixtures", updateEnvVar) } } diff --git a/pkg/cmd/get/get_test.go b/pkg/cmd/get/get_test.go index c73bd15a..0776b674 100644 --- a/pkg/cmd/get/get_test.go +++ b/pkg/cmd/get/get_test.go @@ -26,6 +26,7 @@ import ( "strings" "testing" + "github.com/google/go-cmp/cmp" appsv1 "k8s.io/api/apps/v1" autoscalingv1 "k8s.io/api/autoscaling/v1" batchv1 "k8s.io/api/batch/v1" @@ -36,7 +37,6 @@ import ( metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer/streaming" - "k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/watch" "k8s.io/cli-runtime/pkg/genericiooptions" "k8s.io/cli-runtime/pkg/resource" @@ -1497,7 +1497,7 @@ func TestGetMultipleTypeObjectsAsList(t *testing.T) { } ` if e, a := expected, buf.String(); e != a { - t.Errorf("did not match: %v", diff.StringDiff(e, a)) + t.Errorf("did not match:\n%v", cmp.Diff(e, a)) } } diff --git a/pkg/explain/formatter_test.go b/pkg/explain/formatter_test.go index 41db9f55..1cf68a09 100644 --- a/pkg/explain/formatter_test.go +++ b/pkg/explain/formatter_test.go @@ -20,7 +20,7 @@ import ( "bytes" "testing" - "k8s.io/apimachinery/pkg/util/diff" + "github.com/google/go-cmp/cmp" ) func TestFormatterWrite(t *testing.T) { @@ -113,7 +113,7 @@ fringilla velit. ` if buf.String() != want { - t.Errorf("Diff:\n%s", diff.StringDiff(buf.String(), want)) + t.Errorf("Diff:\n%s", cmp.Diff(buf.String(), want)) } }