erlangcommon-test

Erlang common test global registered names


I'm using the common test framework to do some RPC testing for a cowboy based service.

The service relies on an application that I am hosting on another node. In the application code I connect to that node.

In common test: ct:print(default, 50, "~p", [nodes()]). Returns [mynode@localhost]

but ct:print(default, 50, "~p", [global:registered_named()]). returns []

I followed the steps listed here Globally registered process is not registered

but that doesn't seem to have any effect. If I start a shell, manually connect, list nodes, and then execute my remote function everything works fine. Is there something unique to common test that would prevent this from working? Does the remote node have to be managed by the common test framework?


Solution

  • It takes some time until global sees all names on all nodes. Did you try waiting a while after net_adm:ping or whatever you use to connect the nodes?

    If you rely on global names visible you probably should wait for them by polling global for its registered names until everything you need is visible.

    It probably works on the shell because you are slower than a running test case.