From cbcb1f61f3dcb46adf7bb9b1a3d247d86f6c00b7 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Tue, 20 Nov 2018 10:14:26 +0100 Subject: [PATCH] dev-integration-tests: update database steps (just use docker) Signed-off-by: Stephan Renatus --- Documentation/dev-integration-tests.md | 39 +++++++++----------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/Documentation/dev-integration-tests.md b/Documentation/dev-integration-tests.md index a9ce1ad3..7e8e6683 100644 --- a/Documentation/dev-integration-tests.md +++ b/Documentation/dev-integration-tests.md @@ -18,39 +18,28 @@ $ ./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 +- 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. - -``` -$ # 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 -``` +- clean up the postgres container: `docker rm -f dex-postgres` ## LDAP