update deps
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
717ccd82be
commit
bfd208e3cd
84
client/client_call_options_test.go
Normal file
84
client/client_call_options_test.go
Normal file
@ -0,0 +1,84 @@
|
||||
// +build ignore
|
||||
|
||||
package client_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/unistack-org/micro/v3/broker"
|
||||
bmemory "github.com/unistack-org/micro/v3/broker/memory"
|
||||
"github.com/unistack-org/micro/v3/client"
|
||||
"github.com/unistack-org/micro/v3/client/grpc"
|
||||
tmemory "github.com/unistack-org/micro/v3/network/transport/memory"
|
||||
rmemory "github.com/unistack-org/micro/v3/registry/memory"
|
||||
"github.com/unistack-org/micro/v3/router"
|
||||
rtreg "github.com/unistack-org/micro/v3/router/registry"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
grpcsrv "github.com/unistack-org/micro/v3/server/grpc"
|
||||
cw "github.com/unistack-org/micro/v3/util/client"
|
||||
)
|
||||
|
||||
type TestFoo struct {
|
||||
}
|
||||
|
||||
type TestReq struct{}
|
||||
|
||||
type TestRsp struct {
|
||||
Data string
|
||||
}
|
||||
|
||||
func (h *TestFoo) Bar(ctx context.Context, req *TestReq, rsp *TestRsp) error {
|
||||
rsp.Data = "pass"
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestStaticClient(t *testing.T) {
|
||||
var err error
|
||||
|
||||
req := grpc.NewClient().NewRequest(
|
||||
"go.micro.service.foo",
|
||||
"TestFoo.Bar",
|
||||
&TestReq{},
|
||||
client.WithContentType("application/json"),
|
||||
)
|
||||
rsp := &TestRsp{}
|
||||
|
||||
reg := rmemory.NewRegistry()
|
||||
brk := bmemory.NewBroker(broker.Registry(reg))
|
||||
tr := tmemory.NewTransport()
|
||||
rtr := rtreg.NewRouter(router.Registry(reg))
|
||||
|
||||
srv := grpcsrv.NewServer(
|
||||
server.Broker(brk),
|
||||
server.Registry(reg),
|
||||
server.Name("go.micro.service.foo"),
|
||||
server.Address("127.0.0.1:0"),
|
||||
server.Transport(tr),
|
||||
)
|
||||
if err = srv.Handle(srv.NewHandler(&TestFoo{})); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err = srv.Start(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
cli := grpc.NewClient(
|
||||
client.Router(rtr),
|
||||
client.Broker(brk),
|
||||
client.Transport(tr),
|
||||
)
|
||||
|
||||
w1 := cw.Static("xxx_localhost:12345", cli)
|
||||
if err = w1.Call(context.TODO(), req, nil); err == nil {
|
||||
t.Fatal("address xxx_#localhost:12345 must not exists and call must be failed")
|
||||
}
|
||||
|
||||
w2 := cw.Static(srv.Options().Address, cli)
|
||||
if err = w2.Call(context.TODO(), req, rsp); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if rsp.Data != "pass" {
|
||||
t.Fatalf("something wrong with response: %#+v", rsp)
|
||||
}
|
||||
}
|
9
go.mod
9
go.mod
@ -1,6 +1,6 @@
|
||||
module github.com/unistack-org/micro-tests
|
||||
|
||||
go 1.13
|
||||
go 1.15
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.4.3
|
||||
@ -12,19 +12,20 @@ require (
|
||||
github.com/unistack-org/micro-broker-http v0.0.0-20201125231853-bb4bd204b8c0
|
||||
github.com/unistack-org/micro-broker-memory v0.0.2-0.20201105185131-5ff932308afd
|
||||
github.com/unistack-org/micro-client-grpc v0.0.2-0.20201125224558-067cf68d2312
|
||||
github.com/unistack-org/micro-client-http v0.0.0-20201207194404-a4de68a7c403
|
||||
github.com/unistack-org/micro-client-http v0.0.0-20201215211731-57760676f366
|
||||
github.com/unistack-org/micro-codec-grpc v0.0.0-20201129180052-c9fbcb46d2c7
|
||||
github.com/unistack-org/micro-codec-json v0.0.0-20201129180318-74c22103001a
|
||||
github.com/unistack-org/micro-codec-proto v0.0.0-20201129180614-012d8c3fcb03
|
||||
github.com/unistack-org/micro-codec-segmentio v0.0.0-20201129180849-c2fe5b084e25
|
||||
github.com/unistack-org/micro-config-env v0.0.0-20201213162929-a90e073b86e3
|
||||
github.com/unistack-org/micro-metrics-prometheus v0.0.2-0.20201125232532-93104a0ff374
|
||||
github.com/unistack-org/micro-registry-memory v0.0.2-0.20201105195351-bd57ee0e4bd6
|
||||
github.com/unistack-org/micro-router-registry v0.0.2-0.20201105175056-773128885d9e
|
||||
github.com/unistack-org/micro-server-grpc v0.0.3-0.20201125221721-36040a57659a
|
||||
github.com/unistack-org/micro-server-grpc v0.0.3-0.20201215085611-a149084e9af7
|
||||
github.com/unistack-org/micro-server-http v0.0.2-0.20201125222045-54ee918b278c
|
||||
github.com/unistack-org/micro-server-tcp v0.0.2-0.20201125222121-31fd93a07671
|
||||
github.com/unistack-org/micro-wrapper-opentracing v0.0.1
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201207185445-f63ff80d467e
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201215200951-70a17dc10a2e
|
||||
google.golang.org/grpc v1.34.0
|
||||
google.golang.org/protobuf v1.25.0
|
||||
)
|
||||
|
16
go.sum
16
go.sum
@ -422,8 +422,8 @@ github.com/unistack-org/micro-broker-memory v0.0.2-0.20201105185131-5ff932308afd
|
||||
github.com/unistack-org/micro-broker-memory v0.0.2-0.20201105185131-5ff932308afd/go.mod h1:BlX+zLHGZxNngsiGiAaIqt0XjwIk3iurw4cqRFYRaVk=
|
||||
github.com/unistack-org/micro-client-grpc v0.0.2-0.20201125224558-067cf68d2312 h1:1bv8hdLhKLiYk4e5Q9N9s7Ztp+VzElWrAQeNWfOJLuY=
|
||||
github.com/unistack-org/micro-client-grpc v0.0.2-0.20201125224558-067cf68d2312/go.mod h1:l0d4iUMAOnOLXwZ+lnKRNJNad6igfLhITCCMrTGfup0=
|
||||
github.com/unistack-org/micro-client-http v0.0.0-20201207194404-a4de68a7c403 h1:7iKLImRMGXG/ux8Z9SKSFlhRBOcQ4XFEZxcsEg87Bz4=
|
||||
github.com/unistack-org/micro-client-http v0.0.0-20201207194404-a4de68a7c403/go.mod h1:vb+5C+r23Q8H5FTpcwGT3XwaenKeGBY7SMcFo+UUV4k=
|
||||
github.com/unistack-org/micro-client-http v0.0.0-20201215211731-57760676f366 h1:GDi9Qol/SQj0Eew/gHIe5eChJskZpzwVCvw1Ok49T80=
|
||||
github.com/unistack-org/micro-client-http v0.0.0-20201215211731-57760676f366/go.mod h1:vb+5C+r23Q8H5FTpcwGT3XwaenKeGBY7SMcFo+UUV4k=
|
||||
github.com/unistack-org/micro-codec-bytes v0.0.0-20200827104921-3616a69473a6/go.mod h1:g5sOI8TWgGZiVHe8zoUPdtz7+0oLnqTnfBoai6Qb7jE=
|
||||
github.com/unistack-org/micro-codec-bytes v0.0.0-20200828083432-4e49e953d844/go.mod h1:g5sOI8TWgGZiVHe8zoUPdtz7+0oLnqTnfBoai6Qb7jE=
|
||||
github.com/unistack-org/micro-codec-grpc v0.0.0-20201129180052-c9fbcb46d2c7 h1:5trw/6cMGZmAMsZJBC7gXUBQpuexHbv3Dk/x+GzJMSo=
|
||||
@ -444,14 +444,16 @@ github.com/unistack-org/micro-config-cmd v0.0.0-20200909210755-6e7e85eeab34/go.m
|
||||
github.com/unistack-org/micro-config-cmd v0.0.0-20200920140133-0853deb2e5dc/go.mod h1:il8nz4ZEcX3Usyfrtwy+YtQcb7xSUSFJdSe8PBJ9gOA=
|
||||
github.com/unistack-org/micro-config-cmd v0.0.0-20201028144621-5a55f1aad70a h1:VjlqP1qZkjC0Chmx5MKFPIbtSCigeICFDf8vaLZGh9o=
|
||||
github.com/unistack-org/micro-config-cmd v0.0.0-20201028144621-5a55f1aad70a/go.mod h1:MzMg+qh1wORZwYtg5AVgFkNFrXVVbdPKW7s/Is+A994=
|
||||
github.com/unistack-org/micro-config-env v0.0.0-20201213162929-a90e073b86e3 h1:hf13BUDevjPCnL0loVFa2MXnkpvQTF8HI8zDdEmFXZI=
|
||||
github.com/unistack-org/micro-config-env v0.0.0-20201213162929-a90e073b86e3/go.mod h1:kQ0xdRmlE4md7pFaVv5gnijBzM8QvjGUBM58hBmkol0=
|
||||
github.com/unistack-org/micro-metrics-prometheus v0.0.2-0.20201125232532-93104a0ff374 h1:5AJyrOi52tAW+3OLfTuan5LMD1SLFwHRTT3bMQb/5t8=
|
||||
github.com/unistack-org/micro-metrics-prometheus v0.0.2-0.20201125232532-93104a0ff374/go.mod h1:08E+Tc4yyY9OBCeJRDZ5oYvuVr+MktOkxF+aL+svRMk=
|
||||
github.com/unistack-org/micro-registry-memory v0.0.2-0.20201105195351-bd57ee0e4bd6 h1:5MH9y5Zn8OyVwD6XWyP2ejuktpqLHD1JOVYoOwYZ1mo=
|
||||
github.com/unistack-org/micro-registry-memory v0.0.2-0.20201105195351-bd57ee0e4bd6/go.mod h1:0f9qV/bM07qO2sNuNnr3qOEozsYpmkTxuEgauWLWDec=
|
||||
github.com/unistack-org/micro-router-registry v0.0.2-0.20201105175056-773128885d9e h1:spzPFROFgxXCoggEv0dapiH3Hfp0x/HqQy4rimQ1rbU=
|
||||
github.com/unistack-org/micro-router-registry v0.0.2-0.20201105175056-773128885d9e/go.mod h1:nvJqRLixa2UqbctfnMx1WJ6IJdPJQ9FheJnh+03QsXA=
|
||||
github.com/unistack-org/micro-server-grpc v0.0.3-0.20201125221721-36040a57659a h1:sOD8+ZYzbFYhoM4est/oyrHrCcEZ982819tGt8fnKqA=
|
||||
github.com/unistack-org/micro-server-grpc v0.0.3-0.20201125221721-36040a57659a/go.mod h1:tBIPu5Z8R5AKPLEnuz/LHxNZtNYr2Maq4FTlo5GBffo=
|
||||
github.com/unistack-org/micro-server-grpc v0.0.3-0.20201215085611-a149084e9af7 h1:h3vHfx9Ejwom+hzUFZ5uno97UfVZRPV3ej47UDNMyCw=
|
||||
github.com/unistack-org/micro-server-grpc v0.0.3-0.20201215085611-a149084e9af7/go.mod h1:cC+GeL6l2/QQyIuMvqI1N9q8vKz8Zs7xR6mrQdM/bbs=
|
||||
github.com/unistack-org/micro-server-http v0.0.2-0.20201125222045-54ee918b278c h1:zMZ9y6rBRj0XkLHCKoCs4aI/QmpRkftDW8ME+dqNOq0=
|
||||
github.com/unistack-org/micro-server-http v0.0.2-0.20201125222045-54ee918b278c/go.mod h1:fEiOF/dbQdGXsDQHrVoUsqpFOQ99lk02ID5B0kkqLBc=
|
||||
github.com/unistack-org/micro-server-tcp v0.0.2-0.20201125222121-31fd93a07671 h1:8DEZGRci3iiw7g2mkDnEB6nPouoa950Jz7TuzYfEuAY=
|
||||
@ -471,8 +473,10 @@ github.com/unistack-org/micro/v3 v3.0.2-0.20201123132107-c9049c384502/go.mod h1:
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201124121447-71d82e9d5b25/go.mod h1:RxbWu3Q2jWpw0er6CwX2BnGdIDfUZg/0c4bMxzAzaH0=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201125221305-0d93b2c31c79 h1:Y4EZoEml8louFP6encMeFhxGaNh91UdYOvxkjf7JoTc=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201125221305-0d93b2c31c79/go.mod h1:RxbWu3Q2jWpw0er6CwX2BnGdIDfUZg/0c4bMxzAzaH0=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201207185445-f63ff80d467e h1:hCwwWNPQMuv6ioqY/kI98MNkr4O0CaifMNsusQdMyH0=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201207185445-f63ff80d467e/go.mod h1:iDqf3oejSosKbIlOlxiLeM6XTrLvfIIh0u4i2HG3UvM=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201213101738-2dcd30b21c0f/go.mod h1:0DgOy4OdJxQCDER8YSKitZugd2+1bddrRSNfeooTHDc=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201215085205-f14efa64f09f/go.mod h1:0DgOy4OdJxQCDER8YSKitZugd2+1bddrRSNfeooTHDc=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201215200951-70a17dc10a2e h1:DVTCT5etkTT6/hJWn7YFSWD8YpO/ki+FYylfDJavNVs=
|
||||
github.com/unistack-org/micro/v3 v3.0.2-0.20201215200951-70a17dc10a2e/go.mod h1:0DgOy4OdJxQCDER8YSKitZugd2+1bddrRSNfeooTHDc=
|
||||
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=
|
||||
|
Loading…
Reference in New Issue
Block a user