I need to use erlang cassandra client(https://github.com/iamaleksey/seestar) in my ejabberd server for message logging purpose.But I can run seestar client separately.But if I include seestar files into ejabberd src folder, I ran into function_clause error.This error tells no gen_server's call function found.Please suggest some solution?
The error when I debug the code is :
(ejabberd@localhost)1> seestar_session_tests:session_test_().
{foreach,#Fun<seestar_session_tests.0.112079720>,
#Fun<seestar_session_tests.1.112079720>,
[#Fun<seestar_session_tests.2.112079720>,
#Fun<seestar_session_tests.3.112079720>,
#Fun<seestar_session_tests.4.112079720>,
#Fun<seestar_session_tests.5.112079720>]}
(ejabberd@localhost)2> seestar_session_tests:test_schema_queries(0.112079720).
** exception exit: {{function_clause,[{gen,call,
[0.11207972,'$gen_call',
{request,7,
<<0,0,0,95,67,82,69,65,84,69,32,75,69,89,83,80,...>>,
true},
infinity],
[{file,"gen.erl"},{line,146}]},
{gen_server,call,3,[{file,"gen_server.erl"},{line,184}]},
{seestar_session,request,3,
[{file,"seestar_session.erl"},{line,209}]},
{seestar_session,perform,3,
[{file,"seestar_session.erl"},{line,156}]},
{seestar_session_tests,test_schema_queries,1,
[{file,"seestar_session_tests.erl"},{line,33}]},
{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,576}]},
{shell,exprs,7,[{file,"shell.erl"},{line,668}]},
{shell,eval_exprs,7,[{file,"shell.erl"},{line,623}]}]},
{gen_server,call,
[0.11207972,
{request,7,
<<0,0,0,95,67,82,69,65,84,69,32,75,69,89,83,80,65,67,69,
...>>,
true},
infinity]}}
in function gen_server:call/3 (gen_server.erl, line 188)
in call from seestar_session:request/3 (seestar_session.erl, line 209)
in call from seestar_session:perform/3 (seestar_session.erl, line 156)
in call from seestar_session_tests:test_schema_queries/1 (seestar_session_tests.erl, line 33)
You're not supposed to call the functions in seestar_session_tests
directly, but through the Eunit library. Try this instead:
eunit:test(seestar_session_tests, [verbose]).
(The exact cause of the error above is that seestar_session_tests:test_schema_queries
expects a pid, which the test framework would give it, but you invoke it with a floating point number.)
The Eunit tests can also be invoked from the commond line through Rebar. Change to the seestar
directory and run rebar eunit
.