MCPcopy
hub / github.com/ory/keto / newGrpcClient

Function newGrpcClient

internal/e2e/grpc_client_test.go:32–54  ·  view source on GitHub ↗
(t testing.TB, ctx context.Context, readRemote, writeRemote, oplSyntaxRemote string)

Source from the content-addressed store, hash-verified

30}
31
32func newGrpcClient(t testing.TB, ctx context.Context, readRemote, writeRemote, oplSyntaxRemote string) *grpcClient {
33 read, err := grpc.NewClient(readRemote, grpc.WithTransportCredentials(insecure.NewCredentials()))
34 require.NoError(t, err)
35 t.Cleanup(func() { require.NoError(t, read.Close()) })
36
37 write, err := grpc.NewClient(writeRemote, grpc.WithTransportCredentials(insecure.NewCredentials()))
38 require.NoError(t, err)
39 t.Cleanup(func() { require.NoError(t, write.Close()) })
40
41 oplSyntax, err := grpc.NewClient(oplSyntaxRemote, grpc.WithTransportCredentials(insecure.NewCredentials()))
42 require.NoError(t, err)
43 t.Cleanup(func() { require.NoError(t, oplSyntax.Close()) })
44
45 ctx, cancel := context.WithCancel(ctx)
46 t.Cleanup(cancel)
47
48 return &grpcClient{
49 read: read,
50 write: write,
51 oplSyntax: oplSyntax,
52 ctx: ctx,
53 }
54}
55
56func (g *grpcClient) queryNamespaces(t testing.TB) (apiResponse ketoapi.GetNamespacesResponse) {
57 client := rts.NewNamespacesServiceClient(g.read)

Callers 1

TestFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected