diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 90a58731c..0f54765c8 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,7 +24,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: golangci-lint @@ -32,7 +32,7 @@ jobs: with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. # version: v1.29 - version: v1.53 + version: v1.55 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 993b7b726..8dffae074 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: 1.20 - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 372ec6554..8837c21e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - uses: actions/setup-java@v3 # Needed for the Avro example diff --git a/Makefile b/Makefile index e2ed2879b..28c348596 100755 --- a/Makefile +++ b/Makefile @@ -43,10 +43,10 @@ deps: download_plugins download_plugins: @echo "--- 🐿 Installing plugins"; \ ./scripts/install-cli.sh - ~/.pact/bin/pact-plugin-cli -y install https://github.com/pactflow/pact-protobuf-plugin/releases/tag/v-0.3.4 + ~/.pact/bin/pact-plugin-cli -y install https://github.com/pactflow/pact-protobuf-plugin/releases/tag/v-0.3.8 ~/.pact/bin/pact-plugin-cli -y install https://github.com/pact-foundation/pact-plugins/releases/tag/csv-plugin-0.0.1 ~/.pact/bin/pact-plugin-cli -y install https://github.com/mefellows/pact-matt-plugin/releases/tag/v0.0.9 - ~/.pact/bin/pact-plugin-cli -y install https://github.com/austek/pact-avro-plugin/releases/tag/v0.0.4 + ~/.pact/bin/pact-plugin-cli -y install https://github.com/austek/pact-avro-plugin/releases/tag/v0.0.3 cli: @if [ ! -d pact/bin ]; then\ diff --git a/command/root.go b/command/root.go index 139e25c88..58f6c1c3f 100644 --- a/command/root.go +++ b/command/root.go @@ -3,7 +3,7 @@ package command import ( "fmt" - "io/ioutil" + "io" "log" "os" @@ -50,6 +50,6 @@ func setLogLevel(verbose bool, level string) { log.SetOutput(filter) if !verbose { - log.SetOutput(ioutil.Discard) + log.SetOutput(io.Discard) } } diff --git a/command/root_test.go b/command/root_test.go index b9f6ef8b6..aa786e684 100644 --- a/command/root_test.go +++ b/command/root_test.go @@ -1,7 +1,7 @@ package command import ( - "io/ioutil" + "io" "log" "os" "strings" @@ -55,7 +55,7 @@ func captureOutput(action func()) string { action() w.Close() - out, _ := ioutil.ReadAll(r) + out, _ := io.ReadAll(r) os.Stderr = rescueStderr return strings.TrimSpace(string(out)) diff --git a/consumer/http_v4_test.go b/consumer/http_v4_test.go index ca9db5e4e..154a8b227 100644 --- a/consumer/http_v4_test.go +++ b/consumer/http_v4_test.go @@ -58,7 +58,7 @@ func TestHttpV4TypeSystem(t *testing.T) { UponReceiving("some scenario"). UsingPlugin(PluginConfig{ Plugin: "protobuf", - Version: "0.3.0", + Version: "0.3.8", }). WithRequest("GET", "/"). // WithRequest("GET", "/", func(b *V4InteractionWithPluginRequestBuilder) { diff --git a/doc.go b/doc.go index 66debd29e..295025c06 100644 --- a/doc.go +++ b/doc.go @@ -207,7 +207,7 @@ An example route using the standard Go http package might look like this: // Retrieve the Provider State var state types.ProviderState - body, _ := ioutil.ReadAll(req.Body) + body, _ := io.ReadAll(req.Body) req.Body.Close() json.Unmarshal(body, &state) diff --git a/examples/avro/avro_consumer_test.go b/examples/avro/avro_consumer_test.go index 0c3c640b1..70836d814 100644 --- a/examples/avro/avro_consumer_test.go +++ b/examples/avro/avro_consumer_test.go @@ -5,7 +5,7 @@ package avro import ( "fmt" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -45,7 +45,7 @@ func TestAvroHTTP(t *testing.T) { UponReceiving("A request to do get some Avro stuff"). UsingPlugin(consumer.PluginConfig{ Plugin: "avro", - Version: "0.0.4", + Version: "0.0.3", }). WithRequest("GET", "/avro"). WillRespondWith(200, func(res *consumer.V4InteractionWithPluginResponseBuilder) { @@ -82,7 +82,7 @@ func callServiceHTTP(msc consumer.MockServerConfig) (*User, error) { return nil, err } - bytes, err := ioutil.ReadAll(res.Body) + bytes, err := io.ReadAll(res.Body) if err != nil { return nil, err diff --git a/examples/avro/codec.go b/examples/avro/codec.go index b12606942..fb4d2aca8 100644 --- a/examples/avro/codec.go +++ b/examples/avro/codec.go @@ -1,13 +1,13 @@ package avro import ( - "io/ioutil" - + + "os" "github.com/linkedin/goavro/v2" ) func getCodec() *goavro.Codec { - schema, err := ioutil.ReadFile("user.avsc") + schema, err := os.ReadFile("user.avsc") if err != nil { panic(err) } diff --git a/examples/consumer_v2_test.go b/examples/consumer_v2_test.go index b80092006..0c5ae0871 100644 --- a/examples/consumer_v2_test.go +++ b/examples/consumer_v2_test.go @@ -6,7 +6,7 @@ package main import ( "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strings" @@ -188,7 +188,7 @@ var rawTest = func(query string) func(config consumer.MockServerConfig) error { Path: "/foobar", RawQuery: query, }, - Body: ioutil.NopCloser(strings.NewReader(`{"id": 27, "name":"billy", "lastName":"sampson", "datetime":"2021-01-01T08:00:45"}`)), + Body: io.NopCloser(strings.NewReader(`{"id": 27, "name":"billy", "lastName":"sampson", "datetime":"2021-01-01T08:00:45"}`)), Header: make(http.Header), } diff --git a/examples/grpc/grpc_consumer_test.go b/examples/grpc/grpc_consumer_test.go index d2d70a4da..962ad08b5 100644 --- a/examples/grpc/grpc_consumer_test.go +++ b/examples/grpc/grpc_consumer_test.go @@ -53,7 +53,7 @@ func TestGrpcInteraction(t *testing.T) { Given("feature 'Big Tree' exists"). UsingPlugin(message.PluginConfig{ Plugin: "protobuf", - Version: "0.3.4", + Version: "0.3.8", }). WithContents(grpcInteraction, "application/protobuf"). StartTransport("grpc", "127.0.0.1", nil). // For plugin tests, we can't assume if a transport is needed, so this is optional diff --git a/examples/grpc/routeguide/server/server.go b/examples/grpc/routeguide/server/server.go index 2c6596784..1c8b4c678 100644 --- a/examples/grpc/routeguide/server/server.go +++ b/examples/grpc/routeguide/server/server.go @@ -28,7 +28,7 @@ import ( "flag" "fmt" "io" - "io/ioutil" + "os" "log" "math" "net" @@ -155,7 +155,7 @@ func (s *routeGuideServer) loadFeatures(filePath string) { var data []byte if filePath != "" { var err error - data, err = ioutil.ReadFile(filePath) + data, err = os.ReadFile(filePath) if err != nil { log.Fatalf("Failed to load default features: %v", err) } diff --git a/examples/pacts/MattConsumer-MattProvider.json b/examples/pacts/MattConsumer-MattProvider.json deleted file mode 100644 index fc2cf428c..000000000 --- a/examples/pacts/MattConsumer-MattProvider.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "consumer": { - "name": "MattConsumer" - }, - "interactions": [ - { - "description": "A request to do a matt", - "key": "c544877c9301bb17", - "pending": false, - "request": { - "body": { - "content": "MATThelloMATT", - "contentType": "application/matt", - "contentTypeHint": "DEFAULT", - "encoded": false - }, - "headers": { - "content-type": [ - "application/matt" - ] - }, - "method": "POST", - "path": "/matt" - }, - "response": { - "body": { - "content": "MATTworldMATT", - "contentType": "application/matt", - "contentTypeHint": "DEFAULT", - "encoded": false - }, - "headers": { - "content-type": [ - "application/matt" - ] - }, - "status": 200 - }, - "transport": "http", - "type": "Synchronous/HTTP" - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "4.0" - }, - "plugins": [ - { - "configuration": {}, - "name": "matt", - "version": "0.0.7" - } - ] - }, - "provider": { - "name": "MattProvider" - } -} \ No newline at end of file diff --git a/examples/pacts/PactGoProductAPIConsumer-PactGoProductAPI.json b/examples/pacts/PactGoProductAPIConsumer-PactGoProductAPI.json deleted file mode 100644 index 43cad6c15..000000000 --- a/examples/pacts/PactGoProductAPIConsumer-PactGoProductAPI.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "consumer": { - "name": "PactGoProductAPIConsumer" - }, - "interactions": [ - { - "description": "A request for Product 10", - "providerState": "A product with ID 10 exists", - "request": { - "method": "GET", - "path": "/products/10" - }, - "response": { - "body": { - "id": 10, - "name": "Billy", - "price": "23.33" - }, - "headers": { - "Content-Type": "application/json" - }, - "matchingRules": { - "$.body.id": { - "match": "type" - }, - "$.body.name": { - "match": "type" - }, - "$.body.price": { - "match": "type" - } - }, - "status": 200 - } - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "2.0.0" - } - }, - "provider": { - "name": "PactGoProductAPI" - } -} \ No newline at end of file diff --git a/examples/pacts/PactGoV2Consumer-V2Provider.json b/examples/pacts/PactGoV2Consumer-V2Provider.json deleted file mode 100644 index bf22d1cae..000000000 --- a/examples/pacts/PactGoV2Consumer-V2Provider.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "consumer": { - "name": "PactGoV2Consumer" - }, - "interactions": [ - { - "description": "A request to do a foo", - "providerState": "User foo exists", - "request": { - "body": { - "datetime": "2020-01-01'T'08:00:45", - "id": 27, - "lastName": "billy", - "name": "billy" - }, - "headers": { - "Authorization": "Bearer 1234", - "Content-Type": "application/json" - }, - "matchingRules": { - "$.body.datetime": { - "match": "type" - }, - "$.body.id": { - "match": "type" - }, - "$.body.lastName": { - "match": "type" - }, - "$.body.name": { - "match": "type" - }, - "$.header.$.Authorization[0]": { - "match": "type" - }, - "$.path": { - "match": "regex", - "regex": "\\/foo.*" - }, - "$.query.$.baz[0]": { - "match": "regex", - "regex": "[a-z]+" - }, - "$.query.$.baz[1]": { - "match": "regex", - "regex": "[a-z]+" - }, - "$.query.$.baz[2]": { - "match": "regex", - "regex": "[a-z]+" - } - }, - "method": "POST", - "path": "/foobar", - "query": "baz=bar&baz=bat&baz=baz" - }, - "response": { - "body": { - "datetime": "2020-01-01", - "itemsMin": [ - "thereshouldbe3ofthese", - "thereshouldbe3ofthese", - "thereshouldbe3ofthese" - ], - "lastName": "Sampson", - "name": "Billy" - }, - "headers": { - "Content-Type": "application/json" - }, - "matchingRules": { - "$.body.datetime": { - "match": "regex", - "regex": "[0-9\\-]+" - }, - "$.body.itemsMin": { - "match": "type", - "min": 3 - }, - "$.header.$['Content-Type'][0]": { - "match": "regex", - "regex": "application\\/json" - } - }, - "status": 200 - } - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "2.0.0" - } - }, - "provider": { - "name": "V2Provider" - } -} \ No newline at end of file diff --git a/examples/pacts/PactGoV2ConsumerAllInOne-V2Provider.json b/examples/pacts/PactGoV2ConsumerAllInOne-V2Provider.json deleted file mode 100644 index 5b2a72506..000000000 --- a/examples/pacts/PactGoV2ConsumerAllInOne-V2Provider.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "consumer": { - "name": "PactGoV2ConsumerAllInOne" - }, - "interactions": [ - { - "description": "A request to do a foo", - "providerState": "User foo exists", - "request": { - "body": { - "datetime": "2020-01-01'T'08:00:45", - "id": 27, - "lastName": "billy", - "name": "billy" - }, - "headers": { - "Content-Type": "application/json" - }, - "matchingRules": { - "$.body.datetime": { - "match": "type" - }, - "$.body.id": { - "match": "type" - }, - "$.body.lastName": { - "match": "type" - }, - "$.body.name": { - "match": "type" - }, - "$.path": { - "match": "regex", - "regex": "\\/foo.*" - }, - "$.query.$.baz[0]": { - "match": "regex", - "regex": "[a-zA-Z]+" - } - }, - "method": "POST", - "path": "/foobar", - "query": "baz=bat" - }, - "response": { - "body": { - "datetime": "2020-01-01", - "itemsMin": [ - "thereshouldbe3ofthese", - "thereshouldbe3ofthese", - "thereshouldbe3ofthese" - ], - "lastName": "Sampson", - "name": "Billy" - }, - "headers": { - "Content-Type": "application/json" - }, - "matchingRules": { - "$.body.datetime": { - "match": "regex", - "regex": "[0-9\\-]+" - }, - "$.body.itemsMin": { - "match": "type", - "min": 3 - } - }, - "status": 200 - } - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "2.0.0" - } - }, - "provider": { - "name": "V2Provider" - } -} \ No newline at end of file diff --git a/examples/pacts/PactGoV2ConsumerMatch-V2ProviderMatch.json b/examples/pacts/PactGoV2ConsumerMatch-V2ProviderMatch.json deleted file mode 100644 index a592305af..000000000 --- a/examples/pacts/PactGoV2ConsumerMatch-V2ProviderMatch.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "consumer": { - "name": "PactGoV2ConsumerMatch" - }, - "interactions": [ - { - "description": "A request to do a foo", - "providerState": "User foo exists", - "request": { - "body": { - "datetime": "2020-01-01'T'08:00:45,format=yyyy-MM-dd'T'HH:mm:ss,generator=datetime", - "id": 27, - "lastName": "Sampson", - "name": "Billy" - }, - "headers": { - "Authorization": "Bearer 1234", - "Content-Type": "application/json" - }, - "matchingRules": { - "$.body.datetime": { - "match": "type" - }, - "$.body.id": { - "match": "type" - }, - "$.body.lastName": { - "match": "type" - }, - "$.body.name": { - "match": "type" - }, - "$.header.$.Authorization[0]": { - "match": "type" - }, - "$.query.$.baz[0]": { - "match": "regex", - "regex": "[a-z]+" - }, - "$.query.$.baz[1]": { - "match": "regex", - "regex": "[a-z]+" - }, - "$.query.$.baz[2]": { - "match": "regex", - "regex": "[a-z]+" - } - }, - "method": "POST", - "path": "/foobar", - "query": "baz=bar&baz=bat&baz=baz" - }, - "response": { - "body": { - "datetime": "2020-01-01'T'08:00:45,format=yyyy-MM-dd'T'HH:mm:ss,generator=datetime", - "id": 27, - "lastName": "Sampson", - "name": "Billy" - }, - "headers": { - "Content-Type": "application/json" - }, - "matchingRules": { - "$.body.datetime": { - "match": "type" - }, - "$.body.id": { - "match": "type" - }, - "$.body.lastName": { - "match": "type" - }, - "$.body.name": { - "match": "type" - }, - "$.header.$['Content-Type'][0]": { - "match": "regex", - "regex": "application\\/json" - } - }, - "status": 200 - } - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "2.0.0" - } - }, - "provider": { - "name": "V2ProviderMatch" - } -} \ No newline at end of file diff --git a/examples/pacts/PactGoV3Consumer-V3Provider.json b/examples/pacts/PactGoV3Consumer-V3Provider.json deleted file mode 100644 index 666df7aa7..000000000 --- a/examples/pacts/PactGoV3Consumer-V3Provider.json +++ /dev/null @@ -1,292 +0,0 @@ -{ - "consumer": { - "name": "PactGoV3Consumer" - }, - "interactions": [ - { - "description": "A request to do a foo", - "providerStates": [ - { - "name": "state 1" - }, - { - "name": "User foo exists", - "params": { - "id": "foo" - } - } - ], - "request": { - "body": { - "datetime": "2020-01-01T08:00:45", - "id": 27, - "lastName": "billy", - "name": "billy" - }, - "generators": { - "body": { - "$.datetime": { - "format": "yyyy-MM-dd'T'HH:mm:ss", - "type": "DateTime" - }, - "$.name": { - "expression": "${name}", - "type": "ProviderState" - } - } - }, - "headers": { - "Authorization": "Bearer 1234", - "Content-Type": "application/json" - }, - "matchingRules": { - "body": { - "$.datetime": { - "combine": "AND", - "matchers": [ - { - "format": "yyyy-MM-dd'T'HH:mm:ss", - "match": "datetime" - } - ] - }, - "$.id": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - }, - "$.lastName": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - }, - "$.name": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - }, - "header": { - "$.Authorization[0]": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - }, - "query": { - "$.baz[0]": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[a-z]+" - } - ] - }, - "$.baz[1]": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[a-z]+" - } - ] - }, - "$.baz[2]": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[a-z]+" - } - ] - } - } - }, - "method": "POST", - "path": "/foobar", - "query": { - "baz": [ - "bar", - "bat", - "baz" - ] - } - }, - "response": { - "body": { - "accountBalance": 123.76, - "arrayContaining": [ - "string", - 1, - { - "foo": "bar" - } - ], - "datetime": "2020-01-01", - "equality": "a thing", - "id": 12, - "itemsMin": [ - "thereshouldbe3ofthese", - "thereshouldbe3ofthese", - "thereshouldbe3ofthese" - ], - "itemsMinMax": [ - 27, - 27, - 27, - 27, - 27 - ], - "lastName": "Sampson", - "name": "Billy", - "superstring": "foo" - }, - "headers": { - "Content-Type": "application/json" - }, - "matchingRules": { - "body": { - "$.accountBalance": { - "combine": "AND", - "matchers": [ - { - "match": "decimal" - } - ] - }, - "$.arrayContaining": { - "combine": "AND", - "matchers": [ - { - "match": "arrayContains", - "variants": [ - { - "index": 0, - "rules": { - "$": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - } - }, - { - "index": 1, - "rules": { - "$": { - "combine": "AND", - "matchers": [ - { - "match": "integer" - } - ] - } - } - }, - { - "index": 2, - "rules": { - "$.foo": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - } - } - ] - } - ] - }, - "$.datetime": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[0-9\\-]+" - } - ] - }, - "$.equality": { - "combine": "AND", - "matchers": [ - { - "match": "equality" - } - ] - }, - "$.id": { - "combine": "AND", - "matchers": [ - { - "match": "integer" - } - ] - }, - "$.itemsMin": { - "combine": "AND", - "matchers": [ - { - "match": "type", - "min": 3 - } - ] - }, - "$.itemsMinMax": { - "combine": "AND", - "matchers": [ - { - "match": "type", - "max": 5, - "min": 3 - } - ] - }, - "$.superstring": { - "combine": "AND", - "matchers": [ - { - "match": "include", - "value": "foo" - } - ] - } - }, - "header": {} - }, - "status": 200 - } - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "3.0.0" - } - }, - "provider": { - "name": "V3Provider" - } -} \ No newline at end of file diff --git a/examples/pacts/PactGoV3MessageConsumer-V3MessageProvider.json b/examples/pacts/PactGoV3MessageConsumer-V3MessageProvider.json deleted file mode 100644 index 3b6014483..000000000 --- a/examples/pacts/PactGoV3MessageConsumer-V3MessageProvider.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "consumer": { - "name": "PactGoV3MessageConsumer" - }, - "messages": [ - { - "contents": { - "datetime": "2020-01-01", - "id": 12, - "lastName": "Sampson", - "name": "Billy" - }, - "description": "a user event", - "matchingRules": { - "body": { - "$.datetime": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[0-9\\-]+" - } - ] - }, - "$.id": { - "combine": "AND", - "matchers": [ - { - "match": "integer" - } - ] - } - } - }, - "metadata": { - "Content-Type": "application/json", - "contentType": "application/json" - }, - "providerStates": [ - { - "name": "User with id 127 exists", - "params": { - "id": 127 - } - } - ] - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "3.0.0" - } - }, - "provider": { - "name": "V3MessageProvider" - } -} \ No newline at end of file diff --git a/examples/pacts/PactGoV4Consumer-V4Provider.json b/examples/pacts/PactGoV4Consumer-V4Provider.json deleted file mode 100644 index 70e8f64df..000000000 --- a/examples/pacts/PactGoV4Consumer-V4Provider.json +++ /dev/null @@ -1,310 +0,0 @@ -{ - "consumer": { - "name": "PactGoV4Consumer" - }, - "interactions": [ - { - "description": "A request to do a foo", - "key": "723d6c7144f49156", - "pending": false, - "providerStates": [ - { - "name": "state 1" - }, - { - "name": "User foo exists", - "params": { - "id": "foo" - } - } - ], - "request": { - "body": { - "content": { - "datetime": "2020-01-01T08:00:45", - "id": 27, - "lastName": "billy", - "name": "billy" - }, - "contentType": "application/json", - "encoded": false - }, - "generators": { - "body": { - "$.datetime": { - "format": "yyyy-MM-dd'T'HH:mm:ss", - "type": "DateTime" - }, - "$.name": { - "expression": "${name}", - "type": "ProviderState" - } - } - }, - "headers": { - "Authorization": [ - "Bearer 1234" - ], - "Content-Type": [ - "application/json" - ] - }, - "matchingRules": { - "body": { - "$.datetime": { - "combine": "AND", - "matchers": [ - { - "format": "yyyy-MM-dd'T'HH:mm:ss", - "match": "datetime" - } - ] - }, - "$.id": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - }, - "$.lastName": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - }, - "$.name": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - }, - "header": { - "$.Authorization[0]": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - }, - "query": { - "$.baz[0]": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[a-z]+" - } - ] - }, - "$.baz[1]": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[a-z]+" - } - ] - }, - "$.baz[2]": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[a-z]+" - } - ] - } - } - }, - "method": "POST", - "path": "/foobar", - "query": { - "baz": [ - "bar", - "bat", - "baz" - ] - } - }, - "response": { - "body": { - "content": { - "accountBalance": 123.76, - "arrayContaining": [ - "string", - 1, - { - "foo": "bar" - } - ], - "datetime": "2020-01-01", - "equality": "a thing", - "id": 12, - "itemsMin": [ - "thereshouldbe3ofthese", - "thereshouldbe3ofthese", - "thereshouldbe3ofthese" - ], - "itemsMinMax": [ - 27, - 27, - 27, - 27, - 27 - ], - "lastName": "Sampson", - "name": "Billy", - "superstring": "foo" - }, - "contentType": "application/json", - "encoded": false - }, - "headers": { - "Content-Type": [ - "application/json" - ] - }, - "matchingRules": { - "body": { - "$.accountBalance": { - "combine": "AND", - "matchers": [ - { - "match": "decimal" - } - ] - }, - "$.arrayContaining": { - "combine": "AND", - "matchers": [ - { - "match": "arrayContains", - "variants": [ - { - "index": 0, - "rules": { - "$": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - } - }, - { - "index": 1, - "rules": { - "$": { - "combine": "AND", - "matchers": [ - { - "match": "integer" - } - ] - } - } - }, - { - "index": 2, - "rules": { - "$.foo": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - } - } - ] - } - ] - }, - "$.datetime": { - "combine": "AND", - "matchers": [ - { - "match": "regex", - "regex": "[0-9\\-]+" - } - ] - }, - "$.equality": { - "combine": "AND", - "matchers": [ - { - "match": "equality" - } - ] - }, - "$.id": { - "combine": "AND", - "matchers": [ - { - "match": "integer" - } - ] - }, - "$.itemsMin": { - "combine": "AND", - "matchers": [ - { - "match": "type", - "min": 3 - } - ] - }, - "$.itemsMinMax": { - "combine": "AND", - "matchers": [ - { - "match": "type", - "max": 5, - "min": 3 - } - ] - }, - "$.superstring": { - "combine": "AND", - "matchers": [ - { - "match": "include", - "value": "foo" - } - ] - } - }, - "header": {} - }, - "status": 200 - }, - "transport": "http", - "type": "Synchronous/HTTP" - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "4.0" - } - }, - "provider": { - "name": "V4Provider" - } -} \ No newline at end of file diff --git a/examples/pacts/grpcconsumer-grpcprovider.json b/examples/pacts/grpcconsumer-grpcprovider.json deleted file mode 100644 index ba9afe21c..000000000 --- a/examples/pacts/grpcconsumer-grpcprovider.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "consumer": { - "name": "grpcconsumer" - }, - "interactions": [ - { - "description": "Route guide - GetFeature", - "interactionMarkup": { - "markup": "```protobuf\nmessage Feature {\n string name = 1;\n message .routeguide.Point location = 2;\n}\n```\n", - "markupType": "COMMON_MARK" - }, - "key": "a5e3ef707bdd24a2", - "pending": false, - "pluginConfiguration": { - "protobuf": { - "descriptorKey": "32f7898819c9f3ece72c5f9de784d705", - "service": "RouteGuide/GetFeature" - } - }, - "providerStates": [ - { - "name": "feature 'Big Tree' exists" - } - ], - "request": { - "contents": { - "content": "CLQBEMgB", - "contentType": "application/protobuf;message=Point", - "contentTypeHint": "BINARY", - "encoded": "base64" - }, - "matchingRules": { - "body": { - "$.latitude": { - "combine": "AND", - "matchers": [ - { - "match": "number" - } - ] - }, - "$.longitude": { - "combine": "AND", - "matchers": [ - { - "match": "number" - } - ] - } - } - } - }, - "response": [ - { - "contents": { - "content": "CghCaWcgVHJlZRIGCLQBEMgB", - "contentType": "application/protobuf;message=Feature", - "contentTypeHint": "BINARY", - "encoded": "base64" - }, - "matchingRules": { - "body": { - "$.location.latitude": { - "combine": "AND", - "matchers": [ - { - "match": "number" - } - ] - }, - "$.location.longitude": { - "combine": "AND", - "matchers": [ - { - "match": "number" - } - ] - }, - "$.name": { - "combine": "AND", - "matchers": [ - { - "match": "type" - } - ] - } - } - } - } - ], - "transport": "grpc", - "type": "Synchronous/Messages" - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "4.0" - }, - "plugins": [ - { - "configuration": { - "32f7898819c9f3ece72c5f9de784d705": { - "protoDescriptors": "CukGChFyb3V0ZV9ndWlkZS5wcm90bxIKcm91dGVndWlkZSJBCgVQb2ludBIaCghsYXRpdHVkZRgBIAEoBVIIbGF0aXR1ZGUSHAoJbG9uZ2l0dWRlGAIgASgFUglsb25naXR1ZGUiUQoJUmVjdGFuZ2xlEiEKAmxvGAEgASgLMhEucm91dGVndWlkZS5Qb2ludFICbG8SIQoCaGkYAiABKAsyES5yb3V0ZWd1aWRlLlBvaW50UgJoaSJMCgdGZWF0dXJlEhIKBG5hbWUYASABKAlSBG5hbWUSLQoIbG9jYXRpb24YAiABKAsyES5yb3V0ZWd1aWRlLlBvaW50Ughsb2NhdGlvbiJUCglSb3V0ZU5vdGUSLQoIbG9jYXRpb24YASABKAsyES5yb3V0ZWd1aWRlLlBvaW50Ughsb2NhdGlvbhIYCgdtZXNzYWdlGAIgASgJUgdtZXNzYWdlIpMBCgxSb3V0ZVN1bW1hcnkSHwoLcG9pbnRfY291bnQYASABKAVSCnBvaW50Q291bnQSIwoNZmVhdHVyZV9jb3VudBgCIAEoBVIMZmVhdHVyZUNvdW50EhoKCGRpc3RhbmNlGAMgASgFUghkaXN0YW5jZRIhCgxlbGFwc2VkX3RpbWUYBCABKAVSC2VsYXBzZWRUaW1lMoUCCgpSb3V0ZUd1aWRlEjYKCkdldEZlYXR1cmUSES5yb3V0ZWd1aWRlLlBvaW50GhMucm91dGVndWlkZS5GZWF0dXJlIgASPgoMTGlzdEZlYXR1cmVzEhUucm91dGVndWlkZS5SZWN0YW5nbGUaEy5yb3V0ZWd1aWRlLkZlYXR1cmUiADABEj4KC1JlY29yZFJvdXRlEhEucm91dGVndWlkZS5Qb2ludBoYLnJvdXRlZ3VpZGUuUm91dGVTdW1tYXJ5IgAoARI/CglSb3V0ZUNoYXQSFS5yb3V0ZWd1aWRlLlJvdXRlTm90ZRoVLnJvdXRlZ3VpZGUuUm91dGVOb3RlIgAoATABQmgKG2lvLmdycGMuZXhhbXBsZXMucm91dGVndWlkZUIPUm91dGVHdWlkZVByb3RvUAFaNmdvb2dsZS5nb2xhbmcub3JnL2dycGMvZXhhbXBsZXMvcm91dGVfZ3VpZGUvcm91dGVndWlkZWIGcHJvdG8z", - "protoFile": "// Copyright 2015 gRPC authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nsyntax = \"proto3\";\n\noption go_package = \"google.golang.org/grpc/examples/route_guide/routeguide\";\noption java_multiple_files = true;\noption java_package = \"io.grpc.examples.routeguide\";\noption java_outer_classname = \"RouteGuideProto\";\n\npackage routeguide;\n\n// Interface exported by the server.\nservice RouteGuide {\n // A simple RPC.\n //\n // Obtains the feature at a given position.\n //\n // A feature with an empty name is returned if there's no feature at the given\n // position.\n rpc GetFeature(Point) returns (Feature) {}\n\n // A server-to-client streaming RPC.\n //\n // Obtains the Features available within the given Rectangle. Results are\n // streamed rather than returned at once (e.g. in a response message with a\n // repeated field), as the rectangle may cover a large area and contain a\n // huge number of features.\n rpc ListFeatures(Rectangle) returns (stream Feature) {}\n\n // A client-to-server streaming RPC.\n //\n // Accepts a stream of Points on a route being traversed, returning a\n // RouteSummary when traversal is completed.\n rpc RecordRoute(stream Point) returns (RouteSummary) {}\n\n // A Bidirectional streaming RPC.\n //\n // Accepts a stream of RouteNotes sent while a route is being traversed,\n // while receiving other RouteNotes (e.g. from other users).\n rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}\n}\n\n// Points are represented as latitude-longitude pairs in the E7 representation\n// (degrees multiplied by 10**7 and rounded to the nearest integer).\n// Latitudes should be in the range +/- 90 degrees and longitude should be in\n// the range +/- 180 degrees (inclusive).\nmessage Point {\n int32 latitude = 1;\n int32 longitude = 2;\n}\n\n// A latitude-longitude rectangle, represented as two diagonally opposite\n// points \"lo\" and \"hi\".\nmessage Rectangle {\n // One corner of the rectangle.\n Point lo = 1;\n\n // The other corner of the rectangle.\n Point hi = 2;\n}\n\n// A feature names something at a given point.\n//\n// If a feature could not be named, the name is empty.\nmessage Feature {\n // The name of the feature.\n string name = 1;\n\n // The point where the feature is detected.\n Point location = 2;\n}\n\n// A RouteNote is a message sent while at a given point.\nmessage RouteNote {\n // The location from which the message is sent.\n Point location = 1;\n\n // The message to be sent.\n string message = 2;\n}\n\n// A RouteSummary is received in response to a RecordRoute rpc.\n//\n// It contains the number of individual points received, the number of\n// detected features, and the total distance covered as the cumulative sum of\n// the distance between each point.\nmessage RouteSummary {\n // The number of points received.\n int32 point_count = 1;\n\n // The number of known features passed while traversing the route.\n int32 feature_count = 2;\n\n // The distance covered in metres.\n int32 distance = 3;\n\n // The duration of the traversal in seconds.\n int32 elapsed_time = 4;\n}\n" - } - }, - "name": "protobuf", - "version": "0.2.4" - } - ] - }, - "provider": { - "name": "grpcprovider" - } -} \ No newline at end of file diff --git a/examples/pacts/matttcpconsumer-matttcpprovider.json b/examples/pacts/matttcpconsumer-matttcpprovider.json deleted file mode 100644 index 3774ae6f4..000000000 --- a/examples/pacts/matttcpconsumer-matttcpprovider.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "consumer": { - "name": "matttcpconsumer" - }, - "interactions": [ - { - "description": "Matt message", - "key": "1d2254a9979327d8", - "pending": false, - "providerStates": [ - { - "name": "the world exists" - } - ], - "request": { - "contents": { - "content": "MATThellotcpMATT", - "contentType": "application/matt", - "contentTypeHint": "DEFAULT", - "encoded": false - } - }, - "response": [ - { - "contents": { - "content": "MATTtcpworldMATT", - "contentType": "application/matt", - "contentTypeHint": "DEFAULT", - "encoded": false - } - } - ], - "transport": "matt", - "type": "Synchronous/Messages" - } - ], - "metadata": { - "pactRust": { - "ffi": "0.3.18", - "mockserver": "0.9.8", - "models": "1.0.2" - }, - "pactSpecification": { - "version": "4.0" - }, - "plugins": [ - { - "configuration": {}, - "name": "matt", - "version": "0.0.7" - } - ] - }, - "provider": { - "name": "matttcpprovider" - } -} \ No newline at end of file diff --git a/examples/plugin/consumer_plugin_test.go b/examples/plugin/consumer_plugin_test.go index 303172d9a..edb3b8d44 100644 --- a/examples/plugin/consumer_plugin_test.go +++ b/examples/plugin/consumer_plugin_test.go @@ -6,7 +6,7 @@ package plugin import ( "bufio" "fmt" - "io/ioutil" + "io" "net" "net/http" "net/url" @@ -99,7 +99,7 @@ func callMattServiceHTTP(msc consumer.MockServerConfig, message string) (string, Scheme: "http", Path: "/matt", }, - Body: ioutil.NopCloser(strings.NewReader(generateMattMessage(message))), + Body: io.NopCloser(strings.NewReader(generateMattMessage(message))), Header: make(http.Header), } @@ -111,7 +111,7 @@ func callMattServiceHTTP(msc consumer.MockServerConfig, message string) (string, return "", err } - bytes, err := ioutil.ReadAll(res.Body) + bytes, err := io.ReadAll(res.Body) if err != nil { return "", err diff --git a/examples/protobuf-message/protobuf_consumer_test.go b/examples/protobuf-message/protobuf_consumer_test.go index 92e4ef2c3..a373653b5 100644 --- a/examples/protobuf-message/protobuf_consumer_test.go +++ b/examples/protobuf-message/protobuf_consumer_test.go @@ -42,7 +42,7 @@ func TestPluginMessageConsumer(t *testing.T) { ExpectsToReceive("feature message"). UsingPlugin(message.PluginConfig{ Plugin: "protobuf", - Version: "0.3.4", + Version: "0.3.8", }). WithContents(protoMessage, "application/protobuf"). ExecuteTest(t, func(m message.AsynchronousMessage) error { diff --git a/go.mod b/go.mod index 3f92f9916..55b1b03b5 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,12 @@ go 1.20 require ( github.com/golang/protobuf v1.5.3 - github.com/hashicorp/go-getter v1.7.2 + github.com/hashicorp/go-getter v1.7.3 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/logutils v1.0.0 github.com/linkedin/goavro/v2 v2.12.0 github.com/spf13/afero v1.9.5 - github.com/spf13/cobra v1.7.0 + github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 google.golang.org/grpc v1.58.1 google.golang.org/protobuf v1.31.0 @@ -45,12 +45,12 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/ulikunitz/xz v0.5.11 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.130.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 4c7b62791..43ed9fe72 100644 --- a/go.sum +++ b/go.sum @@ -214,7 +214,7 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -338,8 +338,8 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.2 h1:uJDtyXwEfalmp1PqdxuhZqrNkUyClZAhVeZYTArbqkg= -github.com/hashicorp/go-getter v1.7.2/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E= +github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= @@ -394,8 +394,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -439,8 +439,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -526,8 +526,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -636,8 +636,8 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -652,8 +652,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/installer/installer.go b/installer/installer.go index 7b5a20e13..66637835d 100644 --- a/installer/installer.go +++ b/installer/installer.go @@ -5,7 +5,6 @@ package installer import ( "fmt" "io" - "io/ioutil" "log" "os" "os/exec" @@ -444,7 +443,7 @@ func (configuration) readConfig() pactConfig { Libraries: map[string]packageMetadata{}, } - bytes, err := ioutil.ReadFile(pactConfigPath) + bytes, err := os.ReadFile(pactConfigPath) if err != nil { log.Println("[DEBUG] error reading file", pactConfigPath, "error: ", err) return c @@ -474,7 +473,7 @@ func (configuration) writeConfig(c pactConfig) error { } log.Println("[DEBUG] writing yaml config to file", string(bytes)) - return ioutil.WriteFile(pactConfigPath, bytes, 0644) + return os.WriteFile(pactConfigPath, bytes, 0644) } type hasher interface { diff --git a/installer/installer_test.go b/installer/installer_test.go index 85ed2e1c0..68fc5b1df 100644 --- a/installer/installer_test.go +++ b/installer/installer_test.go @@ -79,7 +79,7 @@ func TestInstallerDownloader(t *testing.T) { return nil }) - i.downloadDependencies() // This will actually error on the "chmod" if the file doesn't exist + _ = i.downloadDependencies() // This will actually error on the "chmod" if the file doesn't exist assert.True(t, mock.called) }) diff --git a/internal/native/message_server_test.go b/internal/native/message_server_test.go index e592f9dcd..d4cdf8619 100644 --- a/internal/native/message_server_test.go +++ b/internal/native/message_server_test.go @@ -6,9 +6,9 @@ import ( context "context" "encoding/json" "fmt" - "io/ioutil" - l "log" + "io" "os" + l"log" "testing" "time" @@ -21,7 +21,7 @@ import ( ) func TestHandleBasedMessageTestsWithString(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) s := NewMessageServer("test-message-consumer", "test-message-provider") @@ -48,7 +48,7 @@ func TestHandleBasedMessageTestsWithString(t *testing.T) { } func TestHandleBasedMessageTestsWithJSON(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) s := NewMessageServer("test-message-consumer", "test-message-provider") @@ -82,7 +82,7 @@ func TestHandleBasedMessageTestsWithJSON(t *testing.T) { } func TestHandleBasedMessageTestsWithBinary(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) s := NewMessageServer("test-binarymessage-consumer", "test-binarymessage-provider"). @@ -116,7 +116,7 @@ func TestHandleBasedMessageTestsWithBinary(t *testing.T) { // Extract binary payload, base 64 decode it, unzip it r, err := gzip.NewReader(bytes.NewReader(body)) assert.NoError(t, err) - result, _ := ioutil.ReadAll(r) + result, _ := io.ReadAll(r) assert.Equal(t, encodedMessage, string(result)) @@ -191,7 +191,7 @@ func TestGetPluginSyncMessageContentsAsBytes(t *testing.T) { m := NewMessageServer("test-message-consumer", "test-message-provider") // Protobuf plugin test - err := m.UsingPlugin("protobuf", "0.3.0") + err := m.UsingPlugin("protobuf", "0.3.8") assert.NoError(t, err) i := m.NewSyncMessageInteraction("grpc interaction") @@ -248,7 +248,7 @@ func TestGetPluginAsyncMessageContentsAsBytes(t *testing.T) { m := NewMessageServer("test-message-consumer", "test-message-provider") // Protobuf plugin test - _ = m.UsingPlugin("protobuf", "0.3.0") + _ = m.UsingPlugin("protobuf", "0.3.8") i := m.NewAsyncMessageInteraction("grpc interaction") @@ -281,14 +281,14 @@ func TestGetPluginAsyncMessageContentsAsBytes(t *testing.T) { } func TestGrpcPluginInteraction(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) _ = log.SetLogLevel("TRACE") m := NewMessageServer("test-message-consumer", "test-message-provider") // Protobuf plugin test - _ = m.UsingPlugin("protobuf", "0.3.0") + _ = m.UsingPlugin("protobuf", "0.3.8") i := m.NewSyncMessageInteraction("grpc interaction") diff --git a/internal/native/mock_server_test.go b/internal/native/mock_server_test.go index 23a2d427c..bb3e595c2 100644 --- a/internal/native/mock_server_test.go +++ b/internal/native/mock_server_test.go @@ -2,7 +2,7 @@ package native import ( "fmt" - "io/ioutil" + "io" "net/http" "os" "testing" @@ -58,7 +58,7 @@ func TestMockServer_MismatchesFail(t *testing.T) { } func TestMockServer_VerifySuccess(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) m := MockServer{} @@ -81,7 +81,7 @@ func TestMockServer_VerifySuccess(t *testing.T) { } func TestMockServer_VerifyFail(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) m := MockServer{} port, _ := m.CreateMockServer(pactSimple, "0.0.0.0:0", false) @@ -97,7 +97,7 @@ func TestMockServer_VerifyFail(t *testing.T) { } func TestMockServer_WritePactfile(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) m := MockServer{} @@ -126,7 +126,7 @@ func TestVersion(t *testing.T) { } func TestHandleBasedHTTPTests(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) m := NewHTTPPact("test-http-consumer", "test-http-provider") @@ -165,7 +165,7 @@ func TestHandleBasedHTTPTests(t *testing.T) { } func TestPluginInteraction(t *testing.T) { - tmpPactFolder, err := ioutil.TempDir("", "pact-go") + tmpPactFolder, err := os.MkdirTemp("", "pact-go") assert.NoError(t, err) _ = log.SetLogLevel("trace") @@ -202,7 +202,7 @@ func TestPluginInteraction(t *testing.T) { res, err := http.Get(fmt.Sprintf("http://0.0.0.0:%d/protobuf", port)) assert.NoError(t, err) - bytes, err := ioutil.ReadAll(res.Body) + bytes, err := io.ReadAll(res.Body) assert.NoError(t, err) initPluginRequest := &InitPluginRequest{} diff --git a/message/v4/asynchronous_message_test.go b/message/v4/asynchronous_message_test.go index d5d756086..e8706627f 100644 --- a/message/v4/asynchronous_message_test.go +++ b/message/v4/asynchronous_message_test.go @@ -64,7 +64,7 @@ func TestAsyncTypeSystem(t *testing.T) { ExpectsToReceive("some csv content"). UsingPlugin(PluginConfig{ Plugin: "csv", - Version: "0.0.1", + Version: "0.0.3", }). WithContents(csvInteraction, "text/csv"). // StartTransport("notarealtransport", "127.0.0.1", nil). diff --git a/message/v4/synchronous_message_test.go b/message/v4/synchronous_message_test.go index a10293eb5..87d87ff45 100644 --- a/message/v4/synchronous_message_test.go +++ b/message/v4/synchronous_message_test.go @@ -105,7 +105,7 @@ func TestSyncTypeSystem(t *testing.T) { Given("some state"). UsingPlugin(PluginConfig{ Plugin: "protobuf", - Version: "0.3.0", + Version: "0.3.8", }). WithContents(grpcInteraction, "application/protobuf"). StartTransport("grpc", "127.0.0.1", nil). // For plugin tests, we can't assume if a transport is needed, so this is optional @@ -128,7 +128,7 @@ func TestSyncTypeSystem(t *testing.T) { Given("some state"). UsingPlugin(PluginConfig{ Plugin: "protobuf", - Version: "0.3.0", + Version: "0.3.8", }). WithContents(grpcInteraction, "application/protobuf"). StartTransport("grpc", "127.0.0.1", nil). // For plugin tests, we can't assume if a transport is needed, so this is optional diff --git a/message/verifier.go b/message/verifier.go index 563b2a0dd..eeecc25cf 100644 --- a/message/verifier.go +++ b/message/verifier.go @@ -3,7 +3,7 @@ package message import ( "encoding/base64" "encoding/json" - "io/ioutil" + "io" "log" "net/http" @@ -58,7 +58,7 @@ func CreateMessageHandler(messageHandlers Handlers) proxy.Middleware { // Extract message var message messageVerificationHandlerRequest - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() log.Printf("[TRACE] message verification handler received request: %+s, %s", body, r.URL.Path) diff --git a/provider/consumer_version_selector.go b/provider/consumer_version_selector.go index b1b8ad134..b717ad8a0 100644 --- a/provider/consumer_version_selector.go +++ b/provider/consumer_version_selector.go @@ -7,7 +7,7 @@ package provider // Where a new selector is available in the broker but not yet supported here, // you may use the UntypedConsumerVersionSelector to pass in arbitrary key/values // -// Definitive list: https://github.com/pact-foundation/pact_broker/blob/master/spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_combinations_spec.rb +// Definitive list: https://github.com/pact-foundation/pact_broker/blob/master/spec/lib/pact_broker/api/contracts/pacts_for_verification_json_query_schema_combinations_spec.rb type ConsumerVersionSelector struct { Tag string `json:"tag,omitempty"` FallbackTag string `json:"fallbackTag,omitempty"` diff --git a/provider/verifier.go b/provider/verifier.go index 74feb8300..86b9fcc83 100644 --- a/provider/verifier.go +++ b/provider/verifier.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "log" "net" "net/http" @@ -231,7 +230,7 @@ func getStateFromRequest(r *http.Request) (stateHandlerAction, error) { } // Body is consumed above, need to put it back after ;P - r.Body = ioutil.NopCloser(strings.NewReader(buf.String())) + r.Body = io.NopCloser(strings.NewReader(buf.String())) log.Println("[TRACE] getStateFromRequest received raw input", buf.String()) err = json.Unmarshal([]byte(buf.String()), &state) @@ -263,7 +262,7 @@ func stateHandlerMiddleware(stateHandlers models.StateHandlers, afterEach Hook) _, _ = io.ReadAll(tr) // Body is consumed above, need to put it back after ;P - r.Body = ioutil.NopCloser(strings.NewReader(buf.String())) + r.Body = io.NopCloser(strings.NewReader(buf.String())) log.Println("[TRACE] state handler received raw input", buf.String()) err := json.Unmarshal([]byte(buf.String()), &state)