ex_unit_clustered_case icon indicating copy to clipboard operation
ex_unit_clustered_case copied to clipboard

Allow clustered_node to load config files other than `test.exs`

Open Ajwah opened this issue 6 years ago • 0 comments

First and foremost - @bitwalker, you are amazing. Thank you so much for this library, I love it!

This request pertains to the static call as mentioned here. I believe it would be better if Mix.env(_) is invoked with a parameter that the user of the library can supply.

My motivation for this is two fold:

  1. Currently a clustered node will spin up with both the configuration supplied as mentioned over here as well as whatever is contained inside config\test.exs. This leads to clutter as the primary node that is running the test may require additional configuration that is not applicable to any of the clustered nodes that are being spun up.

  2. Currently I need to supply node configuration according to the format as mentioned here. Specifying an entire structure with different nodes each with different config can be rather verbose to specify in the testing module as module attributes. This may work for some people, but others like me may find this a rather cluttering experience. It would be nice if instead I could coin a lot of different files under config\*.exs and supply just the name as an option, e.g.: Instead of having to do something like this One could suffice on stating:

[
  boot_timeout: 10_000,
  nodes: [
    [
      name: :"[email protected]",
      config: :test03
      ]
    ],
    [
      name: :"[email protected]",
      config: :test04
    ]
  ]
]

where :test03 and :test04 will be used to invoke Mix.env(_) as applicable here in your code base, which will cause config/test03.exs to get loaded accordingly.

Not everyone will like this way of organizing their code and such developers may resort to the current way of specifying node options, either in their current testing modules as module attributes or directly inline to the various scenarios or through some support modules they invoke according their needs.

I am mainly requesting for an additional way and if this is something you feel makes sense, then I would not mind taking a stab of putting out a PR as a proof of concept.

Ajwah avatar Jul 29 '19 05:07 Ajwah