Skip to content

Commit

Permalink
drop x/net runtime dependency which was only used for testing (#2637)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws authored May 9, 2024
1 parent 1c71d2f commit 343ec35
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 33 deletions.
11 changes: 11 additions & 0 deletions .changelog/d0ba80d8cc02448d91d0997ce89432f3.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
6 changes: 1 addition & 5 deletions service/internal/eventstreamtesting/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ../../../

Expand Down
4 changes: 0 additions & 4 deletions service/internal/eventstreamtesting/go.sum
Original file line number Diff line number Diff line change
@@ -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=
19 changes: 7 additions & 12 deletions service/internal/eventstreamtesting/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ 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 {
server.Config.TLSConfig = &tls.Config{
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()
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 0 additions & 2 deletions service/kinesis/internal/testing/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ../../../../
Expand Down
4 changes: 0 additions & 4 deletions service/kinesis/internal/testing/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
2 changes: 0 additions & 2 deletions service/transcribestreaming/internal/testing/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 => ../../../../
Expand Down
4 changes: 0 additions & 4 deletions service/transcribestreaming/internal/testing/go.sum
Original file line number Diff line number Diff line change
@@ -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=

0 comments on commit 343ec35

Please sign in to comment.