From 343ec354ea5aa20b132ce04f35427ede87a26c9c Mon Sep 17 00:00:00 2001 From: Luc Talatinian <102624213+lucix-aws@users.noreply.github.com> Date: Thu, 9 May 2024 15:04:38 -0400 Subject: [PATCH] drop x/net runtime dependency which was only used for testing (#2637) --- .../d0ba80d8cc02448d91d0997ce89432f3.json | 11 +++++++++++ service/internal/eventstreamtesting/go.mod | 6 +----- service/internal/eventstreamtesting/go.sum | 4 ---- service/internal/eventstreamtesting/server.go | 19 +++++++------------ service/kinesis/internal/testing/go.mod | 2 -- service/kinesis/internal/testing/go.sum | 4 ---- .../internal/testing/go.mod | 2 -- .../internal/testing/go.sum | 4 ---- 8 files changed, 19 insertions(+), 33 deletions(-) create mode 100644 .changelog/d0ba80d8cc02448d91d0997ce89432f3.json diff --git a/.changelog/d0ba80d8cc02448d91d0997ce89432f3.json b/.changelog/d0ba80d8cc02448d91d0997ce89432f3.json new file mode 100644 index 00000000000..634fb0a71d6 --- /dev/null +++ b/.changelog/d0ba80d8cc02448d91d0997ce89432f3.json @@ -0,0 +1,11 @@ +{ + "id": "d0ba80d8-cc02-448d-91d0-997ce89432f3", + "type": "feature", + "description": "Drop test dependency on x/net, h2 support is now available in the stdlib.", + "collapse": true, + "modules": [ + "service/internal/eventstreamtesting", + "service/kinesis/internal/testing", + "service/transcribestreaming/internal/testing" + ] +} diff --git a/service/internal/eventstreamtesting/go.mod b/service/internal/eventstreamtesting/go.mod index f222a0ec359..21811a68312 100644 --- a/service/internal/eventstreamtesting/go.mod +++ b/service/internal/eventstreamtesting/go.mod @@ -6,13 +6,9 @@ require ( github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 github.com/aws/aws-sdk-go-v2/credentials v1.17.12 - golang.org/x/net v0.23.0 ) -require ( - github.com/aws/smithy-go v1.20.2 // indirect - golang.org/x/text v0.14.0 // indirect -) +require github.com/aws/smithy-go v1.20.2 // indirect replace github.com/aws/aws-sdk-go-v2 => ../../../ diff --git a/service/internal/eventstreamtesting/go.sum b/service/internal/eventstreamtesting/go.sum index ad0588b2a9f..4641fc37614 100644 --- a/service/internal/eventstreamtesting/go.sum +++ b/service/internal/eventstreamtesting/go.sum @@ -1,6 +1,2 @@ github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= diff --git a/service/internal/eventstreamtesting/server.go b/service/internal/eventstreamtesting/server.go index 21209fc76e4..1ffcaaac4ce 100644 --- a/service/internal/eventstreamtesting/server.go +++ b/service/internal/eventstreamtesting/server.go @@ -20,12 +20,16 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" "github.com/aws/aws-sdk-go-v2/credentials" - "golang.org/x/net/http2" ) const ( errClientDisconnected = "client disconnected" errStreamClosed = "http2: stream closed" + + // x/net had an exported StreamError type that we could assert against, + // net/http's h2 implementation internalizes all of its error types but the + // Error() text pattern remains identical + http2StreamError = "stream error: stream ID" ) func setupServer(server *httptest.Server) aws.HTTPClient { @@ -33,11 +37,7 @@ func setupServer(server *httptest.Server) aws.HTTPClient { InsecureSkipVerify: true, } - if err := http2.ConfigureServer(server.Config, nil); err != nil { - panic(err) - } - - server.Config.TLSConfig.NextProtos = []string{http2.NextProtoTLS} + server.Config.TLSConfig.NextProtos = []string{"h2"} server.TLS = server.Config.TLSConfig server.StartTLS() @@ -170,12 +170,7 @@ func (s *ServeEventStream) serveBiDirectionalStream(w http.ResponseWriter, r *ht } func isError(err error) bool { - switch err.(type) { - case http2.StreamError: - return false - } - - for _, s := range []string{errClientDisconnected, errStreamClosed} { + for _, s := range []string{errClientDisconnected, errStreamClosed, http2StreamError} { if strings.Contains(err.Error(), s) { return false } diff --git a/service/kinesis/internal/testing/go.mod b/service/kinesis/internal/testing/go.mod index c24d60cd2d8..5f7c86177f4 100644 --- a/service/kinesis/internal/testing/go.mod +++ b/service/kinesis/internal/testing/go.mod @@ -15,8 +15,6 @@ require ( github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/text v0.14.0 // indirect ) replace github.com/aws/aws-sdk-go-v2 => ../../../../ diff --git a/service/kinesis/internal/testing/go.sum b/service/kinesis/internal/testing/go.sum index 6b1a533bbae..590fd995fd9 100644 --- a/service/kinesis/internal/testing/go.sum +++ b/service/kinesis/internal/testing/go.sum @@ -9,10 +9,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/service/transcribestreaming/internal/testing/go.mod b/service/transcribestreaming/internal/testing/go.mod index 8a256ad1756..cb9c59653c8 100644 --- a/service/transcribestreaming/internal/testing/go.mod +++ b/service/transcribestreaming/internal/testing/go.mod @@ -14,8 +14,6 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.17.12 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/text v0.14.0 // indirect ) replace github.com/aws/aws-sdk-go-v2 => ../../../../ diff --git a/service/transcribestreaming/internal/testing/go.sum b/service/transcribestreaming/internal/testing/go.sum index ad0588b2a9f..4641fc37614 100644 --- a/service/transcribestreaming/internal/testing/go.sum +++ b/service/transcribestreaming/internal/testing/go.sum @@ -1,6 +1,2 @@ github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=