Merge pull request #114800 from haoruan/feature-8976-spew-sprintf-refactor

Capture spew.Sprintf() with all our favorite config into a util func
This commit is contained in:
Kubernetes Prow Robot
2023-04-11 15:34:57 -07:00
committed by GitHub
18 changed files with 418 additions and 82 deletions

View File

@@ -21,12 +21,12 @@ import (
"strings"
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/validation/field"
utilfeature "k8s.io/apiserver/pkg/util/feature"
@@ -2993,7 +2993,7 @@ func TestValidateDeploymentStatus(t *testing.T) {
errs := ValidateDeploymentStatus(&status, field.NewPath("status"))
if hasErr := len(errs) > 0; hasErr != test.expectedErr {
errString := spew.Sprintf("%#v", errs)
errString := dump.Pretty(errs)
t.Errorf("%s: expected error: %t, got error: %t\nerrors: %s", test.name, test.expectedErr, hasErr, errString)
}
}
@@ -3064,7 +3064,7 @@ func TestValidateDeploymentStatusUpdate(t *testing.T) {
errs := ValidateDeploymentStatusUpdate(to, from)
if hasErr := len(errs) > 0; hasErr != test.expectedErr {
errString := spew.Sprintf("%#v", errs)
errString := dump.Pretty(errs)
t.Errorf("%s: expected error: %t, got error: %t\nerrors: %s", test.name, test.expectedErr, hasErr, errString)
}
}