<div dir="ltr">Dear community,<div><br></div><div>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.</div><div><br></div><div style>
I'm currently learning Common Test via the great LYSE book and I am not able to make the distributed tests work.</div><div style><br></div><div style>The sample can be found in the source code archive of the book. It can be downloaded on the cover page: <a href="http://learnyousomeerlang.com/">http://learnyousomeerlang.com/</a></div>
<div style>The sample is in the *ct* directory.</div><div style><br></div><div style>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:</div>
<div style><br></div><div style>%% ------------------------------------------------------------------------------</div><div style><div>{node, a, 'a@localhost.local'}.</div><div>{node, b, 'b@localhost.local'}.</div>
<div><br></div><div>{init, [a,b], [{node_start, [{monitor_master, true}]}]}.</div><div><br></div><div>{alias, demo, "./demo/"}.</div><div>{alias, meeting, "./meeting/"}.</div><div><br></div><div>{logdir, master, "./logs/"}.</div>
<div>{logdir, all_nodes, "./logs/"}.</div><div><br></div><div>{suites, [b], meeting, all}.</div><div>{suites, [a], demo, all}.</div><div>{skip_cases, [a], demo, basic_SUITE, test2, "This test fails on purpose"}.</div>
<div>%% ------------------------------------------------------------------------------<br></div><div><br></div><div style>1) If I create manually the nodes a and b, the spec runs flawlessly.</div><div style>2) If I don't than I've got boot_timeout errors:</div>
<div style><br></div><div style>%% ------------------------------------------------------------------------------<br></div><div style><div>(ct@localhost)13> ct_master:run("dist.spec").</div><div>=== Master Logdir ===</div>
<div>/home/sylvain/Downloads/learn-you-some-erlang/ct/logs</div><div>=== Master Logger process started ===</div><div><0.284.0></div><div>ssh password: </div><div>Failed to start node 'a@localhost.local' with callback ct_slave! Reason: boot_timeout</div>
<div>ssh password: </div><div>Failed to start node 'b@localhost.local' with callback ct_slave! Reason: boot_timeout</div><div>WARNING: Node 'a@localhost.local' is not alive but has eval option</div><div>WARNING: Node 'b@localhost.local' is not alive but has eval option</div>
<div><br></div><div>The following nodes are inaccessible: ['a@localhost.local',</div><div> 'b@localhost.local']</div><div><br></div><div>Proceed(p), Rescan(r) or Abort(a)? [p/r/a]>a</div>
<div>** exception exit: aborted</div><div>%% ------------------------------------------------------------------------------<br></div></div><div style><br></div><div style>I dug into ct_slave.erl and replicated the ssh commands of spawn_remote_node/3 in a shell:</div>
<div style><br></div><div style>%% ------------------------------------------------------------------------------<br></div><div style><div>(testssh@localhost.local)5> {ok, SSHConnRef} = ssh:connect("localhost.local", 22, []).<br>
</div><div>ssh password: </div><div>{ok,<0.60.0>}</div><div>(testssh@localhost.local)6> {ok, SSHChannelId} = ssh_connection:session_channel(SSHConnRef, infinity).</div><div>{ok,0}</div><div>(testssh@localhost.local)7> net_adm:ping('node_from_ssh@localhost.local').</div>
<div>pang</div><div>(testssh@localhost.local)8> ssh_connection:exec(SSHConnRef, SSHChannelId, "erl -detached -noinput -name node_from_ssh@localhost.local", infinity).</div><div>success</div><div>(testssh@localhost.local)9> net_adm:ping('node_from_ssh@localhost.local').</div>
<div>pong </div><div>%% ------------------------------------------------------------------------------<br></div></div><div style><br></div><div style>It works.</div>
<div style><br></div><div style>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.</div>
<div style><br></div><div style>So here are the questions:</div><div style><br></div><div style>1) Do you have any idea about the ssh_connection:setenv failure ?</div><div style>2) Do I need ct_master to test a protocol ? What is the erlang way for testing protocols between 2 nodes ? <br>
</div><div style>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 suites.</div><div style><br></div><div style>Cheers,</div></div>
<div style>syl20bnr<br></div></div>