Skip to content

Commit

Permalink
more cases covered in the test
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-is-hate committed Jun 3, 2024
1 parent 2e00c56 commit 66b97ca
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 36 deletions.
4 changes: 3 additions & 1 deletion integrated_tests/imported_message/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure().include_file("mod.rs").compile(
&[
"primary/primary.proto",
"primary/service.proto",
"primary/rectangle.proto",
"primary/request.proto",
"primary/response.proto",
"imported/imported.proto",
"zimported/zimported.proto",
],
Expand Down
20 changes: 20 additions & 0 deletions integrated_tests/imported_message/primary/request.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

// Copyright 2015 gRPC authors.
//
syntax = "proto3";

option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary";
option java_multiple_files = true;
option java_package = "io.grpc.examples.primary";
option java_outer_classname = "PrimaryProto";

package primary;

// A request payload to get a Rectangle.
message RectangleLocationRequest {
// The width of the rectangle.
int32 x = 1;
int32 y = 2;
int32 width = 3;
int32 length = 4;
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@

// Copyright 2015 gRPC authors.
//
syntax = "proto3";

option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary";
option java_multiple_files = true;
option java_package = "io.grpc.examples.primary";
option java_outer_classname = "PrimaryProto";

import "primary/rectangle.proto";
import "zimported/zimported.proto";

package primary;

service Primary {
rpc GetRectangle(RectangleLocationRequest) returns (RectangleLocationResponse) {}
}

// A request payload to get a Rectangle.
message RectangleLocationRequest {
// The width of the rectangle.
int32 x = 1;
int32 y = 2;
int32 width = 3;
int32 length = 4;
}

// A response payload containing a Rectangle.
message RectangleLocationResponse {
// The location of the rectangle.
Rectangle rectangle = 1;
}

// Copyright 2015 gRPC authors.
//
syntax = "proto3";

option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary";
option java_multiple_files = true;
option java_package = "io.grpc.examples.primary";
option java_outer_classname = "PrimaryProto";

import "primary/rectangle.proto";

package primary;

// A response payload containing a Rectangle.
message RectangleLocationResponse {
// The location of the rectangle.
Rectangle rectangle = 1;
}
18 changes: 18 additions & 0 deletions integrated_tests/imported_message/primary/service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

// Copyright 2015 gRPC authors.
//
syntax = "proto3";

option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary";
option java_multiple_files = true;
option java_package = "io.grpc.examples.primary";
option java_outer_classname = "PrimaryProto";

import "primary/request.proto";
import "primary/response.proto";

package primary;

service Primary {
rpc GetRectangle(RectangleLocationRequest) returns (RectangleLocationResponse) {}
}
4 changes: 2 additions & 2 deletions integrated_tests/imported_message/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ mod tests {
async fn test_proto_client() {
let _ = env_logger::builder().is_test(true).try_init();

let mut pact_builder = PactBuilderAsync::new_v4("grpc-consumer-rust", "imported_message");
let mut pact_builder: PactBuilderAsync = PactBuilderAsync::new_v4("grpc-consumer-rust", "imported_message");
let mock_server = pact_builder
.using_plugin("protobuf", None)
.await
.synchronous_message_interaction(
"package namespace not respected",
|mut i| async move {
let proto_file = Path::new("primary/primary.proto")
let proto_file = Path::new("primary/service.proto")
.canonicalize()
.unwrap()
.to_string_lossy()
Expand Down

0 comments on commit 66b97ca

Please sign in to comment.