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,39 +18,28 @@ $ ./scripts/test-k8s.sh
## Postgres ## Postgres
Running database tests locally require: Running database tests locally requires:
* A systemd based Linux distro. * Docker
* A recent version of [rkt](https://github.com/coreos/rkt) installed.
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:
``` - start a postgres container:
$ sudo ./storage/sql/standup.sh create postgres
Starting postgres. To view progress run
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. `export DEX_POSTGRES_DATABASE=dex DEX_POSTGRES_USER=postgres DEX_POSTGRES_PASSWORD=postgres DEX_POSTGRES_HOST=127.0.0.1:5432`
To run tests export the following environment variables:
export DEX_POSTGRES_DATABASE=postgres; export DEX_POSTGRES_USER=postgres; export DEX_POSTGRES_PASSWORD=postgres; export DEX_POSTGRES_HOST=172.16.28.3:5432 - run the storage/sql tests:
``` ```
$ # sqlite3 takes forever to compile, be sure to install test dependencies
$ go test -v -i ./storage/sql
$ go test -v ./storage/sql
```
Exporting the variables will cause the database tests to be run, rather than skipped. - clean up the postgres container: `docker rm -f dex-postgres`
```
$ # sqlite3 takes forever to compile, be sure to install test dependencies
$ 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
```
## LDAP ## LDAP