...
1# Tests
2
3## Running Tests
4
5`go test` is used for testing. A running PostgreSQL
6server is required, with the ability to log in. The
7database to connect to test with is "pqgotest," on
8"localhost" but these can be overridden using [environment
9variables](https://www.postgresql.org/docs/9.3/static/libpq-envars.html).
10
11Example:
12
13 PGHOST=/run/postgresql go test
14
15## Benchmarks
16
17A benchmark suite can be run as part of the tests:
18
19 go test -bench .
20
21## Example setup (Docker)
22
23Run a postgres container:
24
25```
26docker run --expose 5432:5432 postgres
27```
28
29Run tests:
30
31```
32PGHOST=localhost PGPORT=5432 PGUSER=postgres PGSSLMODE=disable PGDATABASE=postgres go test
33```
View as plain text