fix and regen

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-02-22 00:12:01 +03:00
parent f72a39965a
commit 09f5a71e0b
32 changed files with 296 additions and 371 deletions

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc-gen-go-micro v3.10.1
// - protoc v3.21.12
// source: test.proto
@@ -8,29 +8,26 @@ package pb
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/combo/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
)
var (
TestName = "Test"
TestEndpoints = []api.Endpoint{
)
var (
TestServerEndpoints = []v3.EndpointMetadata{
{
Name: "Test.Call",
Path: []string{"/v1/call"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.Call",
Path: "/v1/call",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
}
type TestClient interface {
Call(ctx context.Context, req *proto.CallReq, opts ...client.CallOption) (*proto.CallRsp, error)
}

View File

@@ -1,13 +1,13 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// protoc-gen-go-micro version: v3.10.1
// source: test.proto
package pb
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/combo/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
time "time"
@@ -54,8 +54,6 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
}
h := &testServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(&endpoint))
}
nopts = append(nopts, v3.HandlerEndpoints(TestServerEndpoints))
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
}

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc-gen-go-micro v3.10.1
// - protoc v3.21.12
// source: test.proto
@@ -8,29 +8,26 @@ package pb
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/combo/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
)
var (
TestName = "Test"
TestEndpoints = []api.Endpoint{
)
var (
TestServerEndpoints = []v3.EndpointMetadata{
{
Name: "Test.Call",
Path: []string{"/v1/call"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.Call",
Path: "/v1/call",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
}
type TestClient interface {
Call(ctx context.Context, req *proto.CallReq, opts ...client.CallOption) (*proto.CallRsp, error)
}

View File

@@ -1,13 +1,13 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// protoc-gen-go-micro version: v3.10.1
// source: test.proto
package pb
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/combo/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
time "time"
@@ -54,8 +54,6 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
}
h := &testServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(&endpoint))
}
nopts = append(nopts, v3.HandlerEndpoints(TestServerEndpoints))
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
}

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc-gen-go-micro v3.10.1
// - protoc v3.21.12
// source: test.proto
@@ -8,29 +8,26 @@ package pb
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/combo/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
)
var (
TestName = "Test"
TestEndpoints = []api.Endpoint{
)
var (
TestServerEndpoints = []v3.EndpointMetadata{
{
Name: "Test.Call",
Path: []string{"/v1/call"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.Call",
Path: "/v1/call",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
}
type TestClient interface {
Call(ctx context.Context, req *proto.CallReq, opts ...client.CallOption) (*proto.CallRsp, error)
}

View File

@@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// protoc-gen-go-micro version: v3.10.1
// source: test.proto
package pb
@@ -7,8 +7,8 @@ package pb
import (
context "context"
v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/combo/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
http "net/http"
@@ -66,8 +66,6 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
}
h := &testServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(&endpoint))
}
nopts = append(nopts, v31.HandlerEndpoints(TestServerEndpoints))
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
}

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc-gen-go-micro v3.10.1
// - protoc v3.21.12
// source: test.proto
@@ -8,29 +8,26 @@ package helloworld
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/grpc/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
)
var (
TestName = "Test"
TestEndpoints = []api.Endpoint{
)
var (
TestServerEndpoints = []v3.EndpointMetadata{
{
Name: "Test.Call",
Path: []string{"/api/v0/test/call/TEST"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.Call",
Path: "/api/v0/test/call/TEST",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
}
type TestClient interface {
Call(ctx context.Context, req *proto.Request, opts ...client.CallOption) (*proto.Response, error)
}

View File

@@ -1,13 +1,13 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// protoc-gen-go-micro version: v3.10.1
// source: test.proto
package helloworld
import (
context "context"
v3 "go.unistack.org/micro-server-http/v3"
proto "go.unistack.org/micro-tests/server/grpc/proto"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
)
@@ -47,8 +47,6 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
}
h := &testServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(&endpoint))
}
nopts = append(nopts, v3.HandlerEndpoints(TestServerEndpoints))
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
}

View File

@@ -107,7 +107,7 @@ func TestGRPCServer(t *testing.T) {
server.Address("127.0.0.1:0"),
server.Codec("text/plain", codec.NewCodec()),
)
if err = health.RegisterHealthServer(srv, health.NewHandler(health.Version("0.0.1"))); err != nil {
if err = health.RegisterHealthServiceServer(srv, health.NewHandler(health.Version("0.0.1"))); err != nil {
t.Fatalf("cant register health handler: %v", err)
}

View File

@@ -2,27 +2,31 @@ syntax = "proto3";
package helloworld;
option go_package = "go.unistack.org/micro-tests/server/grpc/proto;helloworld";
import "api/annotations.proto";
option go_package = "go.unistack.org/micro-tests/server/grpc/proto;helloworld";
service Test {
rpc Call(Request) returns (Response) {
option (micro.api.http) = { post: "/api/v0/test/call/TEST"; body: "*"; };
};
rpc Call(Request) returns (Response) {
option (micro.api.http) = {
post: "/api/v0/test/call/TEST";
body: "*";
};
}
}
message Request {
string uuid = 1;
string name = 2;
string name = 2;
Broken broken = 4;
};
Broken broken = 4;
}
message Broken {
string field = 1;
};
}
message Response {
string msg = 1;
Broken broken = 4;
};
string msg = 1;
Broken broken = 4;
}

