2016-10-23 20:28:28 +05:30
|
|
|
# Running integration tests
|
|
|
|
|
|
|
|
## Kubernetes
|
|
|
|
|
|
|
|
Kubernetes tests will only run if the `DEX_KUBECONFIG` environment variable is set.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ export DEX_KUBECONFIG=~/.kube/config
|
|
|
|
$ go test -v -i ./storage/kubernetes
|
|
|
|
$ go test -v ./storage/kubernetes
|
|
|
|
```
|
|
|
|
|
|
|
|
Because third party resources creation isn't synchronized it's expected that the tests fail the first time. Fear not, and just run them again.
|
|
|
|
|
|
|
|
## Postgres
|
2016-09-23 11:53:56 +05:30
|
|
|
|
|
|
|
Running database tests locally require:
|
|
|
|
|
|
|
|
* A systemd based Linux distro.
|
|
|
|
* A recent version of [rkt](https://github.com/coreos/rkt) installed.
|
|
|
|
|
2016-10-23 20:28:28 +05:30
|
|
|
The `standup.sh` script in the SQL directory is used to run databases in containers with systemd daemonizing the process.
|
2016-09-23 11:53:56 +05:30
|
|
|
|
|
|
|
```
|
|
|
|
$ sudo ./storage/sql/standup.sh create postgres
|
|
|
|
Starting postgres. To view progress run
|
|
|
|
|
|
|
|
journalctl -fu dex-postgres
|
|
|
|
|
|
|
|
Running as unit dex-postgres.service.
|
|
|
|
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
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2016-10-23 20:28:28 +05:30
|
|
|
Exporting the variables will cause the database tests to be run, rather than skipped.
|
2016-09-23 11:53:56 +05:30
|
|
|
|
|
|
|
```
|
2016-10-23 20:28:28 +05:30
|
|
|
$ # sqlite3 takes forever to compile, be sure to install test dependencies
|
2016-09-23 11:53:56 +05:30
|
|
|
$ 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
|
|
|
|
```
|