Skip to content

Commit

Permalink
demo: show multiple additional includes in go grpc test_enums example
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed May 21, 2024
1 parent e17144f commit 783a0dc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions examples/gRPC/test_enums/consumer_go/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,21 @@ func TestEnumClient(t *testing.T) {

dir, _ := filepath.Abs("../proto/test_enum.proto")
additionalDir, _ := filepath.Abs("../proto2")
additionalDir2, _ := filepath.Abs("../proto3")

grpcInteraction := `{
"pact:proto": "` + filepath.ToSlash(dir) + `",
"pact:proto-service": "Test/GetFeature2",
"pact:content-type": "application/protobuf",
"pact:protobuf-config": {
"additionalIncludes": ["` + filepath.ToSlash(additionalDir) + `"]
"additionalIncludes": ["` + filepath.ToSlash(additionalDir) + `","` + filepath.ToSlash(additionalDir2) + `"]
},
"request": {
"latitude": "matching(number, 3)",
"longitude": "matching(number, 4)"
},
"response": {
"result": "matching(type, 'VALUE_ONE')"
"result": "matching(type, 'VALUE_ONE_1')"
}
}`

Expand Down
2 changes: 1 addition & 1 deletion examples/gRPC/test_enums/consumer_go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module test_enums/consumer
go 1.18

require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.2
github.com/pact-foundation/pact-go/v2 v2.0.0-beta.14.0.20220821133132-63f276fae621
google.golang.org/grpc v1.46.2
)
Expand Down
3 changes: 2 additions & 1 deletion examples/gRPC/test_enums/proto/test_enum.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package routeguide.v2;
option go_package = "io.pact/test_enum";

import "enum.proto";
import "enum2.proto";

// Points are represented as latitude-longitude pairs in the E7 representation
// (degrees multiplied by 10**7 and rounded to the nearest integer).
Expand All @@ -33,7 +34,7 @@ message Point {
//
// If a feature could not be named, the name is empty.
message Feature {
routeguide.other.OtherFileEnum result = 1;
routeguide.other2.OtherFileEnum2 result = 1;
}

// Interface exported by the server.
Expand Down
11 changes: 11 additions & 0 deletions examples/gRPC/test_enums/proto3/enum2.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";

package routeguide.other2;

option go_package = "io.pact/other2";

enum OtherFileEnum2 {
VALUE_ZERO_0 = 0;
VALUE_ONE_1 = 1;
VALUE_TWO_2 = 2;
}

0 comments on commit 783a0dc

Please sign in to comment.