From d942e6ce53719b429ee64d2ddb72599278e05eba Mon Sep 17 00:00:00 2001 From: elraphty Date: Tue, 18 Jun 2024 22:17:21 +0100 Subject: [PATCH] update README.md to run test with real DB --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index d71db6f29..9318fa30a 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,12 @@ Add `STAKWORK_KEY` for YouTube video downloads. Run unit tests with coverage: +- Have Docker installed on your machine +- Run Docker +- Spin up a Postgres DB container before the test with this command + `docker compose -f docker/testdb-docker-compose.yml -p test_db up -d` +- Change the rdHost `rdsHost := "172.17.0.1"` variable value in `db/test_config.go` to your `127.0.0.1` + ```sh // you may need to install cover with this command first go get golang.org/x/tools/cmd/cover @@ -116,6 +122,10 @@ Run unit tests with coverage: go tool cover -html="coverage.out" ``` +- Drop the Postgres DB container after the test with this command + `docker compose -f docker/testdb-docker-compose.yml -p test_db down` +- Change the rdHost variable value in `db/test_config.go` to the default value for github workflow `rdsHost := "172.17.0.1"` + ### Mocking Interfaces Use [mockery](https://vektra.github.io/mockery/latest/) for interface mocking.