Skip to content

Testing: Testcontainers for Go#1782

Merged
florinutz merged 3 commits into
mainfrom
testcontainers-go
Jun 12, 2026
Merged

Testing: Testcontainers for Go#1782
florinutz merged 3 commits into
mainfrom
testcontainers-go

Conversation

@florinutz

Copy link
Copy Markdown
Contributor

Adds a self-contained Go integration-testing example under testing/testcontainers/go-pgx/, bringing Go to parity with the existing Java and Python Testcontainers examples.

Testcontainers for Go has no dedicated CrateDB module, so a small cratedb.go helper drives the core GenericContainer with the CrateDB OCI image, a single-node command line, and an HTTP wait strategy on port 4200. Tests connect over the PostgreSQL wire protocol with [pgx]. Unlike by-language/go-pgx, the suite needs no external CrateDB and no CI services: block — Testcontainers starts the database itself.

Test cases:

  • shared container (TestMain) — query sys.summits over the shared connection
  • per-test container — own throwaway CrateDB, torn down via t.Cleanup
  • advanced typesARRAY, OBJECT(DYNAMIC), GEO_POINT, TIMESTAMP WITH TIME ZONE
  • HTTP endpoint — CrateDB's native /_sql REST interface on port 4200

Also includes a README, a Makefile, and a CI workflow (testing-testcontainers-go.yml: Go 1.26.x × CrateDB nightly, nightly cron).

Run locally (requires Docker):

cd testing/testcontainers/go-pgx && go test -v ./...

Closes #1770

@florinutz florinutz requested review from bgunebakan and kneth June 11, 2026 14:46
@florinutz florinutz added enhancement New feature or request github_actions Pull requests that update GitHub Actions code go Pull requests that update go code labels Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 65ff9d70-6a66-4891-8f0b-9b75fb3debb4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch testcontainers-go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@amotl amotl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you so much! Please also add a relevant item to .github/dependabot.yml when applicable.

Comment thread framework/flink/kafka-jdbcsink-java/.env
@florinutz florinutz force-pushed the testcontainers-go branch from c12da26 to f95ce37 Compare June 11, 2026 16:26
@florinutz florinutz requested a review from amotl June 11, 2026 16:30
@florinutz florinutz force-pushed the testcontainers-go branch from 04f7fc2 to d1673c4 Compare June 11, 2026 16:50
Comment thread testing/testcontainers/go-pgx/shared_test.go
Comment thread testing/testcontainers/go-pgx/README.md

@kneth kneth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (disclaimer: I don't know much about Golang)

@florinutz florinutz merged commit 7048895 into main Jun 12, 2026
2 checks passed
@florinutz florinutz deleted the testcontainers-go branch June 12, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request github_actions Pull requests that update GitHub Actions code go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Testcontainers for go

3 participants