add combo test example

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-03-04 23:30:53 +03:00
parent 09f5a71e0b
commit 288d16a6f0
17 changed files with 681 additions and 902 deletions

View File

@@ -1,8 +1,8 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.1
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto
// source: proto.proto
package pb
@@ -20,7 +20,7 @@ var (
TestServerEndpoints = []v3.EndpointMetadata{
{
Name: "Test.Call",
Path: "/v1/call",
Path: "/Call",
Method: "POST",
Body: "*",
Stream: false,

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.1
// source: test.proto
// protoc-gen-go-micro version: v3.10.2
// source: proto.proto
package pb
@@ -10,7 +10,6 @@ import (
proto "go.unistack.org/micro-tests/server/combo/proto"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
time "time"
)
type testClient struct {
@@ -23,8 +22,6 @@ func NewTestClient(name string, c client.Client) TestClient {
}
func (c *testClient) Call(ctx context.Context, req *proto.CallReq, opts ...client.CallOption) (*proto.CallRsp, error) {
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
rsp := &proto.CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.Call", req), rsp, opts...)
if err != nil {
@@ -38,10 +35,6 @@ type testServer struct {
}
func (h *testServer) Call(ctx context.Context, req *proto.CallReq, rsp *proto.CallRsp) error {
var cancel context.CancelFunc
td := time.Duration(5000000000)
ctx, cancel = context.WithTimeout(ctx, td)
defer cancel()
return h.TestServer.Call(ctx, req, rsp)
}