embedded-postgres-binaries
dockertest
Our great sponsors
embedded-postgres-binaries | dockertest | |
---|---|---|
2 | 38 | |
67 | 3,195 | |
- | 1.5% | |
4.0 | 6.4 | |
20 days ago | 6 days ago | |
Shell | Go | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
embedded-postgres-binaries
-
When to Use Bazel?
Nice, this seems a lot simpler than I thought. Nice tip on embedded-postgres-binaries (https://github.com/zonkyio/embedded-postgres-binaries).
- Ephemeral Postgres Databases
dockertest
-
Different SQL drivers for test and production
Use a library like ory/dockertest to spin up a test database for integration tests. It's easy to use, and tests are still fast. It'll take a minute to download the mysql docker image the first time. But, once it's been downloaded, starting the db, running migrations, and running the tests is still pretty quick.
-
Is that a unit test a.k.a how do you test your API endpoints?
You can use a library like dockertest to spin up a real database instance for just testing the repository. Would be closer to an integration test but better than no tests.
- Do you test your API, repositories, & services together (e.g., e2e) or separately?
-
Libraries you use most of your projects?
https://github.com/ory/dockertest - test repo/provider layer against dockered database directly, alternatively i use https://github.com/kokizzu/goproc for database that are only single binary (eg. cockroachdb)
- How to mock database calls
-
Modern REST API with Go and PostgreSQL - Part 5: Containerized tests with Docker Compose
Also here, we are using https://github.com/ory/dockertest
Have you ever tried https://github.com/ory/dockertest? Library that lets you easily run a docker in your unit tests and manage it, perfect for this situation.
-
Mocking database queries - ask for opinion
I use github.com/ory/dockertest to setup the database in a Docker container when the tests run, so a simple go test . works perfectly no extra steps needed (besides having Docker running in the background, most CI/CD envs should have it already).
-
how to mock DBs
Also here i've used https://github.com/ory/dockertest in the past, so i'll give a check to the above one for sure.
Integration test: dockertest + testify mock/suite packages
What are some alternatives?
testcontainers-go - Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.
mockaroo - Mock-A-🦘 (mock-aa-roo) a comprehensive HTTP/HTTPS interface mocking tool for all your development and testing needs!
venom - 🐍 Manage and run your integration tests with efficiency - Venom run executors (script, HTTP Request, web, imap, etc... ) and assertions
sqlc - Generate type-safe code from SQL
steampipe - Use SQL to instantly query your cloud services (AWS, Azure, GCP and more). Open source CLI. No DB required.
go-mockgen-tool - Go/Golang mock generation for interfaces via code generation
Squirrel - Fluent SQL generation for golang
go-sqlmock - Sql mock driver for golang to test database interactions
pgx - PostgreSQL driver and toolkit for Go
fake-gcs-server - Google Cloud Storage emulator & testing library.
postgres-gcs-backup - Simple Docker image to backup a Postgres db, to a GCS bucket