Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md Unit Test section with instructions for testing with real DB #1706

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Loading