xframe/component/service_discovery/zrpc/consul/tests/client_test.go

20 lines
407 B
Go
Raw Normal View History

2024-10-12 12:55:20 +08:00
package tests
import (
"fmt"
"testing"
"time"
"google.golang.org/grpc"
)
func TestCLient(t *testing.T) {
svcCfg := fmt.Sprintf(`{"loadBalancingPolicy":"%s"}`, "round_robin")
conn, err := grpc.Dial("consul://127.0.0.1:8500/gozero?wait=14s&tag=public", grpc.WithInsecure(), grpc.WithDefaultServiceConfig(svcCfg))
if err != nil {
t.Fatal(err)
}
defer conn.Close()
time.Sleep(29 * time.Second)
}