Skip to content

Commit

Permalink
chore: fixing deprecating function in dapr fake test client (open-pol…
Browse files Browse the repository at this point in the history
…icy-agent#3451)

Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com>
  • Loading branch information
JaydipGabani authored and Ankurk99 committed Aug 1, 2024
1 parent 005f7e2 commit c333d61
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/pubsub/dapr/fake_dapr_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (

var logger = log.New(os.Stdout, "", 0)

func getTestClient(ctx context.Context) (client daprClient.Client, closer func()) {
func getTestClient(_ context.Context) (client daprClient.Client, closer func()) {
s := grpc.NewServer()
pb.RegisterDaprServer(s, &testDaprServer{
state: make(map[string][]byte),
Expand All @@ -46,11 +46,15 @@ func getTestClient(ctx context.Context) (client daprClient.Client, closer func()
}
}()

const serviceAddress = "localhost:50051"

d := grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {
return l.Dial()
})

c, err := grpc.DialContext(ctx, "", d, grpc.WithTransportCredentials(insecure.NewCredentials()))
opts := []grpc.DialOption{d, grpc.WithTransportCredentials(insecure.NewCredentials())}
// Replace "" with `serviceAddress` to specify the service to connect to
c, err := grpc.NewClient(serviceAddress, opts...)
if err != nil {
logger.Fatalf("failed to dial test context: %v", err)
}
Expand Down

0 comments on commit c333d61

Please sign in to comment.