Skip to content

Commit 5dfa9ed

Browse files
committed
Implemented RegisterGatewayServiceClient
Implemented a new function to register a GatewayServiceClient. Previously, this could only be done by passing an actual connection. However, that is unnecessarily limiting. Introducing the RegisterGatewayServiceClient allows us to register mocked gateways for unit testing
1 parent d2b2c10 commit 5dfa9ed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/rgrpc/todo/pool/pool.go

+7
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ func NewConn(options Options) (*grpc.ClientConn, error) {
9797
return conn, nil
9898
}
9999

100+
func RegisterGatewayServiceClient(client gateway.GatewayAPIClient, endpoint string) {
101+
gatewayProviders.m.Lock()
102+
defer gatewayProviders.m.Unlock()
103+
104+
gatewayProviders.conn[endpoint] = client
105+
}
106+
100107
// GetGatewayServiceClient returns a GatewayServiceClient.
101108
func GetGatewayServiceClient(opts ...Option) (gateway.GatewayAPIClient, error) {
102109
gatewayProviders.m.Lock()

0 commit comments

Comments
 (0)