reformat
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
8a71466ba4
commit
88a4c1641d
@ -9,7 +9,6 @@ import (
|
||||
)
|
||||
|
||||
func TestRequestPayloadFromRequest(t *testing.T) {
|
||||
|
||||
jsonUrlBytes := []byte(`{"key1":"val1","key2":"val2","name":"Test"}`)
|
||||
|
||||
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) {
|
||||
|
||||
r, err := http.NewRequest("GET", "http://localhost/my/path", nil)
|
||||
if err != nil {
|
||||
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) {
|
||||
|
||||
r, err := http.NewRequest("GET", "http://localhost/my/path", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to created http.Request: %v", err)
|
||||
|
@ -55,7 +55,8 @@ func TestOptionPassing(t *testing.T) {
|
||||
|
||||
func TestKgo(t *testing.T) {
|
||||
if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 {
|
||||
t.Skip()
|
||||
return
|
||||
// t.Skip()
|
||||
}
|
||||
|
||||
_ = logger.DefaultLogger.Init(logger.WithLevel(logger.TraceLevel), logger.WithCallerSkipCount(3))
|
||||
|
@ -38,7 +38,8 @@ var bm = &broker.Message{
|
||||
func TestConsumerGroup(t *testing.T) {
|
||||
topic := "test_topic"
|
||||
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 {
|
||||
@ -197,7 +198,8 @@ func TestConsumerGroup(t *testing.T) {
|
||||
func TestSub(t *testing.T) {
|
||||
topic := "test_topic"
|
||||
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 {
|
||||
@ -508,7 +510,8 @@ func BenchmarkPubSub(b *testing.B) {
|
||||
|
||||
func TestPubSub(t *testing.T) {
|
||||
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 {
|
||||
|
@ -19,8 +19,7 @@ import (
|
||||
cw "go.unistack.org/micro/v3/util/client"
|
||||
)
|
||||
|
||||
type TestFoo struct {
|
||||
}
|
||||
type TestFoo struct{}
|
||||
|
||||
type TestReq struct{}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
package drpc
|
||||
|
||||
/*
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
|
@ -7,10 +7,11 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -146,11 +147,14 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*CallReq)(nil), // 0: Test.CallReq
|
||||
(*CallRsp)(nil), // 1: Test.CallRsp
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
0, // 0: Test.TestService.Call:input_type -> Test.CallReq
|
||||
0, // 1: Test.TestService.Hello:input_type -> Test.CallReq
|
||||
|
@ -7,6 +7,7 @@ package pb
|
||||
import (
|
||||
context "context"
|
||||
errors "errors"
|
||||
|
||||
proto "google.golang.org/protobuf/proto"
|
||||
drpc "storj.io/drpc"
|
||||
drpcerr "storj.io/drpc/drpcerr"
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
)
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
server "go.unistack.org/micro/v3/server"
|
||||
|
@ -6,6 +6,7 @@ package helloworld
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
proto "go.unistack.org/micro-tests/client/grpc/proto"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
@ -6,6 +6,7 @@ package helloworld
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
proto "go.unistack.org/micro-tests/client/grpc/proto"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
@ -7,10 +7,11 @@
|
||||
package helloworld
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -158,11 +159,14 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*Request)(nil), // 0: helloworld.Request
|
||||
(*Response)(nil), // 1: helloworld.Response
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
0, // 0: helloworld.Test.Call:input_type -> helloworld.Request
|
||||
0, // 1: helloworld.Test.Stream:input_type -> helloworld.Request
|
||||
|
@ -8,6 +8,7 @@ package helloworld
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
@ -84,12 +85,12 @@ type TestServer interface {
|
||||
}
|
||||
|
||||
// UnimplementedTestServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedTestServer struct {
|
||||
}
|
||||
type UnimplementedTestServer struct{}
|
||||
|
||||
func (UnimplementedTestServer) Call(context.Context, *Request) (*Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Call not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTestServer) Stream(Test_StreamServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Stream not implemented")
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ func TestHTTPClientStream(t *testing.T) {
|
||||
|
||||
// write response
|
||||
rsp := &http.Response{
|
||||
Header: r.Header,
|
||||
// Header: r.Header,
|
||||
Body: ioutil.NopCloser(bytes.NewBuffer(b)),
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
|
@ -7,12 +7,13 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
_ "go.unistack.org/micro-proto/v3/api"
|
||||
_ "go.unistack.org/micro-proto/v3/openapiv3"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -225,12 +226,15 @@ func file_github_proto_rawDescGZIP() []byte {
|
||||
return file_github_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_github_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_github_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_github_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
file_github_proto_goTypes = []interface{}{
|
||||
(*LookupUserReq)(nil), // 0: github.LookupUserReq
|
||||
(*LookupUserRsp)(nil), // 1: github.LookupUserRsp
|
||||
(*Error)(nil), // 2: github.Error
|
||||
}
|
||||
)
|
||||
|
||||
var file_github_proto_depIdxs = []int32{
|
||||
0, // 0: github.Github.LookupUser:input_type -> github.LookupUserReq
|
||||
0, // 1: github.Github.LookupUserWithoutPath:input_type -> github.LookupUserReq
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
)
|
||||
|
@ -6,11 +6,12 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
http "net/http"
|
||||
|
||||
v3 "go.unistack.org/micro-client-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"
|
||||
)
|
||||
|
||||
type githubClient struct {
|
||||
|
24
codec/frame_test.go
Normal file
24
codec/frame_test.go
Normal 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)
|
||||
}
|
@ -7,10 +7,11 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
codec "go.unistack.org/micro/v3/codec"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -38,6 +39,7 @@ var file_test_proto_rawDesc = []byte{
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
(*codec.Frame)(nil), // 0: micro.codec.Frame
|
||||
}
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
0, // 0: helloworld.Test.Call:input_type -> micro.codec.Frame
|
||||
0, // 1: helloworld.Test.Call:output_type -> micro.codec.Frame
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
codec "go.unistack.org/micro/v3/codec"
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
_ "go.unistack.org/micro-client-http/v3"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
@ -1,4 +1,3 @@
|
||||
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"
|
||||
|
||||
|
@ -7,10 +7,11 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -154,11 +155,14 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*Request)(nil), // 0: helloworld.Request
|
||||
(*Response)(nil), // 1: helloworld.Response
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
0, // 0: helloworld.Test.Call:input_type -> helloworld.Request
|
||||
1, // 1: helloworld.Test.Call:output_type -> helloworld.Response
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
)
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
_ "go.unistack.org/micro-client-http/v3"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
@ -138,5 +138,6 @@ func TestFlow(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_ = keys
|
||||
t.Logf("execution id: %s, result: %v", id, err)
|
||||
_ = id
|
||||
// t.Logf("execution id: %s, result: %v", id, err)
|
||||
}
|
||||
|
@ -7,12 +7,13 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
_ "go.unistack.org/micro-proto/v3/api"
|
||||
_ "go.unistack.org/micro-proto/v3/openapiv3"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -503,8 +504,9 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*MailUserReq)(nil), // 0: test.MailUserReq
|
||||
(*MailUserRsp)(nil), // 1: test.MailUserRsp
|
||||
(*UpdateUserReq)(nil), // 2: test.UpdateUserReq
|
||||
@ -515,6 +517,8 @@ var file_test_proto_goTypes = []interface{}{
|
||||
(*LookupUserRsp)(nil), // 7: test.LookupUserRsp
|
||||
(*Error)(nil), // 8: test.Error
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
6, // 0: test.TestService.LookupUser:input_type -> test.LookupUserReq
|
||||
2, // 1: test.TestService.UpdateUser:input_type -> test.UpdateUserReq
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
)
|
||||
|
@ -6,12 +6,13 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
http "net/http"
|
||||
time "time"
|
||||
|
||||
v3 "go.unistack.org/micro-client-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"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type testServiceClient struct {
|
||||
|
8
go.mod
8
go.mod
@ -2,10 +2,6 @@ module go.unistack.org/micro-tests
|
||||
|
||||
go 1.16
|
||||
|
||||
//replace go.unistack.org/micro/v3 => ../micro
|
||||
|
||||
//replace go.unistack.org/micro-wrapper-sql/v3 => ../micro-wrapper-sql
|
||||
|
||||
require (
|
||||
github.com/jmoiron/sqlx v1.3.4
|
||||
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-router-register/v3 v3.8.1
|
||||
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-wrapper-recovery/v3 v3.8.0
|
||||
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/protobuf v1.27.1
|
||||
modernc.org/sqlite v1.14.5
|
||||
storj.io/drpc v0.0.26
|
||||
storj.io/drpc v0.0.27
|
||||
)
|
||||
|
8
go.sum
8
go.sum
@ -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-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-http/v3 v3.9.2 h1:i7gzWomYF+on5EcqTVwiTrhBH0zccI8LeHFku0BZrEc=
|
||||
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 h1:oc+ZUzoF7gZ4CZ1v4RIr0cjdHWOLaKC0f/bJ/BYphWQ=
|
||||
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/go.mod h1:U2LjBk52yxq6QyOmZomS2FJTqca6E0q71UJrW4QgoNk=
|
||||
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.3.0 h1:4RWULo1Nvaq5ZBhbLe74u8p6tV4Mmm0ZrPBXYPm/xjM=
|
||||
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.26/go.mod h1:ofQUDPQbbIymRDKE0tms48k8bLP5Y+dsI9CbXGv3gko=
|
||||
storj.io/drpc v0.0.27 h1:5XDCuciLfSUAizxWW9d29MQKuwBTX1G6+kp60LgzHWA=
|
||||
storj.io/drpc v0.0.27/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
|
||||
|
@ -5,11 +5,11 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
prometheus "go.unistack.org/micro-meter-prometheus/v3"
|
||||
"go.unistack.org/micro/v3/client"
|
||||
"go.unistack.org/micro/v3/codec"
|
||||
"go.unistack.org/micro/v3/meter"
|
||||
"go.unistack.org/micro/v3/meter/wrapper"
|
||||
prometheus "go.unistack.org/micro-meter-prometheus/v3"
|
||||
)
|
||||
|
||||
func TestWrapper(t *testing.T) {
|
||||
|
@ -5,11 +5,11 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
victoriametrics "go.unistack.org/micro-meter-victoriametrics/v3"
|
||||
"go.unistack.org/micro/v3/client"
|
||||
"go.unistack.org/micro/v3/codec"
|
||||
"go.unistack.org/micro/v3/meter"
|
||||
"go.unistack.org/micro/v3/meter/wrapper"
|
||||
victoriametrics "go.unistack.org/micro-meter-victoriametrics/v3"
|
||||
)
|
||||
|
||||
func TestWrapper(t *testing.T) {
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
codec "go.unistack.org/micro/v3/codec"
|
||||
|
@ -6,13 +6,14 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
http "net/http"
|
||||
|
||||
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"
|
||||
codec "go.unistack.org/micro/v3/codec"
|
||||
server "go.unistack.org/micro/v3/server"
|
||||
http "net/http"
|
||||
)
|
||||
|
||||
type testServiceClient struct {
|
||||
|
@ -6,6 +6,7 @@ package helloworld
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
proto "go.unistack.org/micro-tests/server/grpc/proto"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
@ -6,6 +6,7 @@ package helloworld
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
proto "go.unistack.org/micro-tests/server/grpc/proto"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
@ -7,11 +7,12 @@
|
||||
package helloworld
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
_ "go.unistack.org/micro-proto/v3/api"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -229,12 +230,15 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*Request)(nil), // 0: helloworld.Request
|
||||
(*Broken)(nil), // 1: helloworld.Broken
|
||||
(*Response)(nil), // 2: helloworld.Response
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
1, // 0: helloworld.Request.broken:type_name -> helloworld.Broken
|
||||
1, // 1: helloworld.Response.broken:type_name -> helloworld.Broken
|
||||
|
@ -8,6 +8,7 @@ package helloworld
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
@ -51,8 +52,7 @@ type TestServer interface {
|
||||
}
|
||||
|
||||
// UnimplementedTestServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedTestServer struct {
|
||||
}
|
||||
type UnimplementedTestServer struct{}
|
||||
|
||||
func (UnimplementedTestServer) Call(context.Context, *Request) (*Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Call not implemented")
|
||||
|
@ -94,7 +94,7 @@ func TestMultipart(t *testing.T) {
|
||||
server.Register(reg),
|
||||
server.Codec("application/json", jsoncodec.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 {
|
||||
@ -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.Logf("test multipart upload")
|
||||
// t.Logf("test multipart upload")
|
||||
values := make(map[string]io.Reader, 2)
|
||||
values["first.txt"] = bytes.NewReader([]byte("first 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.Logf("test net/http client with application/x-www-form-urlencoded")
|
||||
data := url.Values{}
|
||||
data.Set("req", "fookey")
|
||||
data.Set("arg1", "arg1val")
|
||||
@ -275,12 +274,12 @@ func TestNativeFormUrlencoded(t *testing.T) {
|
||||
req.AddCookie(&http.Cookie{Name: "Csrftoken", Value: "csrftoken"})
|
||||
// req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode())))
|
||||
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)
|
||||
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)
|
||||
@ -302,7 +301,6 @@ func TestNativeFormUrlencoded(t *testing.T) {
|
||||
t.Fatalf("empty response header: %#+v", rsp.Header)
|
||||
}
|
||||
|
||||
t.Logf("test native client with application/x-www-form-urlencoded")
|
||||
cli := client.NewClientCallOptions(
|
||||
httpcli.NewClient(
|
||||
client.ContentType("application/x-www-form-urlencoded"),
|
||||
@ -324,7 +322,7 @@ func TestNativeFormUrlencoded(t *testing.T) {
|
||||
}},
|
||||
})
|
||||
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" {
|
||||
@ -438,16 +436,15 @@ func TestNativeClientServer(t *testing.T) {
|
||||
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))
|
||||
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")
|
||||
|
||||
hrsp, err := http.DefaultClient.Do(hr)
|
||||
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() {
|
||||
_ = hrsp.Body.Close()
|
||||
@ -462,17 +459,16 @@ func TestNativeClientServer(t *testing.T) {
|
||||
t.Fatalf("invalid rsp code %#+v", hrsp)
|
||||
}
|
||||
|
||||
t.Logf("test second server")
|
||||
svc2 := pb.NewTestDoubleClient("helloworld", cli)
|
||||
rsp, err = svc2.CallDouble(ctx, &pb.CallReq{
|
||||
Name: "my_name",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Fatalf("test second server err: %v", err)
|
||||
}
|
||||
|
||||
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))
|
||||
@ -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))
|
||||
pbc := pb.NewTestClient("test", c)
|
||||
|
||||
t.Logf("test with string_ids")
|
||||
prsp, err := pbc.CallRepeatedString(context.TODO(), &pb.CallReq{StringIds: []string{"123", "321"}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Fatalf("test with string_ids err: %v", err)
|
||||
}
|
||||
|
||||
if prsp.Rsp != "name_my_name" {
|
||||
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}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Fatalf("test with int64_ids err: %v", err)
|
||||
}
|
||||
|
||||
if prsp.Rsp != "name_my_name" {
|
||||
|
@ -7,14 +7,15 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
_ "go.unistack.org/micro-proto/v3/api"
|
||||
_ "go.unistack.org/micro-proto/v3/openapiv3"
|
||||
_ "go.unistack.org/micro-proto/v3/tag"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -493,8 +494,9 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*CallReq)(nil), // 0: test.CallReq
|
||||
(*Nested)(nil), // 1: test.Nested
|
||||
(*CallRsp)(nil), // 2: test.CallRsp
|
||||
@ -503,6 +505,8 @@ var file_test_proto_goTypes = []interface{}{
|
||||
(*Error)(nil), // 5: test.Error
|
||||
(*wrapperspb.UInt64Value)(nil), // 6: google.protobuf.UInt64Value
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
1, // 0: test.CallReq.nested:type_name -> test.Nested
|
||||
6, // 1: test.Nested.uint64_args:type_name -> google.protobuf.UInt64Value
|
||||
|
@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
)
|
||||
|
@ -6,13 +6,14 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
http "net/http"
|
||||
time "time"
|
||||
|
||||
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"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type testDoubleClient struct {
|
||||
|
@ -95,7 +95,6 @@ func TestStoreBasic(t *testing.T) {
|
||||
runStoreTest(tc.s, t)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestStoreTable(t *testing.T) {
|
||||
@ -176,7 +175,6 @@ func runStoreTest(s store.Store, t *testing.T) {
|
||||
suffixPrefixExpiryTests(s, t)
|
||||
readTests(s, t)
|
||||
listTests(s, 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 {
|
||||
t.Fatalf("Expected 2 records, received %d %+v", len(recs), recs)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func expiryTests(s store.Store, t *testing.T) {
|
||||
@ -459,7 +456,6 @@ func suffixPrefixExpiryTests(s store.Store, t *testing.T) {
|
||||
t.Errorf("Expected 3 items, got %d", len(results))
|
||||
// t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
}
|
||||
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
if results, err := s.Read("foo", store.ReadSuffix()); err != nil {
|
||||
@ -469,7 +465,6 @@ func suffixPrefixExpiryTests(s store.Store, t *testing.T) {
|
||||
t.Errorf("Expected 2 items, got %d", len(results))
|
||||
// t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
}
|
||||
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
if results, err := s.Read("foo", store.ReadSuffix()); err != nil {
|
||||
|
5
tools.go
5
tools.go
@ -1,9 +1,10 @@
|
||||
//go:build tools
|
||||
// +build tools
|
||||
|
||||
package micro-tests
|
||||
package micro_tests
|
||||
|
||||
import (
|
||||
_ "go.unistack.org/micro-proto/v3/openapiv3"
|
||||
_ "go.unistack.org/micro-proto/v3/api"
|
||||
_ "go.unistack.org/micro-proto/v3/openapiv3"
|
||||
_ "go.unistack.org/micro-proto/v3/tag"
|
||||
)
|
||||
|
@ -7,11 +7,12 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -194,12 +195,15 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*CallReq)(nil), // 0: reflect.CallReq
|
||||
(*Nested)(nil), // 1: reflect.Nested
|
||||
(*wrapperspb.UInt64Value)(nil), // 2: google.protobuf.UInt64Value
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
1, // 0: reflect.CallReq.nested:type_name -> reflect.Nested
|
||||
2, // 1: reflect.Nested.uint64_args:type_name -> google.protobuf.UInt64Value
|
||||
|
@ -61,9 +61,8 @@ func TestMergeString(t *testing.T) {
|
||||
mp["bool"] = true
|
||||
s := &str{}
|
||||
|
||||
t.Logf("merge with true")
|
||||
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" {
|
||||
@ -71,9 +70,8 @@ func TestMergeString(t *testing.T) {
|
||||
}
|
||||
|
||||
mp["bool"] = false
|
||||
t.Logf("merge with false")
|
||||
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" {
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
"go.unistack.org/micro/v3/client"
|
||||
"go.unistack.org/micro/v3/errors"
|
||||
"go.unistack.org/micro/v3/network/transport"
|
||||
"go.unistack.org/micro/v3/register"
|
||||
"go.unistack.org/micro/v3/router"
|
||||
"go.unistack.org/micro/v3/server"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user