dev-integration-tests: update database steps (just use docker)

Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
Stephan Renatus 2018-11-20 10:14:26 +01:00
parent 1d0568efe9
commit cbcb1f61f3
No known key found for this signature in database
GPG Key ID: 811376EBA81C2C59

View File

@ -18,27 +18,20 @@ $ ./scripts/test-k8s.sh
## Postgres
Running database tests locally require:
Running database tests locally requires:
* A systemd based Linux distro.
* A recent version of [rkt](https://github.com/coreos/rkt) installed.
* Docker
The `standup.sh` script in the SQL directory is used to run databases in containers with systemd daemonizing the process.
To run the database integration tests:
```
$ sudo ./storage/sql/standup.sh create postgres
Starting postgres. To view progress run
- start a postgres container:
journalctl -fu dex-postgres
`docker run --name dex-postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=dex -p 5432:5432 -d postgres:11`
- export the required environment variables:
Running as unit dex-postgres.service.
To run tests export the following environment variables:
`export DEX_POSTGRES_DATABASE=dex DEX_POSTGRES_USER=postgres DEX_POSTGRES_PASSWORD=postgres DEX_POSTGRES_HOST=127.0.0.1:5432`
export DEX_POSTGRES_DATABASE=postgres; export DEX_POSTGRES_USER=postgres; export DEX_POSTGRES_PASSWORD=postgres; export DEX_POSTGRES_HOST=172.16.28.3:5432
```
Exporting the variables will cause the database tests to be run, rather than skipped.
- run the storage/sql tests:
```
$ # sqlite3 takes forever to compile, be sure to install test dependencies
@ -46,11 +39,7 @@ $ go test -v -i ./storage/sql
$ go test -v ./storage/sql
```
When you're done, tear down the unit using the `standup.sh` script.
```
$ sudo ./storage/sql/standup.sh destroy postgres
```
- clean up the postgres container: `docker rm -f dex-postgres`
## LDAP