[erlang-questions] How to mimic Erlang nodes in PropEr statem test

Nyirő Gergő gergo.nyiro@REDACTED
Wed Jan 23 22:08:05 CET 2019

On Wed, Jan 23, 2019 at 6:52 PM Fred Hebert <mononcqc@REDACTED> wrote:
> On 01/22, Nyirő Gergő wrote:
> >nice until I have a single process to communicate with, but I want to
> >cut my program
> >into multiple processes, but I don't know how should I register the
> >processes to avoid
> >pid passing and run multiple process group on the same VM.
> You already name all three processes according to if they were node
> names. Can you be a bit more specific about what you intend to do?

Right now I have only one gen_server (crdt_server) per node, but I would
like to add an event handler (crdt_event) which could persist the content
of the crdt set or log the executed commands.

Since I just started to learn Erlang I have very limited ideas in
design choices,
that's why I'm looking for some advice. The following ideas came to my mind:

crdt_event could be registered with a fix name then all the
crdt_server processes
in the proper statem test will send the events to the same event handler, so
the event has to be extended with a reference to the sender (e.g: the name
or pid of the crdt_server). It seems too complicated for my situation.

Other solution would be to pass the NameOrPid of the crdt_event processes to
crdt_server processes, but a process registry could be a more elegant solution.

Should I use ct_property_test [1] instead?

p.s: Thanks for the fast feedback.

  [1]: http://erlang.org/doc/man/ct_property_test.html

More information about the erlang-questions mailing list