replace spew methods with dump methods

This commit is contained in:
Hao Ruan 2023-04-13 09:41:07 +08:00
parent c3e3ff989a
commit c4e1b01416
33 changed files with 80 additions and 100 deletions

2
go.mod
View File

@ -26,7 +26,6 @@ require (
github.com/coreos/go-systemd/v22 v22.4.0 github.com/coreos/go-systemd/v22 v22.4.0
github.com/cpuguy83/go-md2man/v2 v2.0.2 github.com/cpuguy83/go-md2man/v2 v2.0.2
github.com/cyphar/filepath-securejoin v0.2.3 github.com/cyphar/filepath-securejoin v0.2.3
github.com/davecgh/go-spew v1.1.1
github.com/docker/distribution v2.8.1+incompatible github.com/docker/distribution v2.8.1+incompatible
github.com/docker/go-units v0.5.0 github.com/docker/go-units v0.5.0
github.com/emicklei/go-restful/v3 v3.9.0 github.com/emicklei/go-restful/v3 v3.9.0
@ -154,6 +153,7 @@ require (
github.com/containerd/ttrpc v1.1.0 // indirect github.com/containerd/ttrpc v1.1.0 // indirect
github.com/coredns/caddy v1.1.0 // indirect github.com/coredns/caddy v1.1.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/daviddengcn/go-colortext v1.0.0 // indirect github.com/daviddengcn/go-colortext v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect
github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect

View File

@ -20,9 +20,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/davecgh/go-spew/spew" v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/informers" "k8s.io/client-go/informers"
@ -34,10 +32,6 @@ import (
"k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/controller"
) )
func init() {
spew.Config.DisableMethods = true
}
const testTokenID = "abc123" const testTokenID = "abc123"
func newSigner() (*Signer, *fake.Clientset, coreinformers.SecretInformer, coreinformers.ConfigMapInformer, error) { func newSigner() (*Signer, *fake.Clientset, coreinformers.SecretInformer, coreinformers.ConfigMapInformer, error) {

View File

@ -19,11 +19,10 @@ package bootstrap
import ( import (
"testing" "testing"
"github.com/davecgh/go-spew/spew" v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/dump"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
bootstrapapi "k8s.io/cluster-bootstrap/token/api" bootstrapapi "k8s.io/cluster-bootstrap/token/api"
"k8s.io/kubernetes/pkg/apis/core/helper" "k8s.io/kubernetes/pkg/apis/core/helper"
@ -56,13 +55,13 @@ func addSecretSigningUsage(s *v1.Secret, value string) {
func verifyActions(t *testing.T, expected, actual []core.Action) { func verifyActions(t *testing.T, expected, actual []core.Action) {
for i, a := range actual { for i, a := range actual {
if len(expected) < i+1 { if len(expected) < i+1 {
t.Errorf("%d unexpected actions: %s", len(actual)-len(expected), spew.Sdump(actual[i:])) t.Errorf("%d unexpected actions: %s", len(actual)-len(expected), dump.Pretty(actual[i:]))
break break
} }
e := expected[i] e := expected[i]
if !helper.Semantic.DeepEqual(e, a) { if !helper.Semantic.DeepEqual(e, a) {
t.Errorf("Expected\n\t%s\ngot\n\t%s", spew.Sdump(e), spew.Sdump(a)) t.Errorf("Expected\n\t%s\ngot\n\t%s", dump.Pretty(e), dump.Pretty(a))
continue continue
} }
} }
@ -70,7 +69,7 @@ func verifyActions(t *testing.T, expected, actual []core.Action) {
if len(expected) > len(actual) { if len(expected) > len(actual) {
t.Errorf("%d additional expected actions", len(expected)-len(actual)) t.Errorf("%d additional expected actions", len(expected)-len(actual))
for _, a := range expected[len(actual):] { for _, a := range expected[len(actual):] {
t.Logf(" %s", spew.Sdump(a)) t.Logf(" %s", dump.Pretty(a))
} }
} }
} }

View File

@ -21,8 +21,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -33,10 +31,6 @@ import (
api "k8s.io/kubernetes/pkg/apis/core" api "k8s.io/kubernetes/pkg/apis/core"
) )
func init() {
spew.Config.DisableMethods = true
}
func newTokenCleaner() (*TokenCleaner, *fake.Clientset, coreinformers.SecretInformer, error) { func newTokenCleaner() (*TokenCleaner, *fake.Clientset, coreinformers.SecretInformer, error) {
options := DefaultTokenCleanerOptions() options := DefaultTokenCleanerOptions()
cl := fake.NewSimpleClientset() cl := fake.NewSimpleClientset()

View File

@ -22,11 +22,11 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/dump"
) )
var ( var (
@ -338,23 +338,23 @@ func TestToDOTGraphObj(t *testing.T) {
func compareGraphs(expectedNodes, actualNodes []*dotVertex, expectedEdges, actualEdges []dotEdge, t *testing.T) { func compareGraphs(expectedNodes, actualNodes []*dotVertex, expectedEdges, actualEdges []dotEdge, t *testing.T) {
if len(expectedNodes) != len(actualNodes) { if len(expectedNodes) != len(actualNodes) {
t.Fatal(spew.Sdump(actualNodes)) t.Fatal(dump.Pretty(actualNodes))
} }
for i := range expectedNodes { for i := range expectedNodes {
currExpected := expectedNodes[i] currExpected := expectedNodes[i]
currActual := actualNodes[i] currActual := actualNodes[i]
if currExpected.uid != currActual.uid { if currExpected.uid != currActual.uid {
t.Errorf("expected %v, got %v", spew.Sdump(currExpected), spew.Sdump(currActual)) t.Errorf("expected %v, got %v", dump.Pretty(currExpected), dump.Pretty(currActual))
} }
} }
if len(expectedEdges) != len(actualEdges) { if len(expectedEdges) != len(actualEdges) {
t.Fatal(spew.Sdump(actualEdges)) t.Fatal(dump.Pretty(actualEdges))
} }
for i := range expectedEdges { for i := range expectedEdges {
currExpected := expectedEdges[i] currExpected := expectedEdges[i]
currActual := actualEdges[i] currActual := actualEdges[i]
if currExpected != currActual { if currExpected != currActual {
t.Errorf("expected %v, got %v", spew.Sdump(currExpected), spew.Sdump(currActual)) t.Errorf("expected %v, got %v", dump.Pretty(currExpected), dump.Pretty(currActual))
} }
} }
} }

View File

@ -21,12 +21,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
"gopkg.in/square/go-jose.v2/jwt" "gopkg.in/square/go-jose.v2/jwt"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
utilrand "k8s.io/apimachinery/pkg/util/rand" utilrand "k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/informers" "k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/fake"
@ -547,7 +547,7 @@ func TestTokenCreation(t *testing.T) {
expectedAction := tc.ExpectedActions[i] expectedAction := tc.ExpectedActions[i]
if !reflect.DeepEqual(expectedAction, action) { if !reflect.DeepEqual(expectedAction, action) {
t.Errorf("%s:\nExpected:\n%s\ngot:\n%s", k, spew.Sdump(expectedAction), spew.Sdump(action)) t.Errorf("%s:\nExpected:\n%s\ngot:\n%s", k, dump.Pretty(expectedAction), dump.Pretty(action))
continue continue
} }
} }

View File

@ -23,8 +23,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/api/meta"
@ -32,6 +30,7 @@ import (
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/client-go/informers" "k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/fake"
clienttesting "k8s.io/client-go/testing" clienttesting "k8s.io/client-go/testing"
@ -470,13 +469,13 @@ func TestPVCProtectionController(t *testing.T) {
actions := client.Actions() actions := client.Actions()
for i, action := range actions { for i, action := range actions {
if len(test.expectedActions) < i+1 { if len(test.expectedActions) < i+1 {
t.Errorf("Test %q: %d unexpected actions: %+v", test.name, len(actions)-len(test.expectedActions), spew.Sdump(actions[i:])) t.Errorf("Test %q: %d unexpected actions: %+v", test.name, len(actions)-len(test.expectedActions), dump.Pretty(actions[i:]))
break break
} }
expectedAction := test.expectedActions[i] expectedAction := test.expectedActions[i]
if !reflect.DeepEqual(expectedAction, action) { if !reflect.DeepEqual(expectedAction, action) {
t.Errorf("Test %q: action %d\nExpected:\n%s\ngot:\n%s", test.name, i, spew.Sdump(expectedAction), spew.Sdump(action)) t.Errorf("Test %q: action %d\nExpected:\n%s\ngot:\n%s", test.name, i, dump.Pretty(expectedAction), dump.Pretty(action))
} }
} }

View File

@ -23,14 +23,13 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/client-go/informers" "k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/fake"
clienttesting "k8s.io/client-go/testing" clienttesting "k8s.io/client-go/testing"
@ -252,7 +251,7 @@ func TestPVProtectionController(t *testing.T) {
actions := client.Actions() actions := client.Actions()
if !reflect.DeepEqual(actions, test.expectedActions) { if !reflect.DeepEqual(actions, test.expectedActions) {
t.Errorf("Test %q: action not expected\nExpected:\n%s\ngot:\n%s", test.name, spew.Sdump(test.expectedActions), spew.Sdump(actions)) t.Errorf("Test %q: action not expected\nExpected:\n%s\ngot:\n%s", test.name, dump.Pretty(test.expectedActions), dump.Pretty(actions))
} }
} }

View File

@ -20,7 +20,6 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
@ -28,6 +27,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apiserver/pkg/authentication/request/headerrequest" "k8s.io/apiserver/pkg/authentication/request/headerrequest"
"k8s.io/apiserver/pkg/server/dynamiccertificates" "k8s.io/apiserver/pkg/server/dynamiccertificates"
@ -312,7 +312,7 @@ func getFinalConfigMaps(t *testing.T, client *fake.Clientset) (map[string]*corev
created := false created := false
for _, action := range client.Actions() { for _, action := range client.Actions() {
t.Log(spew.Sdump(action)) t.Log(dump.Pretty(action))
if action.Matches("create", "configmaps") { if action.Matches("create", "configmaps") {
created = true created = true
obj := action.(clienttesting.CreateAction).GetObject().(*corev1.ConfigMap) obj := action.(clienttesting.CreateAction).GetObject().(*corev1.ConfigMap)

View File

@ -25,11 +25,10 @@ import (
"time" "time"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
utilproxy "k8s.io/kubernetes/pkg/proxy/util" utilproxy "k8s.io/kubernetes/pkg/proxy/util"
testingclock "k8s.io/utils/clock/testing" testingclock "k8s.io/utils/clock/testing"
"github.com/davecgh/go-spew/spew"
) )
type fakeListener struct { type fakeListener struct {
@ -176,10 +175,10 @@ func TestServer(t *testing.T) {
t.Errorf("expected 0 endpoints, got %d", hcs.services[nsn].endpoints) t.Errorf("expected 0 endpoints, got %d", hcs.services[nsn].endpoints)
} }
if len(listener.openPorts) != 1 { if len(listener.openPorts) != 1 {
t.Errorf("expected 1 open port, got %d\n%s", len(listener.openPorts), spew.Sdump(listener.openPorts)) t.Errorf("expected 1 open port, got %d\n%s", len(listener.openPorts), dump.Pretty(listener.openPorts))
} }
if !listener.hasPort(":9376") { if !listener.hasPort(":9376") {
t.Errorf("expected port :9376 to be open\n%s", spew.Sdump(listener.openPorts)) t.Errorf("expected port :9376 to be open\n%s", dump.Pretty(listener.openPorts))
} }
// test the handler // test the handler
testHandler(hcs, nsn, http.StatusServiceUnavailable, 0, t) testHandler(hcs, nsn, http.StatusServiceUnavailable, 0, t)
@ -262,7 +261,7 @@ func TestServer(t *testing.T) {
t.Errorf("expected 0 endpoints, got %d", hcs.services[nsn3].endpoints) t.Errorf("expected 0 endpoints, got %d", hcs.services[nsn3].endpoints)
} }
if len(listener.openPorts) != 3 { if len(listener.openPorts) != 3 {
t.Errorf("expected 3 open ports, got %d\n%s", len(listener.openPorts), spew.Sdump(listener.openPorts)) t.Errorf("expected 3 open ports, got %d\n%s", len(listener.openPorts), dump.Pretty(listener.openPorts))
} }
// test the handlers // test the handlers
testHandler(hcs, nsn1, http.StatusServiceUnavailable, 0, t) testHandler(hcs, nsn1, http.StatusServiceUnavailable, 0, t)
@ -505,10 +504,10 @@ func TestServerWithSelectiveListeningAddress(t *testing.T) {
t.Errorf("expected 0 endpoints, got %d", hcs.services[nsn].endpoints) t.Errorf("expected 0 endpoints, got %d", hcs.services[nsn].endpoints)
} }
if len(listener.openPorts) != 1 { if len(listener.openPorts) != 1 {
t.Errorf("expected 1 open port, got %d\n%s", len(listener.openPorts), spew.Sdump(listener.openPorts)) t.Errorf("expected 1 open port, got %d\n%s", len(listener.openPorts), dump.Pretty(listener.openPorts))
} }
if !listener.hasPort("127.0.0.1:9376") { if !listener.hasPort("127.0.0.1:9376") {
t.Errorf("expected port :9376 to be open\n%s", spew.Sdump(listener.openPorts)) t.Errorf("expected port :9376 to be open\n%s", dump.Pretty(listener.openPorts))
} }
// test the handler // test the handler
testHandler(hcs, nsn, http.StatusServiceUnavailable, 0, t) testHandler(hcs, nsn, http.StatusServiceUnavailable, 0, t)

View File

@ -21,11 +21,10 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
netutils "k8s.io/utils/net" netutils "k8s.io/utils/net"
@ -470,7 +469,7 @@ func TestServiceToServiceMap(t *testing.T) {
newServices := svcTracker.serviceToServiceMap(tc.service) newServices := svcTracker.serviceToServiceMap(tc.service)
if len(newServices) != len(tc.expected) { if len(newServices) != len(tc.expected) {
t.Fatalf("expected %d new, got %d: %v", len(tc.expected), len(newServices), spew.Sdump(newServices)) t.Fatalf("expected %d new, got %d: %v", len(tc.expected), len(newServices), dump.Pretty(newServices))
} }
for svcKey, expectedInfo := range tc.expected { for svcKey, expectedInfo := range tc.expected {
svcInfo, exists := newServices[svcKey].(*BaseServicePortInfo) svcInfo, exists := newServices[svcKey].(*BaseServicePortInfo)

View File

@ -21,11 +21,10 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission"
api "k8s.io/kubernetes/pkg/apis/core" api "k8s.io/kubernetes/pkg/apis/core"
volumeutil "k8s.io/kubernetes/pkg/volume/util" volumeutil "k8s.io/kubernetes/pkg/volume/util"
@ -117,7 +116,7 @@ func TestAdmit(t *testing.T) {
t.Errorf("Test %q: got unexpected error: %v", test.name, err) t.Errorf("Test %q: got unexpected error: %v", test.name, err)
} }
if !reflect.DeepEqual(test.expectedObject, obj) { if !reflect.DeepEqual(test.expectedObject, obj) {
t.Errorf("Test %q: Expected object:\n%s\ngot:\n%s", test.name, spew.Sdump(test.expectedObject), spew.Sdump(obj)) t.Errorf("Test %q: Expected object:\n%s\ngot:\n%s", test.name, dump.Pretty(test.expectedObject), dump.Pretty(obj))
} }
}) })
} }

View File

@ -21,8 +21,8 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/davecgh/go-spew/spew" jsonpatch "github.com/evanphx/json-patch"
"github.com/evanphx/json-patch" "k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/json"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
) )
@ -733,7 +733,7 @@ func jsonToYAMLOrError(j []byte) string {
func toJSON(v interface{}) ([]byte, error) { func toJSON(v interface{}) ([]byte, error) {
j, err := json.Marshal(v) j, err := json.Marshal(v)
if err != nil { if err != nil {
return nil, fmt.Errorf("json marshal failed: %v\n%v\n", err, spew.Sdump(v)) return nil, fmt.Errorf("json marshal failed: %v\n%v\n", err, dump.Pretty(v))
} }
return j, nil return j, nil
} }

View File

@ -23,10 +23,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/util/mergepatch" "k8s.io/apimachinery/pkg/util/mergepatch"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
@ -6365,7 +6365,7 @@ func jsonToYAMLOrError(j []byte) string {
func toJSON(v interface{}) ([]byte, error) { func toJSON(v interface{}) ([]byte, error) {
j, err := json.Marshal(v) j, err := json.Marshal(v)
if err != nil { if err != nil {
return nil, fmt.Errorf("json marshal failed: %v\n%v\n", err, spew.Sdump(v)) return nil, fmt.Errorf("json marshal failed: %v\n%v\n", err, dump.Pretty(v))
} }
return j, nil return j, nil

View File

@ -7,7 +7,6 @@ go 1.20
require ( require (
github.com/coreos/go-oidc v2.1.0+incompatible github.com/coreos/go-oidc v2.1.0+incompatible
github.com/coreos/go-systemd/v22 v22.4.0 github.com/coreos/go-systemd/v22 v22.4.0
github.com/davecgh/go-spew v1.1.1
github.com/emicklei/go-restful/v3 v3.9.0 github.com/emicklei/go-restful/v3 v3.9.0
github.com/evanphx/json-patch v4.12.0+incompatible github.com/evanphx/json-patch v4.12.0+incompatible
github.com/fsnotify/fsnotify v1.6.0 github.com/fsnotify/fsnotify v1.6.0
@ -66,6 +65,7 @@ require (
github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/logr v1.2.3 // indirect

View File

@ -21,9 +21,9 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/version" "k8s.io/apimachinery/pkg/version"
"k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/registry/rest"
@ -330,7 +330,7 @@ func Test_removeDeletedKinds(t *testing.T) {
convertor := &dummyConvertor{} convertor := &dummyConvertor{}
tt.resourceExpirationEvaluator.RemoveDeletedKinds("group.name", convertor, tt.versionedResourcesStorageMap) tt.resourceExpirationEvaluator.RemoveDeletedKinds("group.name", convertor, tt.versionedResourcesStorageMap)
if !reflect.DeepEqual(tt.expectedStorage, tt.versionedResourcesStorageMap) { if !reflect.DeepEqual(tt.expectedStorage, tt.versionedResourcesStorageMap) {
t.Fatal(spew.Sdump(tt.versionedResourcesStorageMap)) t.Fatal(dump.Pretty(tt.versionedResourcesStorageMap))
} }
}) })
} }

View File

@ -20,7 +20,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/davecgh/go-spew/spew" "k8s.io/apimachinery/pkg/util/dump"
) )
var serverKey = []byte(`-----BEGIN RSA PRIVATE KEY----- var serverKey = []byte(`-----BEGIN RSA PRIVATE KEY-----
@ -114,7 +114,7 @@ func TestNewStaticCertKeyContent(t *testing.T) {
} }
actual, err := c.newTLSContent() actual, err := c.newTLSContent()
if !reflect.DeepEqual(actual, test.expected) { if !reflect.DeepEqual(actual, test.expected) {
t.Error(spew.Sdump(actual)) t.Error(dump.Pretty(actual))
} }
switch { switch {
case err == nil && len(test.expectedErr) == 0: case err == nil && len(test.expectedErr) == 0:

View File

@ -5,7 +5,6 @@ module k8s.io/cli-runtime
go 1.20 go 1.20
require ( require (
github.com/davecgh/go-spew v1.1.1
github.com/evanphx/json-patch v4.12.0+incompatible github.com/evanphx/json-patch v4.12.0+incompatible
github.com/google/gnostic v0.5.7-v3refs github.com/google/gnostic v0.5.7-v3refs
github.com/google/go-cmp v0.5.9 github.com/google/go-cmp v0.5.9
@ -28,6 +27,7 @@ require (
) )
require ( require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/logr v1.2.3 // indirect

View File

@ -30,7 +30,6 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
apiequality "k8s.io/apimachinery/pkg/api/equality" apiequality "k8s.io/apimachinery/pkg/api/equality"
@ -41,6 +40,7 @@ import (
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer/streaming" "k8s.io/apimachinery/pkg/runtime/serializer/streaming"
"k8s.io/apimachinery/pkg/util/dump"
utilerrors "k8s.io/apimachinery/pkg/util/errors" utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
@ -542,11 +542,11 @@ func TestPathBuilderWithMultiple(t *testing.T) {
switch tt.object.(type) { switch tt.object.(type) {
case *v1.Pod: case *v1.Pod:
if _, ok := v.Object.(*v1.Pod); !ok || v.Name != tt.expectedNames[i] || v.Namespace != "test" { if _, ok := v.Object.(*v1.Pod); !ok || v.Name != tt.expectedNames[i] || v.Namespace != "test" {
t.Errorf("unexpected info: %v", spew.Sdump(v.Object)) t.Errorf("unexpected info: %v", dump.Pretty(v.Object))
} }
case *v1.ReplicationController: case *v1.ReplicationController:
if _, ok := v.Object.(*v1.ReplicationController); !ok || v.Name != tt.expectedNames[i] || v.Namespace != "test" { if _, ok := v.Object.(*v1.ReplicationController); !ok || v.Name != tt.expectedNames[i] || v.Namespace != "test" {
t.Errorf("unexpected info: %v", spew.Sdump(v.Object)) t.Errorf("unexpected info: %v", dump.Pretty(v.Object))
} }
} }
} }

View File

@ -17,10 +17,11 @@ limitations under the License.
package resource package resource
import ( import (
"github.com/davecgh/go-spew/spew" "testing"
"k8s.io/apimachinery/pkg/util/dump"
"sigs.k8s.io/kustomize/api/konfig" "sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/kyaml/filesys" "sigs.k8s.io/kustomize/kyaml/filesys"
"testing"
) )
const ( const (
@ -151,7 +152,7 @@ func TestKustomizeVisitor(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if len(tv.Infos) != 4 { if len(tv.Infos) != 4 {
t.Fatal(spew.Sdump(tv.Infos)) t.Fatal(dump.Pretty(tv.Infos))
} }
if string(kv.yml) != expectedContent { if string(kv.yml) != expectedContent {
t.Fatalf("expected:\n%s\nbut got:\n%s", expectedContent, string(kv.yml)) t.Fatalf("expected:\n%s\nbut got:\n%s", expectedContent, string(kv.yml))

View File

@ -29,8 +29,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/util/dump"
) )
func TestVisitorHttpGet(t *testing.T) { func TestVisitorHttpGet(t *testing.T) {
@ -182,7 +182,7 @@ func TestFlattenListVisitor(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if len(test.Infos) != 6 { if len(test.Infos) != 6 {
t.Fatal(spew.Sdump(test.Infos)) t.Fatal(dump.Pretty(test.Infos))
} }
} }
@ -197,7 +197,7 @@ func TestFlattenListVisitorWithVisitorError(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if len(test.Infos) != 6 { if len(test.Infos) != 6 {
t.Fatal(spew.Sdump(test.Infos)) t.Fatal(dump.Pretty(test.Infos))
} }
} }

View File

@ -5,7 +5,6 @@ module k8s.io/client-go
go 1.20 go 1.20
require ( require (
github.com/davecgh/go-spew v1.1.1
github.com/evanphx/json-patch v4.12.0+incompatible github.com/evanphx/json-patch v4.12.0+incompatible
github.com/gogo/protobuf v1.3.2 github.com/gogo/protobuf v1.3.2
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
@ -35,6 +34,7 @@ require (
) )
require ( require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect

View File

@ -23,10 +23,9 @@ import (
"net/http" "net/http"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
@ -39,7 +38,7 @@ func TestListTimeout(t *testing.T) {
NegotiatedSerializer: scheme.Codecs, NegotiatedSerializer: scheme.Codecs,
Client: manualfake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { Client: manualfake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
if req.URL.Query().Get("timeout") != "21s" { if req.URL.Query().Get("timeout") != "21s" {
t.Fatal(spew.Sdump(req.URL.Query())) t.Fatal(dump.Pretty(req.URL.Query()))
} }
return &http.Response{StatusCode: http.StatusNotFound, Body: io.NopCloser(&bytes.Buffer{})}, nil return &http.Response{StatusCode: http.StatusNotFound, Body: io.NopCloser(&bytes.Buffer{})}, nil
}), }),

View File

@ -21,10 +21,10 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/davecgh/go-spew/spew"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/version" "k8s.io/apimachinery/pkg/version"
. "k8s.io/client-go/discovery" . "k8s.io/client-go/discovery"
"k8s.io/client-go/openapi" "k8s.io/client-go/openapi"
@ -364,7 +364,7 @@ func TestGetAPIGroupResources(t *testing.T) {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
if !reflect.DeepEqual(test.expected, got) { if !reflect.DeepEqual(test.expected, got) {
t.Errorf("unexpected result:\nexpected = %s\ngot = %s", spew.Sdump(test.expected), spew.Sdump(got)) t.Errorf("unexpected result:\nexpected = %s\ngot = %s", dump.Pretty(test.expected), dump.Pretty(got))
} }
}) })
} }

View File

@ -24,7 +24,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
@ -32,6 +31,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
fakeclientset "k8s.io/client-go/kubernetes/fake" fakeclientset "k8s.io/client-go/kubernetes/fake"
testcore "k8s.io/client-go/testing" testcore "k8s.io/client-go/testing"
@ -260,7 +260,7 @@ func TestNewInformerWatcher(t *testing.T) {
sort.Sort(byEventTypeAndName(result)) sort.Sort(byEventTypeAndName(result))
if !reflect.DeepEqual(expected, result) { if !reflect.DeepEqual(expected, result) {
t.Error(spew.Errorf("\nexpected: %#v,\ngot: %#v,\ndiff: %s", expected, result, cmp.Diff(expected, result))) t.Errorf("\nexpected: %s,\ngot: %s,\ndiff: %s", dump.Pretty(expected), dump.Pretty(result), cmp.Diff(expected, result))
return return
} }

View File

@ -26,13 +26,13 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
@ -530,7 +530,7 @@ func TestRetryWatcher(t *testing.T) {
for i := 0; i < len(tc.expected); i++ { for i := 0; i < len(tc.expected); i++ {
event, ok := <-watcher.ResultChan() event, ok := <-watcher.ResultChan()
if !ok { if !ok {
t.Error(spew.Errorf("expected event %#+v, but channel is closed"), tc.expected[i]) t.Errorf("expected event %s, but channel is closed", dump.Pretty(tc.expected[i]))
break break
} }
@ -544,7 +544,7 @@ func TestRetryWatcher(t *testing.T) {
select { select {
case event, ok := <-watcher.ResultChan(): case event, ok := <-watcher.ResultChan():
if ok { if ok {
t.Error(spew.Errorf("Unexpected event received after reading all the expected ones: %#+v", event)) t.Errorf("Unexpected event received after reading all the expected ones: %s", dump.Pretty(event))
} }
case <-time.After(10 * time.Millisecond): case <-time.After(10 * time.Millisecond):
break break
@ -564,7 +564,7 @@ func TestRetryWatcher(t *testing.T) {
} }
if !reflect.DeepEqual(tc.expected, got) { if !reflect.DeepEqual(tc.expected, got) {
t.Fatal(spew.Errorf("expected %#+v, got %#+v;\ndiff: %s", tc.expected, got, cmp.Diff(tc.expected, got))) t.Fatalf("expected %s, got %s;\ndiff: %s", dump.Pretty(tc.expected), dump.Pretty(got), cmp.Diff(tc.expected, got))
} }
}) })
} }

View File

@ -19,8 +19,8 @@ package app
import ( import (
"testing" "testing"
"github.com/davecgh/go-spew/spew"
admissionv1 "k8s.io/api/admission/v1" admissionv1 "k8s.io/api/admission/v1"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/cloud-provider/app/config" "k8s.io/cloud-provider/app/config"
cpconfig "k8s.io/cloud-provider/config" cpconfig "k8s.io/cloud-provider/config"
"k8s.io/cloud-provider/fake" "k8s.io/cloud-provider/fake"
@ -103,10 +103,10 @@ func TestWebhookEnableDisable(t *testing.T) {
t.Fatalf( t.Fatalf(
"FAILED: %q\n---\nActual:\n%s\nExpected:\n%s\ntc.webhookConfigs:\n%s\ntc.completedConfig:\n%s\n", "FAILED: %q\n---\nActual:\n%s\nExpected:\n%s\ntc.webhookConfigs:\n%s\ntc.completedConfig:\n%s\n",
tc.desc, tc.desc,
spew.Sdump(actual), dump.Pretty(actual),
spew.Sdump(tc.expected), dump.Pretty(tc.expected),
spew.Sdump(tc.webhookConfigs), dump.Pretty(tc.webhookConfigs),
spew.Sdump(tc.completedConfig), dump.Pretty(tc.completedConfig),
) )
} }
} }

View File

@ -5,7 +5,6 @@ module k8s.io/cloud-provider
go 1.20 go 1.20
require ( require (
github.com/davecgh/go-spew v1.1.1
github.com/google/go-cmp v0.5.9 github.com/google/go-cmp v0.5.9
github.com/spf13/cobra v1.6.0 github.com/spf13/cobra v1.6.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
@ -32,6 +31,7 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.4.0 // indirect github.com/coreos/go-systemd/v22 v22.4.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect

View File

@ -5,7 +5,6 @@ module k8s.io/kube-aggregator
go 1.20 go 1.20
require ( require (
github.com/davecgh/go-spew v1.1.1
github.com/emicklei/go-restful/v3 v3.9.0 github.com/emicklei/go-restful/v3 v3.9.0
github.com/gogo/protobuf v1.3.2 github.com/gogo/protobuf v1.3.2
github.com/google/go-cmp v0.5.9 github.com/google/go-cmp v0.5.9
@ -36,6 +35,7 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.4.0 // indirect github.com/coreos/go-systemd/v22 v22.4.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect

View File

@ -28,10 +28,9 @@ import (
"k8s.io/utils/pointer" "k8s.io/utils/pointer"
"github.com/davecgh/go-spew/spew"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/dump"
v1listers "k8s.io/client-go/listers/core/v1" v1listers "k8s.io/client-go/listers/core/v1"
clienttesting "k8s.io/client-go/testing" clienttesting "k8s.io/client-go/testing"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
@ -503,13 +502,13 @@ func TestUpdateAPIServiceStatus(t *testing.T) {
c.updateAPIServiceStatus(foo, foo) c.updateAPIServiceStatus(foo, foo)
if e, a := 0, len(fakeClient.Actions()); e != a { if e, a := 0, len(fakeClient.Actions()); e != a {
t.Error(spew.Sdump(fakeClient.Actions())) t.Error(dump.Pretty(fakeClient.Actions()))
} }
fakeClient.ClearActions() fakeClient.ClearActions()
c.updateAPIServiceStatus(foo, bar) c.updateAPIServiceStatus(foo, bar)
if e, a := 1, len(fakeClient.Actions()); e != a { if e, a := 1, len(fakeClient.Actions()); e != a {
t.Error(spew.Sdump(fakeClient.Actions())) t.Error(dump.Pretty(fakeClient.Actions()))
} }
} }

View File

@ -32,6 +32,7 @@ import (
"k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
watchtools "k8s.io/client-go/tools/watch" watchtools "k8s.io/client-go/tools/watch"
@ -41,7 +42,6 @@ import (
e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
admissionapi "k8s.io/pod-security-admission/api" admissionapi "k8s.io/pod-security-admission/api"
"github.com/davecgh/go-spew/spew"
"github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega" "github.com/onsi/gomega"
"github.com/opencontainers/runc/libcontainer/apparmor" "github.com/opencontainers/runc/libcontainer/apparmor"
@ -64,7 +64,7 @@ var _ = SIGDescribe("AppArmor [Feature:AppArmor][NodeFeature:AppArmor]", func()
ginkgo.It("should enforce a profile blocking writes", func(ctx context.Context) { ginkgo.It("should enforce a profile blocking writes", func(ctx context.Context) {
status := runAppArmorTest(ctx, f, true, v1.AppArmorBetaProfileNamePrefix+apparmorProfilePrefix+"deny-write") status := runAppArmorTest(ctx, f, true, v1.AppArmorBetaProfileNamePrefix+apparmorProfilePrefix+"deny-write")
if len(status.ContainerStatuses) == 0 { if len(status.ContainerStatuses) == 0 {
framework.Failf("Unexpected pod status: %s", spew.Sdump(status)) framework.Failf("Unexpected pod status: %s", dump.Pretty(status))
return return
} }
state := status.ContainerStatuses[0].State.Terminated state := status.ContainerStatuses[0].State.Terminated
@ -75,7 +75,7 @@ var _ = SIGDescribe("AppArmor [Feature:AppArmor][NodeFeature:AppArmor]", func()
ginkgo.It("should enforce a permissive profile", func(ctx context.Context) { ginkgo.It("should enforce a permissive profile", func(ctx context.Context) {
status := runAppArmorTest(ctx, f, true, v1.AppArmorBetaProfileNamePrefix+apparmorProfilePrefix+"audit-write") status := runAppArmorTest(ctx, f, true, v1.AppArmorBetaProfileNamePrefix+apparmorProfilePrefix+"audit-write")
if len(status.ContainerStatuses) == 0 { if len(status.ContainerStatuses) == 0 {
framework.Failf("Unexpected pod status: %s", spew.Sdump(status)) framework.Failf("Unexpected pod status: %s", dump.Pretty(status))
return return
} }
state := status.ContainerStatuses[0].State.Terminated state := status.ContainerStatuses[0].State.Terminated

View File

@ -21,11 +21,11 @@ import (
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
admissionapi "k8s.io/pod-security-admission/api" admissionapi "k8s.io/pod-security-admission/api"
"github.com/davecgh/go-spew/spew"
"github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega" "github.com/onsi/gomega"
) )
@ -62,7 +62,7 @@ var _ = SIGDescribe("ImageID [NodeFeature: ImageID]", func() {
status := runningPod.Status status := runningPod.Status
if len(status.ContainerStatuses) == 0 { if len(status.ContainerStatuses) == 0 {
framework.Failf("Unexpected pod status; %s", spew.Sdump(status)) framework.Failf("Unexpected pod status; %s", dump.Pretty(status))
return return
} }

View File

@ -23,12 +23,11 @@ import (
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/dump"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/dynamic" "k8s.io/client-go/dynamic"
"k8s.io/client-go/informers" "k8s.io/client-go/informers"
@ -112,7 +111,7 @@ func TestNamespaceCondition(t *testing.T) {
} }
} }
t.Log(spew.Sdump(curr)) t.Log(dump.Pretty(curr))
return conditionsFound == 5, nil return conditionsFound == 5, nil
}) })
if err != nil { if err != nil {