[erlang-questions] Struggling with ct_master and ssh

Sylvain Benner sylvain.benner@REDACTED
Fri Jul 19 04:56:06 CEST 2013

Dear community,

I am a developer working in the gaming industry and we have chosen Erlang
to develop an internal tool running on our private cloud platform.

I'm currently learning Common Test via the great LYSE book and I am not
able to make the distributed tests work.

The sample can be found in the source code archive of the book. It can
be downloaded on the cover page: http://learnyousomeerlang.com/
The sample is in the *ct* directory.

First I had to update the dist.spec file to make it understable on my
system (R16B01 esl distribution, Ubuntu 12.04 or 13.04, zsh) like this:

{node, a, 'a@REDACTED'}.
{node, b, 'b@REDACTED'}.

{init, [a,b], [{node_start, [{monitor_master, true}]}]}.

{alias, demo, "./demo/"}.
{alias, meeting, "./meeting/"}.

{logdir, master, "./logs/"}.
{logdir, all_nodes, "./logs/"}.

{suites, [b], meeting, all}.
{suites, [a], demo, all}.
{skip_cases, [a], demo, basic_SUITE, test2, "This test fails on purpose"}.

1) If I create manually the nodes a and b, the spec runs flawlessly.
2) If I don't than I've got boot_timeout errors:

(ct@REDACTED)13> ct_master:run("dist.spec").
=== Master Logdir ===
=== Master Logger process started ===
ssh password:
Failed to start node 'a@REDACTED' with callback ct_slave! Reason:
ssh password:
Failed to start node 'b@REDACTED' with callback ct_slave! Reason:
WARNING: Node 'a@REDACTED' is not alive but has eval option
WARNING: Node 'b@REDACTED' is not alive but has eval option

The following nodes are inaccessible: ['a@REDACTED',

Proceed(p), Rescan(r) or Abort(a)? [p/r/a]>a
** exception exit: aborted

I dug into ct_slave.erl and replicated the ssh commands of
spawn_remote_node/3 in a shell:

(testssh@REDACTED)5> {ok, SSHConnRef} =
ssh:connect("localhost.local", 22, []).
ssh password:
(testssh@REDACTED)6> {ok, SSHChannelId} =
ssh_connection:session_channel(SSHConnRef, infinity).
(testssh@REDACTED)7> net_adm:ping('node_from_ssh@REDACTED').
(testssh@REDACTED)8> ssh_connection:exec(SSHConnRef, SSHChannelId,
"erl -detached -noinput -name node_from_ssh@REDACTED", infinity).
(testssh@REDACTED)9> net_adm:ping('node_from_ssh@REDACTED').

It works.

Then I tried ssh_connection:setenv/5 and all I get is a failure so it may
be causing some trouble if ct_slave tries to set some environment variable
in ssh_setenv/3. I started to walk in OTP sources to find the message sent
to set an environment variable and at the same time I though it was time to
join the ML.

So here are the questions:

1) Do you have any idea about the ssh_connection:setenv failure ?
2) Do I need ct_master to test a protocol ? What is the erlang way for
testing protocols between 2 nodes ?
I have the feeling that ct_master is too much for what I need but I was
seduced by its set of possibilities and would like to use it to run my

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130718/3d606864/attachment.htm>

More information about the erlang-questions mailing list