View File

@@ -316,9 +316,9 @@ func TestNativeFormUrlencoded(t *testing.T) {
Clientid: "1234567890",
Csrftoken: "csrftoken",
Nested: &pb.Nested{Uint64Args: []*wrapperspb.UInt64Value{
&wrapperspb.UInt64Value{Value: 1},
&wrapperspb.UInt64Value{Value: 2},
&wrapperspb.UInt64Value{Value: 3},
{Value: 1},
{Value: 2},
{Value: 3},
}},
})
if err != nil {
@@ -375,7 +375,7 @@ func TestNativeClientServer(t *testing.T) {
if err := pb.RegisterTestDoubleServer(srv, h); err != nil {
t.Fatal(err)
}
if err := handler.RegisterMeterServer(srv, handler.NewHandler(handler.Meter(srv.Options().Meter))); err != nil {
if err := handler.RegisterMeterServiceServer(srv, handler.NewHandler(handler.Meter(srv.Options().Meter))); err != nil {
t.Fatal(err)
}
// start server
@@ -406,9 +406,9 @@ func TestNativeClientServer(t *testing.T) {
Clientid: "1234567890",
Csrftoken: "csrftoken",
Nested: &pb.Nested{Uint64Args: []*wrapperspb.UInt64Value{
&wrapperspb.UInt64Value{Value: 1},
&wrapperspb.UInt64Value{Value: 2},
&wrapperspb.UInt64Value{Value: 3},
{Value: 1},
{Value: 2},
{Value: 3},
}},
})
if err != nil {
@@ -427,9 +427,9 @@ func TestNativeClientServer(t *testing.T) {
Clientid: "1234567890",
Csrftoken: "csrftoken",
Nested: &pb.Nested{Uint64Args: []*wrapperspb.UInt64Value{
&wrapperspb.UInt64Value{Value: 1},
&wrapperspb.UInt64Value{Value: 2},
&wrapperspb.UInt64Value{Value: 3},
{Value: 1},
{Value: 2},
{Value: 3},
}},
})
if err != nil {

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc-gen-go-micro v3.10.2
// - protoc v3.21.12
// source: test.proto
@@ -8,28 +8,25 @@ package pb
import (
context "context"
api "go.unistack.org/micro/v3/api"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
)
var (
TestDoubleName = "TestDouble"
TestDoubleEndpoints = []api.Endpoint{
)
var (
TestDoubleServerEndpoints = []v3.EndpointMetadata{
{
Name: "TestDouble.CallDouble",
Path: []string{"/v1/testdouble/call/name/{name}"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "TestDouble.CallDouble",
Path: "/v1/testdouble/call/name/{name}",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
func NewTestDoubleEndpoints() []api.Endpoint {
return TestDoubleEndpoints
}
type TestDoubleClient interface {
CallDouble(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)
}
@@ -40,43 +37,40 @@ type TestDoubleServer interface {
var (
TestName = "Test"
TestEndpoints = []api.Endpoint{
)
var (
TestServerEndpoints = []v3.EndpointMetadata{
{
Name: "Test.CallRepeatedString",
Path: []string{"/v1/test/call_repeated_string"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.CallRepeatedString",
Path: "/v1/test/call_repeated_string",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "Test.CallRepeatedInt64",
Path: []string{"/v1/test/call_repeated_int64"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.CallRepeatedInt64",
Path: "/v1/test/call_repeated_int64",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "Test.Call",
Path: []string{"/v1/test/call/{name}"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.Call",
Path: "/v1/test/call/{name}",
Method: "POST",
Body: "*",
Stream: false,
},
{
Name: "Test.CallError",
Path: []string{"/v1/test/callerror/{name}"},
Method: []string{"POST"},
Body: "*",
Handler: "rpc",
Name: "Test.CallError",
Path: "/v1/test/callerror/{name}",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
func NewTestEndpoints() []api.Endpoint {
return TestEndpoints
}
type TestClient interface {
CallRepeatedString(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)
CallRepeatedInt64(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)

View File

@@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// protoc-gen-go-micro version: v3.10.2
// source: test.proto
package pb
@@ -8,7 +8,6 @@ import (
context "context"
v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
http "net/http"
@@ -66,9 +65,7 @@ func RegisterTestDoubleServer(s server.Server, sh TestDoubleServer, opts ...serv
}
h := &testDoubleServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range TestDoubleEndpoints {
nopts = append(nopts, api.WithEndpoint(&endpoint))
}
nopts = append(nopts, v31.HandlerEndpoints(TestDoubleServerEndpoints))
return s.Handle(s.NewHandler(&TestDouble{h}, append(nopts, opts...)...))
}
@@ -135,8 +132,8 @@ func (c *testClient) Call(ctx context.Context, req *CallReq, opts ...client.Call
v3.Body("*"),
)
opts = append(opts,
v3.Cookie("Csrftoken", "true"),
v3.Header("Clientid", "true"),
v3.Cookie("Csrftoken", "true"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
@@ -215,8 +212,6 @@ func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOp
}
h := &testServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range TestEndpoints {
nopts = append(nopts, api.WithEndpoint(&endpoint))
}
nopts = append(nopts, v31.HandlerEndpoints(TestServerEndpoints))
return s.Handle(s.NewHandler(&Test{h}, append(nopts, opts...)...))
}