thin-edge.io icon indicating copy to clipboard operation
thin-edge.io copied to clipboard

Make mqtt server in tests non-global

Open matthiasbeyer opened this issue 1 year ago • 1 comments

Before this there was one in-process mqtt server used for running all tests. Tests had to be run in sequence because of this, adding up to a huge test time.

This PR makes each test have its own broker, on an individual port, to be able to run all tests in parallel.


Extracted from #1328


This might need some more tinkering, that's why I'm filing it as a draft for now.

matthiasbeyer avatar Aug 12 '22 08:08 matthiasbeyer

So the issue @didier-wenzek and @albinsuresh see here is that specifying a unique port number for every test is burdensome and could lead to unintentional errors when a dev accidentially specifies a port number twice.

I agree with that.

The obvious solution for that would be to let the kernel assign the port number. That is normally done by specifying 0 (zero) as port number when binding a process to a port. The kernel then assigns a random free port number.

That would easily work for our test cases.

Later in our tests, we would need that port number to execute tests against the process behind the port. Unfortunately, we cannot get the port number from rumqttd, as the library does not export the port of the running broker process.

So as soon as we replace rumqttd we won't have this issue anymore (given that the replacement exports the port number).

How to proceed?

matthiasbeyer avatar Aug 18 '22 06:08 matthiasbeyer

Closing as this raises issues while not being a priority

didier-wenzek avatar Nov 21 '22 17:11 didier-wenzek