https://github.com/modfin/brrr
Golang integration testing thingy for postgres
https://github.com/modfin/brrr
Last synced: 5 months ago
JSON representation
Golang integration testing thingy for postgres
- Host: GitHub
- URL: https://github.com/modfin/brrr
- Owner: modfin
- License: mit
- Created: 2025-09-23T15:45:59.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-11-11T13:09:19.000Z (8 months ago)
- Last Synced: 2025-11-11T15:02:58.082Z (8 months ago)
- Language: Go
- Size: 22.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BRRR
Brrr is an integration testing thingy for go applications using postgres.
## What does it do and what does it try to solve
1. Launches a single go test container for postgres.
2. Optionally runs seeding migration scripts.
3. Marks the database as a template database.
4. For each test, creates a new database from the template so each test can have its own database in isolation.
5. Runs isolated integration tests in parallel.
## Why The name
It goes fast.
## Example
```
var c *brrr.Container
func TestMain(m *testing.M) {
cfg := brrr.Config {
User: "postgres",
Password: "test",
Database: "acme",
}
var err error
c, err = brrr.NewContainer(cfg)
if err != nil {
log.Fatalf("failed to create test container: %v", err)
}
defer c.Close()
exitCode := m.Run()
os.Exit(exitCode)
}
func TestSomething(t *testing.T) {
t.Parallel()
db, err := c.NewInstance(t.Context())
if err != nil {
t.Fatal(err)
}
defer c.CloseInstance(t.Context(), db)
err = db.Connection.Ping(t.Context())
if err != nil {
t.Fatalf("failed to ping database: %v", err)
}
}
```