[ejabberd] Pb when launching the ejabberd common tests

titetluc titetluc titetluc at gmail.com
Fri Jan 6 11:14:01 MSK 2017


Hi all (and happy new year)

NB: I tried to post the question in the forum https://www.ejabberd.im/forum/
forums/ejabberd-xmpp/ejabberd-development but unsuccessfully (server error)

I am a newbie in Erlang and XMPP (!!!). Hope my question is not out of
scope.

I want to develop an experimental XMPP module, using Test-driven
development.
To do so, I prepared my dev. environment, creating a machine embedding
ejabberd (see https://github.com/processone/ejabberd-vagrant-dev)
Next, I launched the ejabberd common tests
$make test
=> SUCCESS
All is correct (although some tests failed). An html report is generated

Tests took more than 2 hours to be run.
I decided to launched only some specific tests (using ct_run tool)

1. test_auth (from group "no_db")

$ ct_run -smp -step config -pa /home/step pcloud/ejabberd/ebin  <snipped>
-include /home/pcloud/ejabberd/include <snipped> -logdir
/home/pcloud/ejabberd/logs -env TEST_DIR /home/pcloud/ejabberd/test
-ct_hooks cth_surefire -suite test/ejabberd_SUITE.erl  -group no_db -case
test_auth
=> SUCCESS
The test is run correctly

2. mam_feature_enabled (from group "[mnesia,mam_single]")
$ ct_run -smp -step config -pa /home/step pcloud/ejabberd/ebin  <snipped>
-include /home/pcloud/ejabberd/include <snipped> -logdir
/home/pcloud/ejabberd/logs -env TEST_DIR /home/pcloud/ejabberd/test
-ct_hooks cth_surefire -suite test/ejabberd_SUITE.erl -group
[mnesia,mam_single] -case mam_feature_enabled
=> FAILURE
The test failed

> <snipped>
>- - - - - - - - - - - - - - - - - - - - - - - - - -
>mam_tests:feature_enabled failed on line 41
>Reason: {badmatch,false}
>- - - - - - - - - - - - - - - - - - - - - - - - - -
>
>Testing pcloud.ejabberd.ejabberd_SUITE.groups.mam_feature_enabled: ***
FAILED test case 1 of 1 ***

The reason: the user is registered in the "localhost" vhost but this vhost
does not support mam!!!

I have to patch the test, inverting call to "set_opt(server, ?MNESIA_VHOST,
Config)" so that user is registered in the "mnesia.localhost" vhost

$ git diff test/ejabberd_SUITE.erl
diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl
index 5939bf9..e3a9952 100644
--- a/test/ejabberd_SUITE.erl
+++ b/test/ejabberd_SUITE.erl
@@ -86,17 +86,30 @@ do_init_per_group(no_db, Config) ->
     re_register(Config),
     set_opt(persistent_room, false, Config);
 do_init_per_group(mnesia, Config) ->
+    Config2=set_opt(server, ?MNESIA_VHOST, Config),
+%%    Config2=Config,
+    re_register(Config2),
     mod_muc:shutdown_rooms(?MNESIA_VHOST),
-    set_opt(server, ?MNESIA_VHOST, Config);
+%%    set_opt(server, ?MNESIA_VHOST, Config2),
+    Config2;
 do_init_per_group(redis, Config) ->

MY QUESTION: do I misuse the test environment or is there a bug in the
ejabberd tests?
In other words, do the tests run (when all tests are launched) correctly by
side-effect

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20170106/0869ff20/attachment.html>


More information about the ejabberd mailing list