cloudspannerecosystem/wrench

Support passing option.ClientOption to NewClient in the spanner pkg

Closed this issue · 0 comments

WHAT

Make it so it's possible to instantiate the client in wrench/pkg/spanner with option.ClientOption - perhaps like this:

func NewClient(ctx context.Context, config *Config, opts ...option.ClientOption) (*Client, error)

WHY

I'm trying to use spannertest for unit testing and would like to perform a wrench migration on a new inmem fake db instance. However, I'd also like to avoid using SPANNER_EMULATOR_HOST as I'd like to have multiple instances of spannertest running in the unit test suite.

It is the case that a normal spanner Client can be instantiated such that it uses the spannertest server by passing option.WithGRPCConn(conn) to spanner.NewClient with conn being a gRPC connection to the spannertest server. Perhaps the wrench NewClient could also be able to interact with a spannertest server by instantiating the spanner.Client and the apiv1.DatabaseAdminClient with this option?