2019-05-07 17:59:05 +02:00
|
|
|
# Docker database images to run ejabberd tests
|
|
|
|
|
2019-07-18 17:14:20 +02:00
|
|
|
## Starting databases
|
|
|
|
|
2019-05-07 17:59:05 +02:00
|
|
|
You can start the Docker environment with Docker Compose, from ejabberd repository root.
|
|
|
|
|
2020-04-28 16:22:42 +02:00
|
|
|
The following command will launch MySQL, MSSQL, PostgreSQL, Redis and keep the console
|
2019-05-07 17:59:05 +02:00
|
|
|
attached to it.
|
|
|
|
|
|
|
|
```
|
|
|
|
mkdir test/docker/db/mysql/data
|
|
|
|
mkdir test/docker/db/postgres/data
|
|
|
|
(cd test/docker; docker-compose up)
|
|
|
|
```
|
|
|
|
|
|
|
|
You can stop all the databases with CTRL-C.
|
|
|
|
|
2020-04-28 16:22:42 +02:00
|
|
|
## Creating database for MSSQL
|
|
|
|
|
|
|
|
The following commands will create the necessary login, user and database, will grant rights on the database in MSSQL and create the ejabberd schema:
|
|
|
|
|
|
|
|
```
|
|
|
|
docker exec ejabberd-mssql /opt/mssql-tools/bin/sqlcmd -U SA -P ejabberd_Test1 -S localhost -i /initdb_mssql.sql
|
|
|
|
docker exec ejabberd-mssql /opt/mssql-tools/bin/sqlcmd -U SA -P ejabberd_Test1 -S localhost -i /mssql.sql
|
|
|
|
```
|
|
|
|
|
2019-07-18 17:14:20 +02:00
|
|
|
## Running tests
|
|
|
|
|
2019-07-18 18:31:12 +02:00
|
|
|
Before running the test, you can ensure there is no running instance of Erlang common test tool. You can run the following
|
2019-07-18 17:24:13 +02:00
|
|
|
command, especially if all test are skipped with an `eaddrinuse` error:
|
|
|
|
|
|
|
|
```
|
|
|
|
pkill -9 ct_run
|
|
|
|
```
|
|
|
|
|
2019-07-18 17:14:20 +02:00
|
|
|
You can run tests with (from ejabberd repository root):
|
|
|
|
|
|
|
|
```
|
|
|
|
make test
|
|
|
|
```
|
|
|
|
|
|
|
|
## Cleaning up the test environment
|
|
|
|
|
2019-05-07 17:59:05 +02:00
|
|
|
You can fully clean up the environment with:
|
|
|
|
|
|
|
|
```
|
|
|
|
(cd test/docker; docker-compose down)
|
|
|
|
```
|
|
|
|
|
2020-09-25 19:13:35 +02:00
|
|
|
If you want to clean the data, you can remove the data volumes after the `docker-compose down` command:
|
2019-05-07 17:59:05 +02:00
|
|
|
|
2019-05-24 10:31:51 +02:00
|
|
|
```
|
2020-09-25 19:13:35 +02:00
|
|
|
docker volume rm ejabberd-mysqldata
|
|
|
|
docker volume rm ejabberd-mssqldata
|
|
|
|
docker volume rm ejabberd-pgsqldata
|
2019-07-18 17:05:50 +02:00
|
|
|
```
|