Skip to content

Commit

Permalink
stop using httpmultibin - it was barely used at all either way
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Jan 21, 2025
1 parent 244ebcc commit 20140a4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
4 changes: 0 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
)

require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand All @@ -27,14 +26,11 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa // indirect
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect
github.com/mstoykov/k6-taskqueue-lib v0.1.0 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
Expand Down Expand Up @@ -44,7 +43,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 h1:ZgoomqkdjGbQ3+qQXCkvYMCDvGDNg2k5JJDjjdTB6jY=
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/grafana/sobek v0.0.0-20240606091932-2da0e9e5f3e7 h1:Ed0df3dkkPsjL0RKagJAv/821vrTBiB6GBk+198pxi4=
github.com/grafana/sobek v0.0.0-20240606091932-2da0e9e5f3e7/go.mod h1:6ZH0b0iOxyigeTh+/IlGoL0Hd3lVXA94xoXf0ldNgCM=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No=
Expand All @@ -53,7 +51,6 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
Expand All @@ -64,7 +61,6 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa h1:lx8ZnNPwjkXSzOROz0cg69RlErRXs+L3eDkggASWKLo=
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa/go.mod h1:fhpOYavp5g2K74XDl/ao2y4KvhqVtKlkg1e+0UaQv7I=
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd h1:AC3N94irbx2kWGA8f/2Ks7EQl2LxKIRQYuT9IJDwgiI=
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd/go.mod h1:9vRHVuLCjoFfE3GT06X0spdOAO+Zzo4AMjdIwUHBvAk=
github.com/mstoykov/envconfig v1.5.0 h1:E2FgWf73BQt0ddgn7aoITkQHmgwAcHup1s//MsS5/f8=
Expand Down
24 changes: 12 additions & 12 deletions redis/client_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package redis

import (
"crypto/tls"
"errors"
"fmt"
"net"
"strconv"
"testing"

Expand All @@ -11,7 +13,8 @@ import (
"github.com/stretchr/testify/require"
"go.k6.io/k6/js/modulestest"
"go.k6.io/k6/lib"
"go.k6.io/k6/lib/testutils/httpmultibin"
"go.k6.io/k6/lib/netext"
"go.k6.io/k6/lib/types"
"go.k6.io/k6/metrics"
"gopkg.in/guregu/null.v3"
)
Expand Down Expand Up @@ -2557,7 +2560,6 @@ type testSetup struct {
rt *sobek.Runtime
state *lib.State
samples chan metrics.SampleContainer
tb *httpmultibin.HTTPMultiBin
}

// newTestSetup initializes a new test setup.
Expand All @@ -2566,15 +2568,12 @@ type testSetup struct {
// main context of k6.
func newTestSetup(t testing.TB) testSetup {
ts := newInitContextTestSetup(t)
tb := httpmultibin.NewHTTPMultiBin(t)
// We use self-signed TLS certificates for some tests, and need to disable
// strict verification. Since we don't use the k6 js.Runner, we can't set
// the k6 option InsecureSkipTLSVerify for this, and must override it in the
// TLS config we use from HTTPMultiBin.
tb.TLSClientConfig.InsecureSkipVerify = true

state := &lib.State{
Dialer: tb.Dialer,
Dialer: netext.NewDialer(
net.Dialer{},
netext.NewResolver(net.LookupIP, 0, types.DNSfirst, types.DNSpreferIPv4),
),
Options: lib.Options{
SystemTags: metrics.NewSystemTagSet(
metrics.TagURL,
Expand All @@ -2585,14 +2584,13 @@ func newTestSetup(t testing.TB) testSetup {
UserAgent: null.StringFrom("TestUserAgent"),
},
Samples: ts.samples,
TLSConfig: tb.TLSClientConfig,
TLSConfig: &tls.Config{}, //nolint:gosec
BuiltinMetrics: metrics.RegisterBuiltinMetrics(metrics.NewRegistry()),
Tags: lib.NewVUStateTags(metrics.NewRegistry().RootTagSet()),
}
ts.runtime.MoveToVUContext(state)

ts.state = state
ts.tb = tb
return ts
}

Expand All @@ -2619,6 +2617,7 @@ func TestClientTLS(t *testing.T) {
t.Parallel()

ts := newTestSetup(t)
ts.state.TLSConfig.InsecureSkipVerify = true
rs := RunTSecure(t, nil)

err := ts.rt.Set("caCert", string(rs.TLSCertificate()))
Expand Down Expand Up @@ -2657,6 +2656,7 @@ func TestClientTLSAuth(t *testing.T) {
require.NoError(t, err)

ts := newTestSetup(t)
ts.state.TLSConfig.InsecureSkipVerify = true
rs := RunTSecure(t, clientCert)

err = ts.rt.Set("caCert", string(rs.TLSCertificate()))
Expand Down Expand Up @@ -2713,7 +2713,7 @@ func TestClientTLSRespectsNetworkOPtions(t *testing.T) {
// Set the redis server's IP to be blacklisted.
net, err := lib.ParseCIDR(rs.Addr().IP.String() + "/32")
require.NoError(t, err)
ts.tb.Dialer.Blacklist = []*lib.IPNet{net}
ts.state.Dialer.(*netext.Dialer).Blacklist = []*lib.IPNet{net}

gotScriptErr := ts.runtime.EventLoop.Start(func() error {
_, err := ts.rt.RunString(fmt.Sprintf(`
Expand Down
2 changes: 2 additions & 0 deletions redis/stub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type StubServer struct {
commandsHistory [][]string

tlsCert []byte
cert *tls.Certificate
}

// NewStubServer instantiates a new RedisStub server.
Expand Down Expand Up @@ -103,6 +104,7 @@ func (rs *StubServer) Start(secure bool, clientCert []byte) error {
if err != nil {
return err
}
rs.cert = &certPair
config := &tls.Config{
MinVersion: tls.VersionTLS13,
PreferServerCipherSuites: true,
Expand Down

0 comments on commit 20140a4

Please sign in to comment.