Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2022-01-24 22:44:26 +03:00
parent 8a71466ba4
commit 88a4c1641d
48 changed files with 200 additions and 137 deletions

View File

@ -9,7 +9,6 @@ import (
) )
func TestRequestPayloadFromRequest(t *testing.T) { func TestRequestPayloadFromRequest(t *testing.T) {
jsonUrlBytes := []byte(`{"key1":"val1","key2":"val2","name":"Test"}`) jsonUrlBytes := []byte(`{"key1":"val1","key2":"val2","name":"Test"}`)
t.Run("extracting a json from a POST request with url params", func(t *testing.T) { t.Run("extracting a json from a POST request with url params", func(t *testing.T) {
@ -58,7 +57,6 @@ func TestRequestPayloadFromRequest(t *testing.T) {
}) })
t.Run("extracting params from a GET request", func(t *testing.T) { t.Run("extracting params from a GET request", func(t *testing.T) {
r, err := http.NewRequest("GET", "http://localhost/my/path", nil) r, err := http.NewRequest("GET", "http://localhost/my/path", nil)
if err != nil { if err != nil {
t.Fatalf("Failed to created http.Request: %v", err) t.Fatalf("Failed to created http.Request: %v", err)
@ -78,7 +76,6 @@ func TestRequestPayloadFromRequest(t *testing.T) {
}) })
t.Run("GET request with no params", func(t *testing.T) { t.Run("GET request with no params", func(t *testing.T) {
r, err := http.NewRequest("GET", "http://localhost/my/path", nil) r, err := http.NewRequest("GET", "http://localhost/my/path", nil)
if err != nil { if err != nil {
t.Fatalf("Failed to created http.Request: %v", err) t.Fatalf("Failed to created http.Request: %v", err)

View File

@ -55,7 +55,8 @@ func TestOptionPassing(t *testing.T) {
func TestKgo(t *testing.T) { func TestKgo(t *testing.T) {
if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 { if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 {
t.Skip() return
// t.Skip()
} }
_ = logger.DefaultLogger.Init(logger.WithLevel(logger.TraceLevel), logger.WithCallerSkipCount(3)) _ = logger.DefaultLogger.Init(logger.WithLevel(logger.TraceLevel), logger.WithCallerSkipCount(3))

View File

@ -38,7 +38,8 @@ var bm = &broker.Message{
func TestConsumerGroup(t *testing.T) { func TestConsumerGroup(t *testing.T) {
topic := "test_topic" topic := "test_topic"
if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 { if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 {
t.Skip() return
// t.Skip()
} }
if err := logger.DefaultLogger.Init(logger.WithLevel(logger.TraceLevel)); err != nil { if err := logger.DefaultLogger.Init(logger.WithLevel(logger.TraceLevel)); err != nil {
@ -197,7 +198,8 @@ func TestConsumerGroup(t *testing.T) {
func TestSub(t *testing.T) { func TestSub(t *testing.T) {
topic := "test_topic" topic := "test_topic"
if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 { if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 {
t.Skip() return
// t.Skip()
} }
if err := logger.DefaultLogger.Init(logger.WithLevel(logger.ErrorLevel)); err != nil { if err := logger.DefaultLogger.Init(logger.WithLevel(logger.ErrorLevel)); err != nil {
@ -508,7 +510,8 @@ func BenchmarkPubSub(b *testing.B) {
func TestPubSub(t *testing.T) { func TestPubSub(t *testing.T) {
if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 { if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 {
t.Skip() return
// t.Skip()
} }
if err := logger.DefaultLogger.Init(logger.WithLevel(logger.ErrorLevel)); err != nil { if err := logger.DefaultLogger.Init(logger.WithLevel(logger.ErrorLevel)); err != nil {

View File

@ -19,8 +19,7 @@ import (
cw "go.unistack.org/micro/v3/util/client" cw "go.unistack.org/micro/v3/util/client"
) )
type TestFoo struct { type TestFoo struct{}
}
type TestReq struct{} type TestReq struct{}

View File

@ -1,8 +1,8 @@
// +build ignore // +build ignore
/*
package drpc package drpc
/*
import ( import (
"context" "context"
"net" "net"

View File

@ -7,10 +7,11 @@
package pb package pb
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
) )
const ( const (
@ -146,11 +147,14 @@ func file_test_proto_rawDescGZIP() []byte {
return file_test_proto_rawDescData return file_test_proto_rawDescData
} }
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var (
var file_test_proto_goTypes = []interface{}{ file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
file_test_proto_goTypes = []interface{}{
(*CallReq)(nil), // 0: Test.CallReq (*CallReq)(nil), // 0: Test.CallReq
(*CallRsp)(nil), // 1: Test.CallRsp (*CallRsp)(nil), // 1: Test.CallRsp
} }
)
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
0, // 0: Test.TestService.Call:input_type -> Test.CallReq 0, // 0: Test.TestService.Call:input_type -> Test.CallReq
0, // 1: Test.TestService.Hello:input_type -> Test.CallReq 0, // 1: Test.TestService.Hello:input_type -> Test.CallReq

View File

@ -7,6 +7,7 @@ package pb
import ( import (
context "context" context "context"
errors "errors" errors "errors"
proto "google.golang.org/protobuf/proto" proto "google.golang.org/protobuf/proto"
drpc "storj.io/drpc" drpc "storj.io/drpc"
drpcerr "storj.io/drpc/drpcerr" drpcerr "storj.io/drpc/drpcerr"

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
) )

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server" server "go.unistack.org/micro/v3/server"

View File

@ -6,6 +6,7 @@ package helloworld
import ( import (
context "context" context "context"
proto "go.unistack.org/micro-tests/client/grpc/proto" proto "go.unistack.org/micro-tests/client/grpc/proto"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"

View File

@ -6,6 +6,7 @@ package helloworld
import ( import (
context "context" context "context"
proto "go.unistack.org/micro-tests/client/grpc/proto" proto "go.unistack.org/micro-tests/client/grpc/proto"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"

View File

@ -7,10 +7,11 @@
package helloworld package helloworld
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
) )
const ( const (
@ -158,11 +159,14 @@ func file_test_proto_rawDescGZIP() []byte {
return file_test_proto_rawDescData return file_test_proto_rawDescData
} }
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var (
var file_test_proto_goTypes = []interface{}{ file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
file_test_proto_goTypes = []interface{}{
(*Request)(nil), // 0: helloworld.Request (*Request)(nil), // 0: helloworld.Request
(*Response)(nil), // 1: helloworld.Response (*Response)(nil), // 1: helloworld.Response
} }
)
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
0, // 0: helloworld.Test.Call:input_type -> helloworld.Request 0, // 0: helloworld.Test.Call:input_type -> helloworld.Request
0, // 1: helloworld.Test.Stream:input_type -> helloworld.Request 0, // 1: helloworld.Test.Stream:input_type -> helloworld.Request

View File

@ -8,6 +8,7 @@ package helloworld
import ( import (
context "context" context "context"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
@ -84,12 +85,12 @@ type TestServer interface {
} }
// UnimplementedTestServer must be embedded to have forward compatible implementations. // UnimplementedTestServer must be embedded to have forward compatible implementations.
type UnimplementedTestServer struct { type UnimplementedTestServer struct{}
}
func (UnimplementedTestServer) Call(context.Context, *Request) (*Response, error) { func (UnimplementedTestServer) Call(context.Context, *Request) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") return nil, status.Errorf(codes.Unimplemented, "method Call not implemented")
} }
func (UnimplementedTestServer) Stream(Test_StreamServer) error { func (UnimplementedTestServer) Stream(Test_StreamServer) error {
return status.Errorf(codes.Unimplemented, "method Stream not implemented") return status.Errorf(codes.Unimplemented, "method Stream not implemented")
} }

View File

@ -244,7 +244,7 @@ func TestHTTPClientStream(t *testing.T) {
// write response // write response
rsp := &http.Response{ rsp := &http.Response{
Header: r.Header, // Header: r.Header,
Body: ioutil.NopCloser(bytes.NewBuffer(b)), Body: ioutil.NopCloser(bytes.NewBuffer(b)),
Status: "200 OK", Status: "200 OK",
StatusCode: 200, StatusCode: 200,

View File

@ -7,12 +7,13 @@
package pb package pb
import ( import (
reflect "reflect"
sync "sync"
_ "go.unistack.org/micro-proto/v3/api" _ "go.unistack.org/micro-proto/v3/api"
_ "go.unistack.org/micro-proto/v3/openapiv3" _ "go.unistack.org/micro-proto/v3/openapiv3"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
) )
const ( const (
@ -225,12 +226,15 @@ func file_github_proto_rawDescGZIP() []byte {
return file_github_proto_rawDescData return file_github_proto_rawDescData
} }
var file_github_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var (
var file_github_proto_goTypes = []interface{}{ file_github_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
file_github_proto_goTypes = []interface{}{
(*LookupUserReq)(nil), // 0: github.LookupUserReq (*LookupUserReq)(nil), // 0: github.LookupUserReq
(*LookupUserRsp)(nil), // 1: github.LookupUserRsp (*LookupUserRsp)(nil), // 1: github.LookupUserRsp
(*Error)(nil), // 2: github.Error (*Error)(nil), // 2: github.Error
} }
)
var file_github_proto_depIdxs = []int32{ var file_github_proto_depIdxs = []int32{
0, // 0: github.Github.LookupUser:input_type -> github.LookupUserReq 0, // 0: github.Github.LookupUser:input_type -> github.LookupUserReq
0, // 1: github.Github.LookupUserWithoutPath:input_type -> github.LookupUserReq 0, // 1: github.Github.LookupUserWithoutPath:input_type -> github.LookupUserReq

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
) )

View File

@ -6,11 +6,12 @@ package pb
import ( import (
context "context" context "context"
http "net/http"
v3 "go.unistack.org/micro-client-http/v3" v3 "go.unistack.org/micro-client-http/v3"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server" server "go.unistack.org/micro/v3/server"
http "net/http"
) )
type githubClient struct { type githubClient struct {

24
codec/frame_test.go Normal file
View File

@ -0,0 +1,24 @@
package codec
import (
"fmt"
"testing"
jsoncodec "go.unistack.org/micro-codec-json/v3"
"go.unistack.org/micro/v3/codec"
)
func TestFrame(t *testing.T) {
type FrameStruct struct {
Frame *codec.Frame `json:"frame"`
Name string `json:"name"`
}
dst := &FrameStruct{}
data := []byte(`{"name":"test","frame": {"first":"second"}}`)
c := jsoncodec.NewCodec()
if err := c.Unmarshal(data, dst); err != nil {
t.Fatal(err)
}
fmt.Printf("xxx %s\n", dst.Frame)
}

View File

@ -7,10 +7,11 @@
package pb package pb
import ( import (
reflect "reflect"
codec "go.unistack.org/micro/v3/codec" codec "go.unistack.org/micro/v3/codec"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
) )
const ( const (
@ -38,6 +39,7 @@ var file_test_proto_rawDesc = []byte{
var file_test_proto_goTypes = []interface{}{ var file_test_proto_goTypes = []interface{}{
(*codec.Frame)(nil), // 0: micro.codec.Frame (*codec.Frame)(nil), // 0: micro.codec.Frame
} }
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
0, // 0: helloworld.Test.Call:input_type -> micro.codec.Frame 0, // 0: helloworld.Test.Call:input_type -> micro.codec.Frame
0, // 1: helloworld.Test.Call:output_type -> micro.codec.Frame 0, // 1: helloworld.Test.Call:output_type -> micro.codec.Frame

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
codec "go.unistack.org/micro/v3/codec" codec "go.unistack.org/micro/v3/codec"

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
_ "go.unistack.org/micro-client-http/v3" _ "go.unistack.org/micro-client-http/v3"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"

View File

@ -1,4 +1,3 @@
package grpc package grpc
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go_out=paths=source_relative:./proto --go-micro_out=components='micro|http',debug=true,paths=source_relative:./proto proto/test.proto" //go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go_out=paths=source_relative:./proto --go-micro_out=components='micro|http',debug=true,paths=source_relative:./proto proto/test.proto"

View File

@ -7,10 +7,11 @@
package pb package pb
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
) )
const ( const (
@ -154,11 +155,14 @@ func file_test_proto_rawDescGZIP() []byte {
return file_test_proto_rawDescData return file_test_proto_rawDescData
} }
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var (
var file_test_proto_goTypes = []interface{}{ file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
file_test_proto_goTypes = []interface{}{
(*Request)(nil), // 0: helloworld.Request (*Request)(nil), // 0: helloworld.Request
(*Response)(nil), // 1: helloworld.Response (*Response)(nil), // 1: helloworld.Response
} }
)
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
0, // 0: helloworld.Test.Call:input_type -> helloworld.Request 0, // 0: helloworld.Test.Call:input_type -> helloworld.Request
1, // 1: helloworld.Test.Call:output_type -> helloworld.Response 1, // 1: helloworld.Test.Call:output_type -> helloworld.Response

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
) )

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
_ "go.unistack.org/micro-client-http/v3" _ "go.unistack.org/micro-client-http/v3"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"

View File

@ -138,5 +138,6 @@ func TestFlow(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
_ = keys _ = keys
t.Logf("execution id: %s, result: %v", id, err) _ = id
// t.Logf("execution id: %s, result: %v", id, err)
} }

View File

@ -7,12 +7,13 @@
package pb package pb
import ( import (
reflect "reflect"
sync "sync"
_ "go.unistack.org/micro-proto/v3/api" _ "go.unistack.org/micro-proto/v3/api"
_ "go.unistack.org/micro-proto/v3/openapiv3" _ "go.unistack.org/micro-proto/v3/openapiv3"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
) )
const ( const (
@ -503,8 +504,9 @@ func file_test_proto_rawDescGZIP() []byte {
return file_test_proto_rawDescData return file_test_proto_rawDescData
} }
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var (
var file_test_proto_goTypes = []interface{}{ file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
file_test_proto_goTypes = []interface{}{
(*MailUserReq)(nil), // 0: test.MailUserReq (*MailUserReq)(nil), // 0: test.MailUserReq
(*MailUserRsp)(nil), // 1: test.MailUserRsp (*MailUserRsp)(nil), // 1: test.MailUserRsp
(*UpdateUserReq)(nil), // 2: test.UpdateUserReq (*UpdateUserReq)(nil), // 2: test.UpdateUserReq
@ -514,7 +516,9 @@ var file_test_proto_goTypes = []interface{}{
(*LookupUserReq)(nil), // 6: test.LookupUserReq (*LookupUserReq)(nil), // 6: test.LookupUserReq
(*LookupUserRsp)(nil), // 7: test.LookupUserRsp (*LookupUserRsp)(nil), // 7: test.LookupUserRsp
(*Error)(nil), // 8: test.Error (*Error)(nil), // 8: test.Error
} }
)
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
6, // 0: test.TestService.LookupUser:input_type -> test.LookupUserReq 6, // 0: test.TestService.LookupUser:input_type -> test.LookupUserReq
2, // 1: test.TestService.UpdateUser:input_type -> test.UpdateUserReq 2, // 1: test.TestService.UpdateUser:input_type -> test.UpdateUserReq

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
) )

View File

@ -6,12 +6,13 @@ package pb
import ( import (
context "context" context "context"
http "net/http"
time "time"
v3 "go.unistack.org/micro-client-http/v3" v3 "go.unistack.org/micro-client-http/v3"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server" server "go.unistack.org/micro/v3/server"
http "net/http"
time "time"
) )
type testServiceClient struct { type testServiceClient struct {

8
go.mod
View File

@ -2,10 +2,6 @@ module go.unistack.org/micro-tests
go 1.16 go 1.16
//replace go.unistack.org/micro/v3 => ../micro
//replace go.unistack.org/micro-wrapper-sql/v3 => ../micro-wrapper-sql
require ( require (
github.com/jmoiron/sqlx v1.3.4 github.com/jmoiron/sqlx v1.3.4
github.com/opentracing/opentracing-go v1.2.0 github.com/opentracing/opentracing-go v1.2.0
@ -31,7 +27,7 @@ require (
go.unistack.org/micro-proto/v3 v3.2.0 go.unistack.org/micro-proto/v3 v3.2.0
go.unistack.org/micro-router-register/v3 v3.8.1 go.unistack.org/micro-router-register/v3 v3.8.1
go.unistack.org/micro-server-grpc/v3 v3.8.0 go.unistack.org/micro-server-grpc/v3 v3.8.0
go.unistack.org/micro-server-http/v3 v3.9.2 go.unistack.org/micro-server-http/v3 v3.9.3
go.unistack.org/micro-server-tcp/v3 v3.8.0 go.unistack.org/micro-server-tcp/v3 v3.8.0
go.unistack.org/micro-wrapper-recovery/v3 v3.8.0 go.unistack.org/micro-wrapper-recovery/v3 v3.8.0
go.unistack.org/micro-wrapper-sql/v3 v3.0.1 go.unistack.org/micro-wrapper-sql/v3 v3.0.1
@ -43,5 +39,5 @@ require (
google.golang.org/grpc v1.43.0 google.golang.org/grpc v1.43.0
google.golang.org/protobuf v1.27.1 google.golang.org/protobuf v1.27.1
modernc.org/sqlite v1.14.5 modernc.org/sqlite v1.14.5
storj.io/drpc v0.0.26 storj.io/drpc v0.0.27
) )

8
go.sum
View File

@ -433,8 +433,8 @@ go.unistack.org/micro-router-register/v3 v3.8.1 h1:7pxbBxT4gk9XfigpHYWHFEljWpwVX
go.unistack.org/micro-router-register/v3 v3.8.1/go.mod h1:JKRDKYMl6A/ZqIux2D4txgerRfT+HJdPbo0Ik6nKo98= go.unistack.org/micro-router-register/v3 v3.8.1/go.mod h1:JKRDKYMl6A/ZqIux2D4txgerRfT+HJdPbo0Ik6nKo98=
go.unistack.org/micro-server-grpc/v3 v3.8.0 h1:/cP4WBftiO7Vlj9D5YUShqmnw7CxyobXZCVshs5YfY8= go.unistack.org/micro-server-grpc/v3 v3.8.0 h1:/cP4WBftiO7Vlj9D5YUShqmnw7CxyobXZCVshs5YfY8=
go.unistack.org/micro-server-grpc/v3 v3.8.0/go.mod h1:UcevUkT7vZwDVxWWHWg+GtSDG6ro5doNxihNKdDCr1o= go.unistack.org/micro-server-grpc/v3 v3.8.0/go.mod h1:UcevUkT7vZwDVxWWHWg+GtSDG6ro5doNxihNKdDCr1o=
go.unistack.org/micro-server-http/v3 v3.9.2 h1:i7gzWomYF+on5EcqTVwiTrhBH0zccI8LeHFku0BZrEc= go.unistack.org/micro-server-http/v3 v3.9.3 h1:oc+ZUzoF7gZ4CZ1v4RIr0cjdHWOLaKC0f/bJ/BYphWQ=
go.unistack.org/micro-server-http/v3 v3.9.2/go.mod h1:yLssWbsrlN9/uGkHvwuzhW5hTdjcDOlyBiOcMMKf67k= go.unistack.org/micro-server-http/v3 v3.9.3/go.mod h1:yLssWbsrlN9/uGkHvwuzhW5hTdjcDOlyBiOcMMKf67k=
go.unistack.org/micro-server-tcp/v3 v3.8.0 h1:J6vuctWx/A4FRrY4FuS5KUGPopLEpB8/2c8ntWQfWXk= go.unistack.org/micro-server-tcp/v3 v3.8.0 h1:J6vuctWx/A4FRrY4FuS5KUGPopLEpB8/2c8ntWQfWXk=
go.unistack.org/micro-server-tcp/v3 v3.8.0/go.mod h1:U2LjBk52yxq6QyOmZomS2FJTqca6E0q71UJrW4QgoNk= go.unistack.org/micro-server-tcp/v3 v3.8.0/go.mod h1:U2LjBk52yxq6QyOmZomS2FJTqca6E0q71UJrW4QgoNk=
go.unistack.org/micro-wrapper-recovery/v3 v3.8.0 h1:ivobT81NUA/74hshbbXM7iOcgODYDHvD2JOHVas6qxU= go.unistack.org/micro-wrapper-recovery/v3 v3.8.0 h1:ivobT81NUA/74hshbbXM7iOcgODYDHvD2JOHVas6qxU=
@ -758,5 +758,5 @@ modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.2.21/go.mod h1:uXrObx4pGqXWIMliC5MiKuwAyMrltzwpteOFUP1PWCc= modernc.org/z v1.2.21/go.mod h1:uXrObx4pGqXWIMliC5MiKuwAyMrltzwpteOFUP1PWCc=
modernc.org/z v1.3.0 h1:4RWULo1Nvaq5ZBhbLe74u8p6tV4Mmm0ZrPBXYPm/xjM= modernc.org/z v1.3.0 h1:4RWULo1Nvaq5ZBhbLe74u8p6tV4Mmm0ZrPBXYPm/xjM=
modernc.org/z v1.3.0/go.mod h1:+mvgLH814oDjtATDdT3rs84JnUIpkvAF5B8AVkNlE2g= modernc.org/z v1.3.0/go.mod h1:+mvgLH814oDjtATDdT3rs84JnUIpkvAF5B8AVkNlE2g=
storj.io/drpc v0.0.26 h1:T6jJzjby7QUa/2XHR1qMxTCENpDHEw4/o+kfDfZQqQI= storj.io/drpc v0.0.27 h1:5XDCuciLfSUAizxWW9d29MQKuwBTX1G6+kp60LgzHWA=
storj.io/drpc v0.0.26/go.mod h1:ofQUDPQbbIymRDKE0tms48k8bLP5Y+dsI9CbXGv3gko= storj.io/drpc v0.0.27/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=

View File

@ -5,11 +5,11 @@ import (
"context" "context"
"testing" "testing"
prometheus "go.unistack.org/micro-meter-prometheus/v3"
"go.unistack.org/micro/v3/client" "go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/codec" "go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/meter" "go.unistack.org/micro/v3/meter"
"go.unistack.org/micro/v3/meter/wrapper" "go.unistack.org/micro/v3/meter/wrapper"
prometheus "go.unistack.org/micro-meter-prometheus/v3"
) )
func TestWrapper(t *testing.T) { func TestWrapper(t *testing.T) {

View File

@ -5,11 +5,11 @@ import (
"context" "context"
"testing" "testing"
victoriametrics "go.unistack.org/micro-meter-victoriametrics/v3"
"go.unistack.org/micro/v3/client" "go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/codec" "go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/meter" "go.unistack.org/micro/v3/meter"
"go.unistack.org/micro/v3/meter/wrapper" "go.unistack.org/micro/v3/meter/wrapper"
victoriametrics "go.unistack.org/micro-meter-victoriametrics/v3"
) )
func TestWrapper(t *testing.T) { func TestWrapper(t *testing.T) {

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
codec "go.unistack.org/micro/v3/codec" codec "go.unistack.org/micro/v3/codec"

View File

@ -6,13 +6,14 @@ package pb
import ( import (
context "context" context "context"
http "net/http"
v3 "go.unistack.org/micro-client-http/v3" v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3" v31 "go.unistack.org/micro-server-http/v3"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
codec "go.unistack.org/micro/v3/codec" codec "go.unistack.org/micro/v3/codec"
server "go.unistack.org/micro/v3/server" server "go.unistack.org/micro/v3/server"
http "net/http"
) )
type testServiceClient struct { type testServiceClient struct {

View File

@ -6,6 +6,7 @@ package helloworld
import ( import (
context "context" context "context"
proto "go.unistack.org/micro-tests/server/grpc/proto" proto "go.unistack.org/micro-tests/server/grpc/proto"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"

View File

@ -6,6 +6,7 @@ package helloworld
import ( import (
context "context" context "context"
proto "go.unistack.org/micro-tests/server/grpc/proto" proto "go.unistack.org/micro-tests/server/grpc/proto"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"

View File

@ -7,11 +7,12 @@
package helloworld package helloworld
import ( import (
reflect "reflect"
sync "sync"
_ "go.unistack.org/micro-proto/v3/api" _ "go.unistack.org/micro-proto/v3/api"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
) )
const ( const (
@ -229,12 +230,15 @@ func file_test_proto_rawDescGZIP() []byte {
return file_test_proto_rawDescData return file_test_proto_rawDescData
} }
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var (
var file_test_proto_goTypes = []interface{}{ file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
file_test_proto_goTypes = []interface{}{
(*Request)(nil), // 0: helloworld.Request (*Request)(nil), // 0: helloworld.Request
(*Broken)(nil), // 1: helloworld.Broken (*Broken)(nil), // 1: helloworld.Broken
(*Response)(nil), // 2: helloworld.Response (*Response)(nil), // 2: helloworld.Response
} }
)
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
1, // 0: helloworld.Request.broken:type_name -> helloworld.Broken 1, // 0: helloworld.Request.broken:type_name -> helloworld.Broken
1, // 1: helloworld.Response.broken:type_name -> helloworld.Broken 1, // 1: helloworld.Response.broken:type_name -> helloworld.Broken

View File

@ -8,6 +8,7 @@ package helloworld
import ( import (
context "context" context "context"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes" codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status" status "google.golang.org/grpc/status"
@ -51,8 +52,7 @@ type TestServer interface {
} }
// UnimplementedTestServer must be embedded to have forward compatible implementations. // UnimplementedTestServer must be embedded to have forward compatible implementations.
type UnimplementedTestServer struct { type UnimplementedTestServer struct{}
}
func (UnimplementedTestServer) Call(context.Context, *Request) (*Response, error) { func (UnimplementedTestServer) Call(context.Context, *Request) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") return nil, status.Errorf(codes.Unimplemented, "method Call not implemented")

View File

@ -94,7 +94,7 @@ func TestMultipart(t *testing.T) {
server.Register(reg), server.Register(reg),
server.Codec("application/json", jsoncodec.NewCodec()), server.Codec("application/json", jsoncodec.NewCodec()),
server.Codec("application/x-www-form-urlencoded", urlencodecodec.NewCodec()), server.Codec("application/x-www-form-urlencoded", urlencodecodec.NewCodec()),
httpsrv.PathHandler("/upload", multipartHandler), httpsrv.PathHandler(http.MethodPost, "/upload", multipartHandler),
) )
if err := srv.Init(); err != nil { if err := srv.Init(); err != nil {
@ -125,7 +125,7 @@ func TestMultipart(t *testing.T) {
t.Fatalf("Expected 1 node got %d: %+v", len(service[0].Nodes), service[0].Nodes) t.Fatalf("Expected 1 node got %d: %+v", len(service[0].Nodes), service[0].Nodes)
} }
t.Logf("test multipart upload") // t.Logf("test multipart upload")
values := make(map[string]io.Reader, 2) values := make(map[string]io.Reader, 2)
values["first.txt"] = bytes.NewReader([]byte("first content")) values["first.txt"] = bytes.NewReader([]byte("first content"))
values["second.txt"] = bytes.NewReader([]byte("second content")) values["second.txt"] = bytes.NewReader([]byte("second content"))
@ -261,7 +261,6 @@ func TestNativeFormUrlencoded(t *testing.T) {
t.Fatalf("Expected 1 node got %d: %+v", len(service[0].Nodes), service[0].Nodes) t.Fatalf("Expected 1 node got %d: %+v", len(service[0].Nodes), service[0].Nodes)
} }
t.Logf("test net/http client with application/x-www-form-urlencoded")
data := url.Values{} data := url.Values{}
data.Set("req", "fookey") data.Set("req", "fookey")
data.Set("arg1", "arg1val") data.Set("arg1", "arg1val")
@ -275,12 +274,12 @@ func TestNativeFormUrlencoded(t *testing.T) {
req.AddCookie(&http.Cookie{Name: "Csrftoken", Value: "csrftoken"}) req.AddCookie(&http.Cookie{Name: "Csrftoken", Value: "csrftoken"})
// req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode()))) // req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode())))
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test net/http client with application/x-www-form-urlencoded err: %v", err)
} }
rsp, err := http.DefaultClient.Do(req) rsp, err := http.DefaultClient.Do(req)
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test net/http client with application/x-www-form-urlencoded err: %v", err)
} }
b, err := ioutil.ReadAll(rsp.Body) b, err := ioutil.ReadAll(rsp.Body)
@ -302,7 +301,6 @@ func TestNativeFormUrlencoded(t *testing.T) {
t.Fatalf("empty response header: %#+v", rsp.Header) t.Fatalf("empty response header: %#+v", rsp.Header)
} }
t.Logf("test native client with application/x-www-form-urlencoded")
cli := client.NewClientCallOptions( cli := client.NewClientCallOptions(
httpcli.NewClient( httpcli.NewClient(
client.ContentType("application/x-www-form-urlencoded"), client.ContentType("application/x-www-form-urlencoded"),
@ -324,7 +322,7 @@ func TestNativeFormUrlencoded(t *testing.T) {
}}, }},
}) })
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test native client with application/x-www-form-urlencoded err: %v", err)
} }
if nrsp.Rsp != "name_my_name" { if nrsp.Rsp != "name_my_name" {
@ -438,16 +436,15 @@ func TestNativeClientServer(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
t.Logf("test rsp code from net/http client to native micro http server")
hr, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("http://%s/v1/test/call/my_name", service[0].Nodes[0].Address), bytes.NewReader(hb)) hr, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("http://%s/v1/test/call/my_name", service[0].Nodes[0].Address), bytes.NewReader(hb))
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test rsp code from net/http client to native micro http server err: %v", err)
} }
hr.Header.Set("Content-Type", "application/json") hr.Header.Set("Content-Type", "application/json")
hrsp, err := http.DefaultClient.Do(hr) hrsp, err := http.DefaultClient.Do(hr)
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test rsp code from net/http client to native micro http server err: %v", err)
} }
defer func() { defer func() {
_ = hrsp.Body.Close() _ = hrsp.Body.Close()
@ -462,17 +459,16 @@ func TestNativeClientServer(t *testing.T) {
t.Fatalf("invalid rsp code %#+v", hrsp) t.Fatalf("invalid rsp code %#+v", hrsp)
} }
t.Logf("test second server")
svc2 := pb.NewTestDoubleClient("helloworld", cli) svc2 := pb.NewTestDoubleClient("helloworld", cli)
rsp, err = svc2.CallDouble(ctx, &pb.CallReq{ rsp, err = svc2.CallDouble(ctx, &pb.CallReq{
Name: "my_name", Name: "my_name",
}) })
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test second server err: %v", err)
} }
if rsp.Rsp != "name_double" { if rsp.Rsp != "name_double" {
t.Fatalf("invalid response: %#+v\n", rsp) t.Fatalf("test second server invalid response: %#+v\n", rsp)
} }
hrsp, err = http.Get(fmt.Sprintf("http://%s/metrics", service[0].Nodes[0].Address)) hrsp, err = http.Get(fmt.Sprintf("http://%s/metrics", service[0].Nodes[0].Address))
@ -610,20 +606,18 @@ func TestNativeServer(t *testing.T) {
c := client.NewClientCallOptions(httpcli.NewClient(client.ContentType("application/json"), client.Codec("application/json", jsoncodec.NewCodec())), client.WithAddress("http://"+service[0].Nodes[0].Address)) c := client.NewClientCallOptions(httpcli.NewClient(client.ContentType("application/json"), client.Codec("application/json", jsoncodec.NewCodec())), client.WithAddress("http://"+service[0].Nodes[0].Address))
pbc := pb.NewTestClient("test", c) pbc := pb.NewTestClient("test", c)
t.Logf("test with string_ids")
prsp, err := pbc.CallRepeatedString(context.TODO(), &pb.CallReq{StringIds: []string{"123", "321"}}) prsp, err := pbc.CallRepeatedString(context.TODO(), &pb.CallReq{StringIds: []string{"123", "321"}})
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test with string_ids err: %v", err)
} }
if prsp.Rsp != "name_my_name" { if prsp.Rsp != "name_my_name" {
t.Fatalf("invalid rsp received: %#+v\n", rsp) t.Fatalf("invalid rsp received: %#+v\n", rsp)
} }
t.Logf("test with int64_ids")
prsp, err = pbc.CallRepeatedInt64(context.TODO(), &pb.CallReq{Int64Ids: []int64{123, 321}}) prsp, err = pbc.CallRepeatedInt64(context.TODO(), &pb.CallReq{Int64Ids: []int64{123, 321}})
if err != nil { if err != nil {
t.Fatal(err) t.Fatalf("test with int64_ids err: %v", err)
} }
if prsp.Rsp != "name_my_name" { if prsp.Rsp != "name_my_name" {

View File

@ -7,14 +7,15 @@
package pb package pb
import ( import (
reflect "reflect"
sync "sync"
_ "go.unistack.org/micro-proto/v3/api" _ "go.unistack.org/micro-proto/v3/api"
_ "go.unistack.org/micro-proto/v3/openapiv3" _ "go.unistack.org/micro-proto/v3/openapiv3"
_ "go.unistack.org/micro-proto/v3/tag" _ "go.unistack.org/micro-proto/v3/tag"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
reflect "reflect"
sync "sync"
) )
const ( const (
@ -493,8 +494,9 @@ func file_test_proto_rawDescGZIP() []byte {
return file_test_proto_rawDescData return file_test_proto_rawDescData
} }
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var (
var file_test_proto_goTypes = []interface{}{ file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
file_test_proto_goTypes = []interface{}{
(*CallReq)(nil), // 0: test.CallReq (*CallReq)(nil), // 0: test.CallReq
(*Nested)(nil), // 1: test.Nested (*Nested)(nil), // 1: test.Nested
(*CallRsp)(nil), // 2: test.CallRsp (*CallRsp)(nil), // 2: test.CallRsp
@ -502,7 +504,9 @@ var file_test_proto_goTypes = []interface{}{
(*CallRsp1)(nil), // 4: test.CallRsp1 (*CallRsp1)(nil), // 4: test.CallRsp1
(*Error)(nil), // 5: test.Error (*Error)(nil), // 5: test.Error
(*wrapperspb.UInt64Value)(nil), // 6: google.protobuf.UInt64Value (*wrapperspb.UInt64Value)(nil), // 6: google.protobuf.UInt64Value
} }
)
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
1, // 0: test.CallReq.nested:type_name -> test.Nested 1, // 0: test.CallReq.nested:type_name -> test.Nested
6, // 1: test.Nested.uint64_args:type_name -> google.protobuf.UInt64Value 6, // 1: test.Nested.uint64_args:type_name -> google.protobuf.UInt64Value

View File

@ -6,6 +6,7 @@ package pb
import ( import (
context "context" context "context"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
) )

View File

@ -6,13 +6,14 @@ package pb
import ( import (
context "context" context "context"
http "net/http"
time "time"
v3 "go.unistack.org/micro-client-http/v3" v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3" v31 "go.unistack.org/micro-server-http/v3"
api "go.unistack.org/micro/v3/api" api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client" client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server" server "go.unistack.org/micro/v3/server"
http "net/http"
time "time"
) )
type testDoubleClient struct { type testDoubleClient struct {

View File

@ -95,7 +95,6 @@ func TestStoreBasic(t *testing.T) {
runStoreTest(tc.s, t) runStoreTest(tc.s, t)
}) })
} }
} }
func TestStoreTable(t *testing.T) { func TestStoreTable(t *testing.T) {
@ -176,7 +175,6 @@ func runStoreTest(s store.Store, t *testing.T) {
suffixPrefixExpiryTests(s, t) suffixPrefixExpiryTests(s, t)
readTests(s, t) readTests(s, t)
listTests(s, t) listTests(s, t)
} }
func readTests(s store.Store, t *testing.T) { func readTests(s store.Store, t *testing.T) {
@ -285,7 +283,6 @@ func listTests(s store.Store, t *testing.T) {
if len(recs) != 2 { if len(recs) != 2 {
t.Fatalf("Expected 2 records, received %d %+v", len(recs), recs) t.Fatalf("Expected 2 records, received %d %+v", len(recs), recs)
} }
} }
func expiryTests(s store.Store, t *testing.T) { func expiryTests(s store.Store, t *testing.T) {
@ -457,9 +454,8 @@ func suffixPrefixExpiryTests(s store.Store, t *testing.T) {
} else { } else {
if len(results) != 3 { if len(results) != 3 {
t.Errorf("Expected 3 items, got %d", len(results)) t.Errorf("Expected 3 items, got %d", len(results))
//t.Logf("Table test: %v\n", spew.Sdump(results)) // t.Logf("Table test: %v\n", spew.Sdump(results))
} }
} }
time.Sleep(time.Millisecond * 100) time.Sleep(time.Millisecond * 100)
if results, err := s.Read("foo", store.ReadSuffix()); err != nil { if results, err := s.Read("foo", store.ReadSuffix()); err != nil {
@ -467,9 +463,8 @@ func suffixPrefixExpiryTests(s store.Store, t *testing.T) {
} else { } else {
if len(results) != 2 { if len(results) != 2 {
t.Errorf("Expected 2 items, got %d", len(results)) t.Errorf("Expected 2 items, got %d", len(results))
//t.Logf("Table test: %v\n", spew.Sdump(results)) // t.Logf("Table test: %v\n", spew.Sdump(results))
} }
} }
time.Sleep(time.Millisecond * 100) time.Sleep(time.Millisecond * 100)
if results, err := s.Read("foo", store.ReadSuffix()); err != nil { if results, err := s.Read("foo", store.ReadSuffix()); err != nil {

View File

@ -1,9 +1,10 @@
//go:build tools
// +build tools // +build tools
package micro-tests package micro_tests
import ( import (
_ "go.unistack.org/micro-proto/v3/openapiv3"
_ "go.unistack.org/micro-proto/v3/api" _ "go.unistack.org/micro-proto/v3/api"
_ "go.unistack.org/micro-proto/v3/openapiv3"
_ "go.unistack.org/micro-proto/v3/tag" _ "go.unistack.org/micro-proto/v3/tag"
) )

View File

@ -7,11 +7,12 @@
package pb package pb
import ( import (
reflect "reflect"
sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
reflect "reflect"
sync "sync"
) )
const ( const (
@ -194,12 +195,15 @@ func file_test_proto_rawDescGZIP() []byte {
return file_test_proto_rawDescData return file_test_proto_rawDescData
} }
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var (
var file_test_proto_goTypes = []interface{}{ file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
file_test_proto_goTypes = []interface{}{
(*CallReq)(nil), // 0: reflect.CallReq (*CallReq)(nil), // 0: reflect.CallReq
(*Nested)(nil), // 1: reflect.Nested (*Nested)(nil), // 1: reflect.Nested
(*wrapperspb.UInt64Value)(nil), // 2: google.protobuf.UInt64Value (*wrapperspb.UInt64Value)(nil), // 2: google.protobuf.UInt64Value
} }
)
var file_test_proto_depIdxs = []int32{ var file_test_proto_depIdxs = []int32{
1, // 0: reflect.CallReq.nested:type_name -> reflect.Nested 1, // 0: reflect.CallReq.nested:type_name -> reflect.Nested
2, // 1: reflect.Nested.uint64_args:type_name -> google.protobuf.UInt64Value 2, // 1: reflect.Nested.uint64_args:type_name -> google.protobuf.UInt64Value

View File

@ -61,9 +61,8 @@ func TestMergeString(t *testing.T) {
mp["bool"] = true mp["bool"] = true
s := &str{} s := &str{}
t.Logf("merge with true")
if err := rutil.Merge(s, mp, rutil.Tags([]string{"json"})); err != nil { if err := rutil.Merge(s, mp, rutil.Tags([]string{"json"})); err != nil {
t.Fatal(err) t.Fatalf("merge with true err: %v", err)
} }
if s.Bool != "true" { if s.Bool != "true" {
@ -71,9 +70,8 @@ func TestMergeString(t *testing.T) {
} }
mp["bool"] = false mp["bool"] = false
t.Logf("merge with false")
if err := rutil.Merge(s, mp, rutil.Tags([]string{"json"})); err != nil { if err := rutil.Merge(s, mp, rutil.Tags([]string{"json"})); err != nil {
t.Fatal(err) t.Fatalf("merge with falst err: %v", err)
} }
if s.Bool != "false" { if s.Bool != "false" {

View File

@ -15,6 +15,7 @@ import (
"go.unistack.org/micro/v3/client" "go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/errors" "go.unistack.org/micro/v3/errors"
"go.unistack.org/micro/v3/network/transport" "go.unistack.org/micro/v3/network/transport"
"go.unistack.org/micro/v3/register"
"go.unistack.org/micro/v3/router" "go.unistack.org/micro/v3/router"
"go.unistack.org/micro/v3/server" "go.unistack.org/micro/v3/server"
) )