[erlang-questions] Cluster Functional test using Slave Nodes

marcos quesada marcos.quesadas@REDACTED
Wed Jul 30 11:53:16 CEST 2014


Hi there! 

 I'm developing some kind of cluster (toy project), and writing a functional tests using slave:start it's being more dificult than expected... It's just a test where some nodes are started and joinned between them, so that,cluster creation can be asserted.

   I'm getting crazy trying to find an explanation to an unexpected behavior, that is, starting first node (using make start), and then executing manually cluster_test:cluster_formation() the whole tests works fine. The same test integrated in the app test suite, executed as make quicktests, fails responding timeout: 
...
   module 'cluster_test'
      cluster_test: cluster_formation_suite_test_...*timed out*
      undefined
   [done in 5.001 s]

Configuration files between those configurations are identical, when running make start, cluster app is first started, so when i run make quicktests setup step takes care to start up cluster app.

 I don't understand why slave:start is failing returning a timeout error, it has been hard to solve step by step some minor config errors, so, when finally slaves where working fine executing the test manually i was expecting to complete that functional test suite...

 Any clue will be great , thanks!!


Makefile:

start:
	@$(ERL) -config releases/dev/dev1/etc/app.config -args_file releases/dev/dev1/etc/vm.args \
	-pa $PWD apps/*/ebin deps/*/ebin -rsh ssh -boot start_sasl -s cluster

quicktests:
	rm -rf apps/cluster/.eunit/
	ERL_FLAGS="-args_file apps/cluster/test/conf/vm.eunit.args -config apps/cluster/test/conf/app.eunit.config -pa $PWD apps/*/ebin deps/*/ebin -rsh ssh" \
	./rebar skip_deps=true compile eunit --verbose


cluster_test.erl :

...
cluster_formation_suite_test_() ->
    {
        foreach,
        fun setup/0,
        fun teardown/1,
        [
            fun cluster_formation/0
        ]
    }.

setup() ->
    application:ensure_all_started(cluster, permanent),
    %% Go outside eunit folder /home/marcos/code/cluster/apps/cluster/.eunit
    c:cd('../../../'),

    ok.

teardown(_) ->
    application:stop(cluster),
    ok.

cluster_formation() ->
    ?ioLog("Pwd is ~p Cookie ~p node ~p ~n", [c:pwd(), erlang:get_cookie(), node()]),

    Host = '127.0.0.1',
    Args = " -pa apps/*/ebin deps/*/ebin -setcookie secret -rsh ssh",
    {ok, Slave1} =  slave:start(Host, slave1, Args),
    {ok, Slave2} = slave:start(Host, slave2, Args),
    ?assertEqual([], c:pwd()),

    rpc:call(Slave1, application ,ensure_all_started,[cluster,permanent]),
    rpc:call(Slave2, application ,ensure_all_started,[cluster,permanent]),

    ?assertEqual(pong, net_adm:ping(Slave1)),
    ?assertEqual(pong, net_adm:ping(Slave2)),

    ?assertEqual(Slave1, 'slave1@REDACTED'),
    ?assertEqual(Slave2, 'slave2@REDACTED'),

    Result1 = rpc:call(Slave1, cluster, join,[node()]),
    ?assertEqual(ok, Result1),
    Result2 = rpc:call(Slave2, cluster, join,[node()]),
    ?assertEqual(ok, Result2),

    ?assertEqual(
        ['node1@REDACTED','slave1@REDACTED','slave2@REDACTED'],
        cluster:status()
    ),
    slave:stop(Slave1),
    slave:stop(Slave2).

-- 
You received this message because you are subscribed to the Google Groups "Erlang Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erlang-programming+unsubscribe@REDACTED
To post to this group, send email to erlang-programming@REDACTED
Visit this group at http://groups.google.com/group/erlang-programming.
For more options, visit https://groups.google.com/d/optout.



More information about the erlang-questions mailing list