0

I have a problem when trying Erlang testing module riak_test to simulate connections among remote nodes.
It is possible to connect remote nodes within a test to local nodes (deployed by rt:deploy_nodes) but it is impossible to call functions of rt module, especially to add interceptors for the remote nodes without error.
Is there some solution or method to intercept also remote nodes using Riak testing module?
I need to use interceptors on remote nodes to retrieve some information about Riak node states.

More specifically: riak@10.X.X.X is my remote referenced node.
In the test it is possible to connect this node to local devX@127.0.0.1 nodes deployed in the test but in my test program I have: rt_intercept:add(riak@10.X.X.X, {}) I get error:

{{badmatch,
     {badrpc,
         {'EXIT',
             {undef,
                 [{intercept,add,
                      [riak_kv_get_fsm,riak_kv_get_fsm_intercepts,
                       [{{waiting_vnode_r,2},waiting_vnode_r_tracing},
                        {client_info,3},client_info_tracing},
                        {execute,2},execute_preflist}]],
                      []},
                 {rpc,'-handle_call_call/6-fun-0-',5,
                     [{file,"rpc.erl"},{line,203}]}]}}}},
 [{rt_intercept,add,2,[{file,"src/rt_intercept.erl"},{line,57}]},
  {remoteRiak,'-confirm/0-lc$^2/1-2-',1,
      [{file,"tests/remoteRiak.erl"},{line,49}]},
  {remoteRiak,'-confirm/0-lc$^2/1-2-',1,
      [{file,"tests/remoteRiak.erl"},{line,49}]},
  {remoteRiak,confirm,0,[{file,"tests/remoteRiak.erl"},{line,49}]}]}  
Prophet
  • 32,350
  • 22
  • 54
  • 79
Zuzana
  • 132
  • 6

1 Answers1

1

the rt_intercept:add function is going to use rpc:call to run the intercept:add function in the target node's VM. This means that the target node must either have the intercept module loaded or in the code path. You can add a path using add_paths in the config for the target node.

Joe
  • 25,000
  • 3
  • 22
  • 44
  • Thank you, it worked. I have just one slight issue with remote nodes in Riak. I run out of ideas how to stop/start remote node from local test. If I use standard `rt:start('riak@10.X.X.X')` I get error message : `{function_clause,[{orddict,fetch,['riak@10.X.X.X'[{'dev2@127.0.0.1',2},...]],[file,"orddict.erl"}{line,413}]}]}` which I think (after studying rt source code) implies that the path for my remote node is not defined because I did not initiate it through rt:deploy_nodes as others and this function obviously does the mapping for the others. Any ideas how to overcome the issue? – Zuzana Jun 06 '14 at 10:58
  • The function clause message is indicating that the node name was changed after the ring file was created. The simplest fix is to remove the ring file (location define in the app config) and try again. – Joe Jun 06 '14 at 13:12
  • This is not the issue I am periodically deleting the ring file from the location otherwise the node would not join the network at the first place. I can setup connection to remote node when I start it locally from VM1 but I cannot stop/start it remotely from test in VM2 – Zuzana Jun 09 '14 at 10:09
  • the error message indicates that one of your nodes is named `dev2@127.0.0.1` you won't be able to do any remote communication through the localhost interface – Joe Jun 09 '14 at 11:48