-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more instructions for running tests (#750)
What === Add more instructions for running tests. Why === For those starting out and not familiar with how to get a PostgresSQL up and running for tests some examples would be helpful.
- Loading branch information
1 parent
0677bdd
commit 90697d6
Showing
2 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Tests | ||
|
||
## Running Tests | ||
|
||
`go test` is used for testing. A running PostgreSQL | ||
server is required, with the ability to log in. The | ||
database to connect to test with is "pqgotest," on | ||
"localhost" but these can be overridden using [environment | ||
variables](https://www.postgresql.org/docs/9.3/static/libpq-envars.html). | ||
|
||
Example: | ||
|
||
PGHOST=/run/postgresql go test | ||
|
||
## Benchmarks | ||
|
||
A benchmark suite can be run as part of the tests: | ||
|
||
go test -bench . | ||
|
||
## Example setup (Docker) | ||
|
||
Run a postgres container: | ||
|
||
``` | ||
docker run --expose 5432:5432 postgres | ||
``` | ||
|
||
Run tests: | ||
|
||
``` | ||
PGHOST=localhost PGPORT=5432 PGUSER=postgres PGSSLMODE=disable PGDATABASE=postgres go test | ||
``` |