esl / escalus

An XMPP client library in Erlang for conveniently testing XMPP servers
Apache License 2.0
129 stars 76 forks source link

Log more detailed error in escalus_fresh:clean #180

Closed arcusfelis closed 6 years ago

arcusfelis commented 6 years ago

Because this is not enough info

----------------------------------------------------
2018-06-06 20:00:46.940
end_per_suite
{failed,{{badmatch,false},
         [{escalus_fresh,clean,0,
                         [{file,"/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_fresh.erl"},
                          {line,107}]},
          {amp_big_SUITE,end_per_suite,1,
                         [{file,"amp_big_SUITE.erl"},{line,109}]},
          {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1533}]},
          {test_server,run_test_case_eval1,6,
                       [{file,"test_server.erl"},{line,1138}]},
          {test_server,run_test_case_eval,9,
                       [{file,"test_server.erl"},{line,985}]}]}}
michalwski commented 6 years ago

I'd like to see this change in action with MongooseIM tests. Could you created a PR in MongooseIM repo?

arcusfelis commented 6 years ago

@michalwski https://travis-ci.org/arcusfelis/MongooseIM/builds/389011093

arcusfelis commented 6 years ago

at least it works. There is no error printing triggered in this travis job.

arcusfelis commented 6 years ago

@michalwski It prints something like

----------------------------------------------------                                 
error 2018-06-07 12:01:56.394                                                        
issue=pmap_failed reason=error:{badrpc,                                              
                                {'EXIT',                                             
                                 {haha2,                                             
                                  [{ejabberd_auth,remove_user,2,                     
                                    [{file,                                          
                                      "/home/user/erlang/esl/2017/MongooseIM/_build/mim1/lib/mongooseim/src/ejabberd_auth.erl"},
                                     {line,553}]},                                   
                                   {ejabberd_admin,unregister,2,                     
                                    [{file,                                          
                                      "/home/user/erlang/esl/2017/MongooseIM/_build/mim1/lib/mongooseim/src/ejabberd_admin.erl"},
                                     {line,331}]},                                   
                                   {rpc,'-handle_call_call/6-fun-0-',5,              
                                    [{file,"rpc.erl"},{line,197}]}]}}}               
 stacktrace=[{escalus_rpc,call_with_cookie_match,                                    
                          [mongooseim@localhost,ejabberd_admin,unregister,           
                           [<<"alicE16.272590">>,<<"localhost">>],                   
                           3000,ejabberd],                                           
                          [{file,"/home/user/erlang/esl/2017/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_rpc.erl"},
                           {line,34}]},                                              
             {lists,foreach,2,[{file,"lists.erl"},{line,1338}]},                     
             {escalus_ejabberd,delete_users,2,                                       
                               [{file,"/home/user/erlang/esl/2017/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_ejabberd.erl"},
                                {line,217}]},                                        
             {escalus_fresh,delete_users,1,                                          
                            [{file,"/home/user/erlang/esl/2017/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_fresh.erl"},
                             {line,118}]},                                           
             {escalus_fresh,'-worker/3-fun-0-',4,                                    
                            [{file,"/home/user/erlang/esl/2017/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_fresh.erl"},
                             {line,163}]}]  

if I modify ejabberd_auth

index 54eed1db9..4acea372e 100644                                
--- a/src/ejabberd_auth.erl     
+++ b/src/ejabberd_auth.erl     
@@ -550,6 +550,7 @@ does_user_exist_in_other_modules_loop([AuthModule|AuthModules], User, Server) ->                              
 -spec remove_user(User :: jid:user(),                           
                   Server :: jid:server()) -> ok | error | {error, not_allowed}.                                                  
 remove_user(User, Server) ->   
+    error(haha2),              
     LUser = jid:nodeprep(User),                                 
     LServer = jid:nameprep(Server),                             
     do_remove_user(LUser, LServer).