24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00
xmpp.chapril.org-ejabberd/test/docker/README.md
Stu Tomlinson b173ca2fd0 Fix docker DB initialization
The docker local copies of DB initialization scripts were out of sync
with the master copies. Instead of updating local copies, adjust docker
compose to reference master copies directly.

Also change docker config to use docker volumes instead of mounted
directories for all DB data.
2020-09-25 18:13:35 +01:00

57 lines
1.5 KiB
Markdown

# Docker database images to run ejabberd tests
## Starting databases
You can start the Docker environment with Docker Compose, from ejabberd repository root.
The following command will launch MySQL, MSSQL, PostgreSQL, Redis and keep the console
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.
## 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
```
## Running tests
Before running the test, you can ensure there is no running instance of Erlang common test tool. You can run the following
command, especially if all test are skipped with an `eaddrinuse` error:
```
pkill -9 ct_run
```
You can run tests with (from ejabberd repository root):
```
make test
```
## Cleaning up the test environment
You can fully clean up the environment with:
```
(cd test/docker; docker-compose down)
```
If you want to clean the data, you can remove the data volumes after the `docker-compose down` command:
```
docker volume rm ejabberd-mysqldata
docker volume rm ejabberd-mssqldata
docker volume rm ejabberd-pgsqldata
```