staging/streaming: replace testify with stdlib in tests

Remove github.com/stretchr/testify from k8s.io/streaming's test
files. testify's assert/yaml subpackage pulls in gopkg.in/yaml.v3,
whose test dependencies (gopkg.in/check.v1 → kr/pretty →
rogpeppe/go-internal) were propagating into k8s.io/apimachinery and
k8s.io/api via the streaming dependency.

Removes stretchr/testify, gopkg.in/yaml.v3, gopkg.in/check.v1,
github.com/kr/pretty, and github.com/rogpeppe/go-internal from
streaming/go.mod.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
Davanum Srinivas
2026-03-06 11:05:26 -05:00
parent 1ee1ff97fb
commit 57d7c4d812
13 changed files with 85 additions and 78 deletions

View File

@@ -20,7 +20,6 @@ require (
github.com/kr/pretty v0.3.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect

View File

@@ -43,6 +43,7 @@ require (
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/onsi/ginkgo/v2 v2.28.1 // indirect
github.com/onsi/gomega v1.39.1 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect

View File

@@ -36,7 +36,6 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/mod v0.32.0 // indirect

View File

@@ -2,9 +2,9 @@
module k8s.io/cri-streaming
go 1.25.0
go 1.26.0
godebug default=go1.25
godebug default=go1.26
require (
github.com/emicklei/go-restful/v3 v3.13.0
@@ -31,7 +31,7 @@ require (
golang.org/x/sys v0.40.0 // indirect
golang.org/x/text v0.33.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
google.golang.org/protobuf v1.36.11 // indirect
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

View File

@@ -78,8 +78,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI=
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

View File

@@ -19,7 +19,6 @@ require (
github.com/kr/pretty v0.3.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/net v0.49.0 // indirect

View File

@@ -29,7 +29,6 @@ require (
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/spf13/cobra v1.10.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/x448/float16 v0.8.4 // indirect

View File

@@ -48,6 +48,7 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.140.0 // indirect
k8s.io/kube-openapi v0.0.0-20260304202019-5b3e3fdb0acf // indirect
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect

View File

@@ -2,25 +2,16 @@
module k8s.io/streaming
go 1.25.0
go 1.26.0
godebug default=go1.25
godebug default=go1.26
require (
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
github.com/moby/spdystream v0.5.0
github.com/stretchr/testify v1.11.1
golang.org/x/net v0.49.0
k8s.io/klog/v2 v2.140.0
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2
)
require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
require github.com/go-logr/logr v1.4.3 // indirect

View File

@@ -1,41 +1,16 @@
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU=
github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc=
k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0=
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU=

View File

@@ -33,8 +33,6 @@ import (
"testing"
"github.com/armon/go-socks5"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/streaming/pkg/httpstream"
)
@@ -592,7 +590,9 @@ func TestProxierWithNoProxyCIDR(t *testing.T) {
t.Setenv("no_proxy", "")
expectedProxy, err := url.Parse("http://proxy.example:8080")
require.NoError(t, err)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
delegateCalls := 0
delegate := func(*http.Request) (*url.URL, error) {
@@ -603,34 +603,70 @@ func TestProxierWithNoProxyCIDR(t *testing.T) {
proxier := newProxierWithNoProxyCIDR(delegate)
req, err := http.NewRequest(http.MethodGet, "https://10.1.2.3", nil)
require.NoError(t, err)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
proxyURL, err := proxier(req)
require.NoError(t, err)
require.Nil(t, proxyURL)
require.Equal(t, 0, delegateCalls)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if proxyURL != nil {
t.Fatalf("expected nil proxyURL, got %v", proxyURL)
}
if delegateCalls != 0 {
t.Fatalf("expected delegateCalls=0, got %d", delegateCalls)
}
req, err = http.NewRequest(http.MethodGet, "https://[2001:db8::1]", nil)
require.NoError(t, err)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
proxyURL, err = proxier(req)
require.NoError(t, err)
require.Nil(t, proxyURL)
require.Equal(t, 0, delegateCalls)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if proxyURL != nil {
t.Fatalf("expected nil proxyURL, got %v", proxyURL)
}
if delegateCalls != 0 {
t.Fatalf("expected delegateCalls=0, got %d", delegateCalls)
}
req, err = http.NewRequest(http.MethodGet, "https://192.168.1.10", nil)
require.NoError(t, err)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
proxyURL, err = proxier(req)
require.NoError(t, err)
require.NotNil(t, proxyURL)
require.Equal(t, expectedProxy.String(), proxyURL.String())
require.Equal(t, 1, delegateCalls)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if proxyURL == nil {
t.Fatalf("expected non-nil proxyURL")
}
if proxyURL.String() != expectedProxy.String() {
t.Fatalf("expected proxyURL %q, got %q", expectedProxy.String(), proxyURL.String())
}
if delegateCalls != 1 {
t.Fatalf("expected delegateCalls=1, got %d", delegateCalls)
}
req, err = http.NewRequest(http.MethodGet, "https://example.com", nil)
require.NoError(t, err)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
proxyURL, err = proxier(req)
require.NoError(t, err)
require.NotNil(t, proxyURL)
require.Equal(t, expectedProxy.String(), proxyURL.String())
require.Equal(t, 2, delegateCalls)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if proxyURL == nil {
t.Fatalf("expected non-nil proxyURL")
}
if proxyURL.String() != expectedProxy.String() {
t.Fatalf("expected proxyURL %q, got %q", expectedProxy.String(), proxyURL.String())
}
if delegateCalls != 2 {
t.Fatalf("expected delegateCalls=2, got %d", delegateCalls)
}
}
type Interceptor struct {
@@ -911,13 +947,17 @@ func TestRoundTripPassesContextToDialer(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel()
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u, nil)
require.NoError(t, err)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
spdyTransport, err := NewRoundTripper(&tls.Config{})
if err != nil {
t.Fatalf("error creating SpdyRoundTripper: %v", err)
}
_, err = spdyTransport.Dial(req)
assert.EqualError(t, err, "dial tcp 127.0.0.1:1233: operation was canceled")
if err == nil || err.Error() != "dial tcp 127.0.0.1:1233: operation was canceled" {
t.Errorf("expected error %q, got %v", "dial tcp 127.0.0.1:1233: operation was canceled", err)
}
})
}
}

View File

@@ -25,8 +25,6 @@ import (
"sync"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/websocket"
)
@@ -370,12 +368,16 @@ func TestIsWebSocketRequestWithStreamCloseProtocol(t *testing.T) {
for name, test := range tests {
req, err := http.NewRequest(http.MethodGet, "http://www.example.com/", nil)
require.NoError(t, err)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
for key, value := range test.headers {
req.Header.Add(key, value)
}
actual := IsWebSocketRequestWithStreamCloseProtocol(req)
assert.Equal(t, test.expected, actual, "%s: expected (%t), got (%t)", name, test.expected, actual)
if actual != test.expected {
t.Errorf("%s: expected (%t), got (%t)", name, test.expected, actual)
}
}
}
@@ -412,7 +414,8 @@ func TestProtocolSupportsStreamClose(t *testing.T) {
for name, test := range tests {
actual := protocolSupportsStreamClose(test.protocol)
assert.Equal(t, test.expected, actual,
"%s: expected (%t), got (%t)", name, test.expected, actual)
if actual != test.expected {
t.Errorf("%s: expected (%t), got (%t)", name, test.expected, actual)
}
}
}

4
vendor/modules.txt vendored
View File

@@ -1089,7 +1089,7 @@ gopkg.in/yaml.v3
# k8s.io/cri-client v0.0.0 => ./staging/src/k8s.io/cri-client
## explicit; go 1.26.0
# k8s.io/cri-streaming v0.0.0 => ./staging/src/k8s.io/cri-streaming
## explicit; go 1.25.0
## explicit; go 1.26.0
# k8s.io/csi-translation-lib v0.0.0 => ./staging/src/k8s.io/csi-translation-lib
## explicit; go 1.26.0
# k8s.io/dynamic-resource-allocation v0.0.0 => ./staging/src/k8s.io/dynamic-resource-allocation
@@ -1176,7 +1176,7 @@ k8s.io/kube-openapi/pkg/validation/validate
# k8s.io/sample-apiserver v0.0.0 => ./staging/src/k8s.io/sample-apiserver
## explicit; go 1.26.0
# k8s.io/streaming v0.0.0 => ./staging/src/k8s.io/streaming
## explicit; go 1.25.0
## explicit; go 1.26.0
# k8s.io/system-validators v1.12.1
## explicit; go 1.16
k8s.io/system-validators/validators