Skip to content

Commit

Permalink
Implemented RegisterGatewayServiceClient
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jesse Geens committed Nov 11, 2024
1 parent 4fbce99 commit a30a0ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/rgrpc/todo/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ func NewConn(options Options) (*grpc.ClientConn, error) {
return conn, nil
}

func RegisterGatewayServiceClient(client gateway.GatewayAPIClient, endpoint string) {
gatewayProviders.m.Lock()
defer gatewayProviders.m.Unlock()

gatewayProviders.conn[endpoint] = client
}

// GetGatewayServiceClient returns a GatewayServiceClient.
func GetGatewayServiceClient(opts ...Option) (gateway.GatewayAPIClient, error) {
gatewayProviders.m.Lock()
Expand Down

0 comments on commit a30a0ba

Please sign in to comment.