Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dolthub/testcontainers-go-demo
https://github.com/dolthub/testcontainers-go-demo
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dolthub/testcontainers-go-demo
- Owner: dolthub
- Created: 2024-01-29T23:04:32.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-01T19:23:27.000Z (11 months ago)
- Last Synced: 2024-11-08T08:32:22.162Z (about 2 months ago)
- Language: Go
- Size: 33.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# testcontainers-go-demo
This repository demonstrates how you can use `testcontainers-go` with Dolt's built in module, [currently in review](https://github.com/testcontainers/testcontainers-go/pull/2177).
[Dolt](https://www.doltdb.com) 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](https://testcontainers.com/guides/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](https://www.dolthub.com), by cloning that data into the Dolt container before running tests.
## Running Tests
You can run all tests by cloning this repository then running:
```bash
go test ./...
```