mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
a3a33bd5fc
We need to be able to run only a few test groups, even if we do not have all database backends installed and configured locally. ejabberd test suite configures a specific host per backend. I changed ejabberd to allow ignoring some hosts from config file on start, by providing the exact list of hosts we want to start. This is done by setting an ejabberd app Erlang environment variable 'hosts' and passing the list of hosts we want to actually define. When doing so, the backend specific hosts defined in ejabberd test configuration file are simply ignored. As a result, we do not try to connect to unavailable backends. I linked that part to CT run test by defining the hosts list based on environment variable CT_BACKENDS. This variable is expected to be a comma separated list of available backends. When Erlang Common Tests are run with that environment variable set, only the host matching the name of the backend will be set, plus the default "localhost", common to many tests. This can be combined with rebar ct groups list. Example commands to run tests: CT_BACKENDS=riak,mnesia rebar ct suites=ejabberd CT_BACKENDS=mnesia rebar ct suites=ejabberd groups=mnesia |
||
---|---|---|
.. | ||
ejabberd_SUITE_data | ||
ejabberd_hooks_test.exs | ||
ejabberd_SUITE.erl | ||
elixir_SUITE.erl | ||
jid_test.exs | ||
ldap_srv.erl | ||
README | ||
suite.erl | ||
suite.hrl |
You need MySQL, PostgreSQL and Riak up and running. MySQL should be accepting TCP connections on localhost:3306. PostgreSQL should be accepting TCP connections on localhost:5432. Riak should be accepting TCP connections on localhost:8087. MySQL and PostgreSQL should grant full access to user 'ejabberd_test' with password 'ejabberd_test' on database 'ejabberd_test'. Riak should be configured with leveldb as a database backend and -pz should be pointed to the directory with ejabberd BEAM files. Here is a quick setup example: ------------------ PostgreSQL ------------------ $ psql template1 template1=# CREATE USER ejabberd_test WITH PASSWORD 'ejabberd_test'; template1=# CREATE DATABASE ejabberd_test; template1=# GRANT ALL PRIVILEGES ON DATABASE ejabberd_test TO ejabberd_test; ------------------- MySQL ------------------- $ mysql mysql> CREATE USER 'ejabberd_test'@'localhost' IDENTIFIED BY 'ejabberd_test'; mysql> CREATE DATABASE ejabberd_test; mysql> GRANT ALL ON ejabberd_test.* TO 'ejabberd_test'@'localhost'; ------------------- Riak ------------------- $ cat /etc/riak/vm.args ... ## Map/Reduce path -pz /path/to/ejabberd/ebin ... For version < 2.x: $ cat /etc/riak/app.config: ... {riak_kv, [ {storage_backend, riak_kv_eleveldb_backend}, ... For version >= 2.x: $ cat /etc/riak/riak.conf: ... storage_backend = leveldb ...