beardedeagle

beardedeagle

Starting multiple named nodes locally for ExUnit tests

My app is distributed using @bitwalker’s libcluster and swarm libraries. I’m currently trying to write tests for specific parts of my app that hook into these libraries and am unable to due to the fact that I need to have multiple named nodes spun up locally in order to even function. I’ve tried using the test code in distillery/libcluster/swarm as examples in order to pull this off but have been unsuccessful. Furthermore I’m not entirely sure if the node’s creation should be in the test_helper.ex or in the setup_all. I’ve tried putting Node.start()'s and :slave.start_link's to no avail. Additionally since my app uses Phoenix, I think I will need to have multiple endpoint configs for test? Any and all help, tips, examples is appreciated. Thank you.

Marked As Solved

beardedeagle

beardedeagle

Thanks for everyone’s help and suggestions. @bitwalker and I were able to get this running using the following cluster_case code: https://gist.github.com/beardedeagle/dc72f25fb561780f902d5dbf354a582d

Also Liked

chrismcg

chrismcg

You could look at what Phoenix itself does when testing PubSub:

alexcastano

alexcastano

You can see an example in https://github.com/ericentin/repg2

It has tests with another node. Maybe you can adapt it to your needs.

beardedeagle

beardedeagle

I’ve tried my hand at this using the clusters strategy that swarm and firenest employ, but to no avail:

https://gist.github.com/beardedeagle/df0e56622b564871b409057b89fd0745

mindreframer

mindreframer

Hey @beardedeagle, you should look into https://github.com/wooga/flock.

It might give you some hints how to do setup the tests.
Good luck!

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

We're in Beta

About us Mission Statement