This repository demonstrates how you can use testcontainers-go with Dolt's built in module, currently in review.
Dolt is a SQL database that you can fork, clone, branch, merge, push and pull just like a Git repository.
This demo repository is modeled from the Getting Started with TestContainers for Go document which
walks users through writing some tests using Golang and the PostgreSQL testcontainer API.
Here, we've used the same repository structure as defined in that document, but have used the Dolt testcontainer module API in place of PostgreSQL.
Additionally, this repository leverages two unique features of Dolt that makes it an excellent relational database for testing.
In customer/repo_suite_test.go the BeforeTest() method ensures each test is executed on a distinct database branch, guaranteeing that tests start with the same database state and
do not impact any other tests running against the Dolt container.
Similarly, in customer/clone_suite_test.go, the SetupSuite() shows how a Dolt container can use data hosted on a Dolt remote, like DoltHub, by cloning that data into the Dolt container before running tests.
You can run all tests by cloning this repository then running:
go test ./...