server_test.go 606 B

1234567891011121314151617181920212223
  1. package grpc
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/ep/saga/api/grpc/v1"
  6. "go-common/library/net/rpc/warden"
  7. "go-common/library/net/rpc/warden/resolver"
  8. "go-common/library/net/rpc/warden/resolver/direct"
  9. )
  10. func TestGRPC(t *testing.T) {
  11. resolver.Register(direct.New())
  12. conn, err := warden.NewClient(nil).Dial(context.Background(), "direct://default/127.0.0.1:9000")
  13. if err != nil {
  14. t.Fatal(err)
  15. }
  16. client := v1.NewSagaAdminClient(conn)
  17. if _, err = client.PushMsg(context.Background(), &v1.PushMsgReq{Username: []string{"wuwei"}, Content: "test"}); err != nil {
  18. t.Error(err)
  19. }
  20. }