update tests
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
6e1f30e931
commit
f92f3ca5f7
@ -14,11 +14,9 @@ import (
|
||||
rpc "github.com/unistack-org/micro-api-handler-rpc/v3"
|
||||
rregister "github.com/unistack-org/micro-api-router-register/v3"
|
||||
rstatic "github.com/unistack-org/micro-api-router-static/v3"
|
||||
bmemory "github.com/unistack-org/micro-broker-memory/v3"
|
||||
gcli "github.com/unistack-org/micro-client-grpc/v3"
|
||||
jsoncodec "github.com/unistack-org/micro-codec-json/v3"
|
||||
protocodec "github.com/unistack-org/micro-codec-proto/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
regRouter "github.com/unistack-org/micro-router-register/v3"
|
||||
gsrv "github.com/unistack-org/micro-server-grpc/v3"
|
||||
pb "github.com/unistack-org/micro-tests/server/grpc/proto"
|
||||
@ -27,6 +25,7 @@ import (
|
||||
"github.com/unistack-org/micro/v3/api/router"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
rt "github.com/unistack-org/micro/v3/router"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
@ -48,12 +47,12 @@ func (s *testServer) Call(ctx context.Context, req *pb.Request, rsp *pb.Response
|
||||
|
||||
func initial(t *testing.T) (server.Server, client.Client) {
|
||||
//logger.DefaultLogger = logger.NewLogger(logger.WithLevel(logger.TraceLevel))
|
||||
r := rmemory.NewRegister()
|
||||
r := register.NewRegister()
|
||||
if err := r.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
b := bmemory.NewBroker(broker.Register(r))
|
||||
b := broker.NewBroker(broker.Register(r))
|
||||
if err := b.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"github.com/google/uuid"
|
||||
http "github.com/unistack-org/micro-broker-http/v3"
|
||||
jsoncodec "github.com/unistack-org/micro-codec-json/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
)
|
||||
@ -57,7 +56,7 @@ var (
|
||||
)
|
||||
|
||||
func newTestRegister() register.Register {
|
||||
return rmemory.NewRegister()
|
||||
return register.NewRegister()
|
||||
}
|
||||
|
||||
func sub(be *testing.B, c int) {
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
|
||||
grpc "github.com/unistack-org/micro-client-grpc/v3"
|
||||
protocodec "github.com/unistack-org/micro-codec-proto/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
regRouter "github.com/unistack-org/micro-router-register/v3"
|
||||
pb "github.com/unistack-org/micro-tests/client/grpc/proto"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
@ -72,7 +71,7 @@ func TestGRPCClient(t *testing.T) {
|
||||
defer s.Stop()
|
||||
|
||||
// create mock register
|
||||
r := rmemory.NewRegister()
|
||||
r := register.NewRegister()
|
||||
|
||||
// register service
|
||||
if err := r.Register(ctx, ®ister.Service{
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
|
||||
mhttp "github.com/unistack-org/micro-client-http/v3"
|
||||
jsoncodec "github.com/unistack-org/micro-codec-json/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
rrouter "github.com/unistack-org/micro-router-register/v3"
|
||||
pb "github.com/unistack-org/micro-tests/client/http/proto"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
@ -77,7 +76,7 @@ func TestNative(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHTTPClient(t *testing.T) {
|
||||
reg := rmemory.NewRegister()
|
||||
reg := register.NewRegister()
|
||||
rtr := rrouter.NewRouter(router.Register(reg))
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@ -164,7 +163,7 @@ func TestHTTPClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHTTPClientStream(t *testing.T) {
|
||||
reg := rmemory.NewRegister()
|
||||
reg := register.NewRegister()
|
||||
rtr := rrouter.NewRouter(router.Register(reg))
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
@ -4,18 +4,16 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
bmemory "github.com/unistack-org/micro-broker-memory/v3"
|
||||
gclient "github.com/unistack-org/micro-client-grpc/v3"
|
||||
|
||||
// protocodec "github.com/unistack-org/micro-codec-proto/v3"
|
||||
protocodec "github.com/unistack-org/micro-codec-segmentio/v3/proto"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
regRouter "github.com/unistack-org/micro-router-register/v3"
|
||||
gserver "github.com/unistack-org/micro-server-grpc/v3"
|
||||
pb "github.com/unistack-org/micro-tests/server/grpc/proto"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/errors"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
"github.com/unistack-org/micro/v3/router"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
@ -35,8 +33,8 @@ func (g *testServer) Call(ctx context.Context, req *pb.Request, rsp *pb.Response
|
||||
func TestGRPCServer(t *testing.T) {
|
||||
var err error
|
||||
|
||||
r := rmemory.NewRegister()
|
||||
b := bmemory.NewBroker(broker.Register(r))
|
||||
r := register.NewRegister()
|
||||
b := broker.NewBroker(broker.Register(r))
|
||||
s := gserver.NewServer(server.Codec("application/grpc+proto", protocodec.NewCodec()), server.Address(":12345"), server.Register(r), server.Name("helloworld"), gserver.Reflection(true))
|
||||
// create router
|
||||
rtr := regRouter.NewRouter(router.Register(r))
|
||||
|
11
go.mod
11
go.mod
@ -14,7 +14,6 @@ require (
|
||||
github.com/unistack-org/micro-api-router-register/v3 v3.2.2
|
||||
github.com/unistack-org/micro-api-router-static/v3 v3.2.1
|
||||
github.com/unistack-org/micro-broker-http/v3 v3.2.2
|
||||
github.com/unistack-org/micro-broker-memory/v3 v3.2.3
|
||||
github.com/unistack-org/micro-client-grpc/v3 v3.2.3
|
||||
github.com/unistack-org/micro-client-http/v3 v3.2.3
|
||||
github.com/unistack-org/micro-codec-grpc/v3 v3.1.1
|
||||
@ -25,20 +24,20 @@ require (
|
||||
github.com/unistack-org/micro-config-env/v3 v3.2.4
|
||||
github.com/unistack-org/micro-config-vault/v3 v3.2.4
|
||||
github.com/unistack-org/micro-metrics-prometheus/v3 v3.1.1
|
||||
github.com/unistack-org/micro-register-memory/v3 v3.2.2
|
||||
github.com/unistack-org/micro-router-register/v3 v3.2.2
|
||||
github.com/unistack-org/micro-server-grpc/v3 v3.2.2
|
||||
github.com/unistack-org/micro-server-http/v3 v3.2.5
|
||||
github.com/unistack-org/micro-server-tcp/v3 v3.2.2
|
||||
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.1.1
|
||||
github.com/unistack-org/micro/v3 v3.2.8
|
||||
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.1.2-0.20210212140355-1844072047f2
|
||||
github.com/unistack-org/micro/v3 v3.2.11
|
||||
google.golang.org/genproto v0.0.0-20210211221406-4ccc9a5e4183
|
||||
google.golang.org/grpc v1.35.0
|
||||
google.golang.org/protobuf v1.25.0
|
||||
)
|
||||
|
||||
//replace github.com/unistack-org/micro-wrapper-trace-opentracing/v3 => ../micro-wrapper-trace-opentracing
|
||||
//replace github.com/unistack-org/micro-client-grpc/v3 => ../micro-client-grpc
|
||||
//replace github.com/unistack-org/micro-server-grpc/v3 => ../micro-server-grpc
|
||||
//replace github.com/unistack-org/micro-server-http/v3 => ../micro-server-http
|
||||
|
||||
//replace github.com/unistack-org/micro-client-http/v3 => ../micro-client-http
|
||||
|
||||
//replace github.com/unistack-org/micro/v3 => ../micro
|
||||
|
30
go.sum
30
go.sum
@ -94,7 +94,6 @@ github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
|
||||
@ -124,7 +123,6 @@ github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4s
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/evanphx/json-patch/v5 v5.2.0 h1:8ozOH5xxoMYDt5/u+yMTsVXydVCbTORFnOOoq2lumco=
|
||||
@ -246,8 +244,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.1.0 h1:EhTvIsn53GrBLl45YVHk25cUHQHwlJfq2y8b7W5IpVY=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.1.0/go.mod h1:ly5QWKtiqC7tGfzgXYtpoZYmEWx5Z82/b18ASEL+yGc=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.2.0 h1:HlJcTiqGHvaWDG7/s85d68Kw7G7FqMz+9LlcyVauOAw=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.2.0/go.mod h1:gRq9gZWcIFvz68EgWqy2qQpRbmtn5j2qLZ4zHjqiLpg=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||
@ -355,6 +351,7 @@ github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo=
|
||||
github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
||||
github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs=
|
||||
github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
||||
github.com/miekg/dns v1.1.38/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
@ -416,6 +413,8 @@ github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwU
|
||||
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
|
||||
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
||||
@ -525,8 +524,6 @@ github.com/unistack-org/micro-api-router-static/v3 v3.2.1 h1:FMcEb8NYYX72OyQuMKH
|
||||
github.com/unistack-org/micro-api-router-static/v3 v3.2.1/go.mod h1:vP8VMZrJtlimEQOgYnLJsjnaUMeULNMPBkHEK5DA7G0=
|
||||
github.com/unistack-org/micro-broker-http/v3 v3.2.2 h1:5Xs1YBZcD1MU9cPPUOsjqz3ZnNLP+vuzTLtrx6jKYSc=
|
||||
github.com/unistack-org/micro-broker-http/v3 v3.2.2/go.mod h1:G7I9ub3rrorYzxlVjvlfp9HvNt6hqFFfHwdEAiSEe9I=
|
||||
github.com/unistack-org/micro-broker-memory/v3 v3.2.3 h1:01l0GqY8eG6Ln3E6VZ5GA9EYYh/fIl4OFYuFlvdNxkE=
|
||||
github.com/unistack-org/micro-broker-memory/v3 v3.2.3/go.mod h1:63X6CabOKmRyxxwEVrDdzFDPOfvzkL+g5SNXft1YWDo=
|
||||
github.com/unistack-org/micro-client-grpc/v3 v3.2.3 h1:0X+PeAZuDYziROwRSuw7mVWsqzSEN8mVO1SSaWM/jNw=
|
||||
github.com/unistack-org/micro-client-grpc/v3 v3.2.3/go.mod h1:HcQuzli6tMTVrl7wHAqpyBZw5M4lUV0tk2WQFgyQ4LU=
|
||||
github.com/unistack-org/micro-client-http/v3 v3.2.3 h1:+a9vwYGs1it/DAXpFbAuiUF/AzFt/4eHnTd/bJLXWU8=
|
||||
@ -547,19 +544,16 @@ github.com/unistack-org/micro-config-vault/v3 v3.2.4 h1:HUOsVbQoki8YdISUVk3jzTgK
|
||||
github.com/unistack-org/micro-config-vault/v3 v3.2.4/go.mod h1:Xbj5R5psic0Dyuh7SrJqvFv0hSIHYKHx91p96rn/lxk=
|
||||
github.com/unistack-org/micro-metrics-prometheus/v3 v3.1.1 h1:AZVQ8l1p1pIUyImQo/if/5t1g9C9du9ulMRqATSmgGo=
|
||||
github.com/unistack-org/micro-metrics-prometheus/v3 v3.1.1/go.mod h1:QfquVeYZ2+BqBQ5bv1+uFAeWFiacvwanRDy3nGVqo3c=
|
||||
github.com/unistack-org/micro-register-memory/v3 v3.2.2 h1:u323kc4OWpx7FXtBf/V7Phib3NWVbDydpp8kViQX4cA=
|
||||
github.com/unistack-org/micro-register-memory/v3 v3.2.2/go.mod h1:utfCoMCsr5xxFI8TH5e5uKK3RlI3Co+SzfVeAWFDfRE=
|
||||
github.com/unistack-org/micro-router-register/v3 v3.2.2 h1:lYCymDHkJfhZWYQ4+Sb7Fu+NlqoysQCnpJytHGhdnws=
|
||||
github.com/unistack-org/micro-router-register/v3 v3.2.2/go.mod h1:Y9Qtlg4NHqq5rR6X6Jm+04LoSJMi7/OOCm2mRueZYTE=
|
||||
github.com/unistack-org/micro-server-grpc/v3 v3.2.2 h1:LfjFdl5jYYGY2SgCEH2qObvlNZ6ENC4HSa36uvI/sx4=
|
||||
github.com/unistack-org/micro-server-grpc/v3 v3.2.2/go.mod h1:459FWPnuW56+gmI3R9ZbWsGEc/+nR70c3YyaI1nRwN8=
|
||||
github.com/unistack-org/micro-server-http/v3 v3.2.4 h1:Zko5UUqRVnNyPKarHSEgvV1GzPWXxEiNnbFhCfNxt9Y=
|
||||
github.com/unistack-org/micro-server-http/v3 v3.2.4/go.mod h1:TOeb0O65cr+MYL1l+AAnaprhuSKqeqDoIEuEk5wepAg=
|
||||
github.com/unistack-org/micro-server-http/v3 v3.2.5 h1:NFuddx39k8DP3nwV1rlRHQIS2/F+KBhG7KUWTwCGrTw=
|
||||
github.com/unistack-org/micro-server-http/v3 v3.2.5/go.mod h1:TOeb0O65cr+MYL1l+AAnaprhuSKqeqDoIEuEk5wepAg=
|
||||
github.com/unistack-org/micro-server-tcp/v3 v3.2.2 h1:2/Xn+4+dnzY/tpD3MgLO1wg3ect9Jx5CLSDfPBjdjT4=
|
||||
github.com/unistack-org/micro-server-tcp/v3 v3.2.2/go.mod h1:TQDIck2+RdEAGIRnwv+2a0OVBUTkL6OM7YUY4AjFFmY=
|
||||
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.1.1 h1:sEnPLn3BGt/t+ITsMJ8zHwtDUV9Qty3NIadOa099uHk=
|
||||
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.1.1/go.mod h1:iY0hsj7ul6sT4Zt2xkclVFpKHG4MZ9k1sllLv01P8vM=
|
||||
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.1.2-0.20210212140355-1844072047f2 h1:hZ71rbaxCGRjR85QHpPcrlLMomfUw1zRBXc4fG9LUkI=
|
||||
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.1.2-0.20210212140355-1844072047f2/go.mod h1:KpWJ5vXecpIdhCFZuv3aYecNZa9H4q3gPsapsjEJ+y8=
|
||||
github.com/unistack-org/micro/v3 v3.1.1 h1:kWL0BVzUBdotjfDbl1qL9lNYmZqvebQWPNCyqrjUSAk=
|
||||
github.com/unistack-org/micro/v3 v3.1.1/go.mod h1:0DgOy4OdJxQCDER8YSKitZugd2+1bddrRSNfeooTHDc=
|
||||
github.com/unistack-org/micro/v3 v3.2.1/go.mod h1:J8XxJj4Pqa3Ee0a4biRRtut7UwTlfBq8QRe+s4PKGS0=
|
||||
@ -571,6 +565,10 @@ github.com/unistack-org/micro/v3 v3.2.4 h1:V/QrzeSI/Bjd0j7uL8Lvvbbz8ky/0yj69srd1
|
||||
github.com/unistack-org/micro/v3 v3.2.4/go.mod h1:J8XxJj4Pqa3Ee0a4biRRtut7UwTlfBq8QRe+s4PKGS0=
|
||||
github.com/unistack-org/micro/v3 v3.2.8 h1:M1qgOz+qgSf/coFeIqDKa7Xc+b3s7du1Yin+i10o3aw=
|
||||
github.com/unistack-org/micro/v3 v3.2.8/go.mod h1:J8XxJj4Pqa3Ee0a4biRRtut7UwTlfBq8QRe+s4PKGS0=
|
||||
github.com/unistack-org/micro/v3 v3.2.10 h1:fO+rtNhKvBjXfTOqBRjUQo2P9E17CM30semSlklRHQI=
|
||||
github.com/unistack-org/micro/v3 v3.2.10/go.mod h1:uGPB8BhDWHj63tR3eaoCd3X+lPtAgFG630897yhB3Ag=
|
||||
github.com/unistack-org/micro/v3 v3.2.11 h1:wXWAF0jBbSdhi40QjDo5v64UtaWWWjZ0y6raiCMylyY=
|
||||
github.com/unistack-org/micro/v3 v3.2.11/go.mod h1:uGPB8BhDWHj63tR3eaoCd3X+lPtAgFG630897yhB3Ag=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA=
|
||||
@ -688,12 +686,13 @@ golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOL
|
||||
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210201163806-010130855d6c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -880,10 +879,6 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d h1:92D1fum1bJLKSdr11OJ+54YeCMCGYIygTA7R/YZxH5M=
|
||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210106152847-07624b53cd92 h1:jOTk2Z6KYaWoptUFqZ167cS8peoUPjFEXrsqfVkkCGc=
|
||||
google.golang.org/genproto v0.0.0-20210106152847-07624b53cd92/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw=
|
||||
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210207032614-bba0dbe2a9ea/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210211221406-4ccc9a5e4183 h1:5YmF1NDDcUX9p0CJqW+GQiLW0HHe7ZW5K6lsFk6mJeA=
|
||||
google.golang.org/genproto v0.0.0-20210211221406-4ccc9a5e4183/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
@ -909,7 +904,6 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1 h1:SfXqXS5hkufcdZ/mHtYCh53P2b+92WQq/DZcKLgsFRs=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||
google.golang.org/grpc v1.35.0 h1:TwIQcH3es+MojMVojxxfQ3l3OF2KzlRxML2xZq0kRo8=
|
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||
|
@ -13,9 +13,7 @@ import (
|
||||
|
||||
metrics "github.com/VictoriaMetrics/metrics"
|
||||
"github.com/stretchr/testify/assert"
|
||||
bmemory "github.com/unistack-org/micro-broker-memory/v3"
|
||||
gclient "github.com/unistack-org/micro-client-grpc/v3"
|
||||
memory "github.com/unistack-org/micro-register-memory/v3"
|
||||
rrouter "github.com/unistack-org/micro-router-register/v3"
|
||||
gserver "github.com/unistack-org/micro-server-grpc/v3"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
@ -44,8 +42,8 @@ func (t *testHandler) Method(ctx context.Context, req *TestRequest, rsp *TestRes
|
||||
|
||||
func TestVictoriametrics(t *testing.T) {
|
||||
// setup
|
||||
r := memory.NewRegister()
|
||||
b := bmemory.NewBroker(broker.Register(r))
|
||||
r := register.NewRegister()
|
||||
b := broker.NewBroker(broker.Register(r))
|
||||
|
||||
name := "test"
|
||||
id := "id-1234567890"
|
||||
|
@ -5,16 +5,15 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
bmemory "github.com/unistack-org/micro-broker-memory/v3"
|
||||
gclient "github.com/unistack-org/micro-client-grpc/v3"
|
||||
protocodec "github.com/unistack-org/micro-codec-proto/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
regRouter "github.com/unistack-org/micro-router-register/v3"
|
||||
gserver "github.com/unistack-org/micro-server-grpc/v3"
|
||||
pb "github.com/unistack-org/micro-tests/server/grpc/proto"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/errors"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
"github.com/unistack-org/micro/v3/router"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
jsonpb "google.golang.org/protobuf/encoding/protojson"
|
||||
@ -46,8 +45,8 @@ func (g *testServer) Call(ctx context.Context, req *pb.Request, rsp *pb.Response
|
||||
func TestGRPCServer(t *testing.T) {
|
||||
var err error
|
||||
|
||||
r := rmemory.NewRegister()
|
||||
b := bmemory.NewBroker(broker.Register(r))
|
||||
r := register.NewRegister()
|
||||
b := broker.NewBroker(broker.Register(r))
|
||||
s := gserver.NewServer(server.Codec("application/grpc+proto", protocodec.NewCodec()), server.Address(":12345"), server.Register(r), server.Name("helloworld"), gserver.Reflection(true),
|
||||
server.WrapHandler(NewServerHandlerWrapper()),
|
||||
)
|
||||
|
@ -11,11 +11,11 @@ import (
|
||||
httpcli "github.com/unistack-org/micro-client-http/v3"
|
||||
jsoncodec "github.com/unistack-org/micro-codec-json/v3"
|
||||
jsonpbcodec "github.com/unistack-org/micro-codec-jsonpb/v3"
|
||||
memory "github.com/unistack-org/micro-register-memory/v3"
|
||||
httpsrv "github.com/unistack-org/micro-server-http/v3"
|
||||
pb "github.com/unistack-org/micro-tests/server/http/proto"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/metadata"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
|
||||
@ -61,7 +61,7 @@ func (h *Handler) CallError(ctx context.Context, req *pb.CallReq1, rsp *pb.CallR
|
||||
}
|
||||
|
||||
func TestNativeClientServer(t *testing.T) {
|
||||
reg := memory.NewRegister()
|
||||
reg := register.NewRegister()
|
||||
ctx := context.Background()
|
||||
|
||||
var mwfOk bool
|
||||
@ -133,7 +133,7 @@ func TestNativeClientServer(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNativeServer(t *testing.T) {
|
||||
reg := memory.NewRegister()
|
||||
reg := register.NewRegister()
|
||||
ctx := context.Background()
|
||||
|
||||
// create server
|
||||
@ -214,7 +214,7 @@ func TestNativeServer(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHTTPServer(t *testing.T) {
|
||||
reg := memory.NewRegister()
|
||||
reg := register.NewRegister()
|
||||
ctx := context.Background()
|
||||
|
||||
// create server
|
||||
|
@ -8,11 +8,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
bmemory "github.com/unistack-org/micro-broker-memory/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
tcp "github.com/unistack-org/micro-server-tcp/v3"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/logger"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
|
||||
@ -24,12 +23,12 @@ func TestTCPServer(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
logger.DefaultLogger = logger.NewLogger(logger.WithLevel(logger.TraceLevel))
|
||||
reg := rmemory.NewRegister()
|
||||
reg := register.NewRegister()
|
||||
if err := reg.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
brk := bmemory.NewBroker(broker.Register(reg))
|
||||
brk := broker.NewBroker(broker.Register(reg))
|
||||
if err := brk.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -8,15 +8,14 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
dto "github.com/prometheus/client_model/go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
bmemory "github.com/unistack-org/micro-broker-memory/v3"
|
||||
cli "github.com/unistack-org/micro-client-grpc/v3"
|
||||
jsoncodec "github.com/unistack-org/micro-codec-json/v3"
|
||||
promwrapper "github.com/unistack-org/micro-metrics-prometheus/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
rrouter "github.com/unistack-org/micro-router-register/v3"
|
||||
srv "github.com/unistack-org/micro-server-grpc/v3"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
"github.com/unistack-org/micro/v3/router"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
@ -42,8 +41,8 @@ func (t *testHandler) Method(ctx context.Context, req *TestRequest, rsp *TestRes
|
||||
func TestPrometheusMetrics(t *testing.T) {
|
||||
client.DefaultRetries = 0
|
||||
// setup
|
||||
reg := rmemory.NewRegister()
|
||||
brk := bmemory.NewBroker(broker.Register(reg))
|
||||
reg := register.NewRegister()
|
||||
brk := broker.NewBroker(broker.Register(reg))
|
||||
|
||||
name := "test"
|
||||
id := "id-1234567890"
|
||||
|
@ -9,12 +9,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/juju/ratelimit"
|
||||
bmemory "github.com/unistack-org/micro-broker-memory/v3"
|
||||
tmemory "github.com/unistack-org/micro-network-transport-memory"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
rrouter "github.com/unistack-org/micro-router-register/v3"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/errors"
|
||||
"github.com/unistack-org/micro/v3/network/transport"
|
||||
"github.com/unistack-org/micro/v3/router"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
@ -29,8 +28,8 @@ func (t *testHandler) Method(ctx context.Context, req *TestRequest, rsp *TestRes
|
||||
|
||||
func TestRateClientLimit(t *testing.T) {
|
||||
// setup
|
||||
r := rmemory.NewRegister()
|
||||
tr := tmemory.NewTransport()
|
||||
r := register.NewRegister()
|
||||
tr := transport.NewTransport()
|
||||
testRates := []int{1, 10, 20}
|
||||
|
||||
for _, limit := range testRates {
|
||||
@ -72,9 +71,9 @@ func TestRateServerLimit(t *testing.T) {
|
||||
testRates := []int{1, 5, 6, 10}
|
||||
|
||||
for _, limit := range testRates {
|
||||
r := rmemory.NewRegister()
|
||||
b := bmemory.NewBroker()
|
||||
tr := tmemory.NewTransport()
|
||||
r := register.NewRegister()
|
||||
b := broker.NewBroker()
|
||||
tr := transport.NewTransport()
|
||||
_ = b
|
||||
|
||||
br := ratelimit.NewBucketWithRate(float64(limit), int64(limit))
|
||||
|
@ -2,22 +2,21 @@ package opentracing_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
opentracing "github.com/opentracing/opentracing-go"
|
||||
"github.com/opentracing/opentracing-go/mocktracer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
rbroker "github.com/unistack-org/micro-broker-memory/v3"
|
||||
cli "github.com/unistack-org/micro-client-grpc/v3"
|
||||
jsoncodec "github.com/unistack-org/micro-codec-json/v3"
|
||||
rmemory "github.com/unistack-org/micro-register-memory/v3"
|
||||
rrouter "github.com/unistack-org/micro-router-register/v3"
|
||||
srv "github.com/unistack-org/micro-server-grpc/v3"
|
||||
otwrapper "github.com/unistack-org/micro-wrapper-trace-opentracing/v3"
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/errors"
|
||||
"github.com/unistack-org/micro/v3/logger"
|
||||
"github.com/unistack-org/micro/v3/register"
|
||||
"github.com/unistack-org/micro/v3/router"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
@ -46,6 +45,7 @@ func (t *testHandler) Method(ctx context.Context, req *TestRequest, rsp *TestRes
|
||||
}
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
logger.DefaultLogger = logger.NewLogger(logger.WithLevel(logger.ErrorLevel))
|
||||
// setup
|
||||
assert := assert.New(t)
|
||||
for name, tt := range map[string]struct {
|
||||
@ -70,8 +70,8 @@ func TestClient(t *testing.T) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
tracer := mocktracer.New()
|
||||
|
||||
reg := rmemory.NewRegister()
|
||||
brk := rbroker.NewBroker(broker.Register(reg))
|
||||
reg := register.NewRegister()
|
||||
brk := broker.NewBroker(broker.Register(reg))
|
||||
|
||||
serverName := "micro.server.name"
|
||||
serverID := "id-1234567890"
|
||||
@ -83,7 +83,7 @@ func TestClient(t *testing.T) {
|
||||
client.Codec("application/grpc+json", jsoncodec.NewCodec()),
|
||||
client.Codec("application/json", jsoncodec.NewCodec()),
|
||||
client.Router(rt),
|
||||
client.WrapCall(otwrapper.NewClientCallWrapper(otwrapper.WithTracer(tracer))),
|
||||
client.Wrap(otwrapper.NewClientWrapper(otwrapper.WithTracer(tracer))),
|
||||
)
|
||||
|
||||
s := srv.NewServer(
|
||||
@ -106,19 +106,20 @@ func TestClient(t *testing.T) {
|
||||
*testHandler
|
||||
}
|
||||
|
||||
s.Handle(s.NewHandler(&Test{new(testHandler)}))
|
||||
if err := s.Handle(s.NewHandler(&Test{new(testHandler)})); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := s.Start(); err != nil {
|
||||
t.Fatalf("Unexpected error starting server: %v", err)
|
||||
}
|
||||
|
||||
ctx, span, err := otwrapper.StartSpanFromContext(context.Background(), tracer, "root")
|
||||
ctx, span, err := otwrapper.StartSpanFromOutgoingContext(context.Background(), tracer, "root")
|
||||
assert.NoError(err)
|
||||
|
||||
req := c.NewRequest(serverName, "Test.Method", &TestRequest{IsError: tt.isError}, client.WithContentType("application/json"))
|
||||
rsp := TestResponse{}
|
||||
err = c.Call(ctx, req, &rsp)
|
||||
|
||||
if tt.isError {
|
||||
assert.Error(err)
|
||||
} else {
|
||||
@ -133,7 +134,6 @@ func TestClient(t *testing.T) {
|
||||
|
||||
var rootSpan opentracing.Span
|
||||
for _, s := range spans {
|
||||
fmt.Printf("%#+v\n", s)
|
||||
// order of traces in buffer is not garanteed
|
||||
switch s.OperationName {
|
||||
case "root":
|
||||
|
Loading…
x
Reference in New Issue
Block a user