testcontainers / testcontainers/testcontainers-dotnet

[Enhancement]: Add spanner (emulator) module

Open
#862 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement module
Dominant language
C#
Stars
4.4k
Forks
357
Avg merge
14h 42m
Merged PRs (30d)
16

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing existing Testcontainers modules and the repository's CI integration patterns, then compare them with the requested SpannerContainer builder and lifecycle functionality in this issue. Done means an official Spanner emulator module provides the listed configuration, ports, connection string, initialization, environment setup, DDL execution, and CI integration.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker, google-cloud
Domain
cloud, databases, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.