Description
Problem
We are runnign dontnet services on GCP, where spanner is our database service of choice for some services. Running integration tests on this, controlled from unit test style code is part of our process. Test containers is ideal for this, however so far there is no spanner module available.
Solution
We created a testcontainers.spanner module for internal use and like to contribute it back to the community.
We like to create a feature branch on this, make the adoptions needed to make it an official module and integrate in in the testcontainers CI and ultimately raise a pull reqwuest for this.
The module now contains these functionalities:
- On the builder
-- WithInstanceId
-- WIthProjectId
-- WithDabaseId - On the SpannerContainer class
-- Expose the mapped port for grpc
-- Expose the port mapped for rest
-- expose the connectionstring
-- On start set required environmentvariable in dotnet for connecting to a spanner emulator
-- On start create the project and database on the emulator instanc
-- Expose an execute ddl method to simplify defining the datamodel
Benefit
Other developers in need of testing locally or in CI processes against a spanner will need less code and time to set up their testcontainer. The testcontainers module set will be bigger, increasing the maturity of the suite.
Alternatives
No alternatives that I'm aware of
Would you like to help contributing this enhancement?
Yes
Activity