Configurable ports for the objects and states DBs of the integration tests - #735
Configurable ports for the objects and states DBs of the integration tests#735krobipd wants to merge 3 commits into
Conversation
Two adapter test runs on one machine collide on the fixed ports 19001/19000:
the second run's databases never come up (measured with two installed test
controllers side by side). The integration tests now accept
`ports: { objects, states }`, fall back to the environment variables
IOBROKER_TESTING_OBJECTS_PORT / IOBROKER_TESTING_STATES_PORT and then to the
previous defaults, and hand the ports to the DB connection and to the
controller's system config. Both DBs must use different ports; an invalid
value fails early with a clear message. Defaults are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
NOTE: Such an option MUST NOT be used with workflow based tests at github as this would cause the external check to fail. As github uses seperated serves such a collision cannot occure in standard testing environment. |
…og line The ioBroker repochecker expects this exact line in the adapter-tests job log (W3053), so it stays verbatim; the chosen ports are logged on a separate line. The README describes the ports option in its own paragraph for parallel runs on one machine and says to leave it unset in workflow-based tests on GitHub. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…rmat) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Thanks, and you are right in a stronger sense than the note says: the PR also changed the debug line "Moving databases to different ports...", which is one of the lines the repochecker expects in the adapter-tests job log, so every adapter would have hit W3053 after a release. Fixed: the original line is back verbatim, the chosen ports are logged on a separate line, and the README now describes the option in its own paragraph for parallel runs on one machine, with the note that it is not to be set in workflow-based tests. GitHub jobs keep the defaults. |
Why
Two adapter test runs on the same machine collide: both start their objects and states DBs on the fixed ports 19001/19000, and the second run's databases never come up. That hits anyone who runs the integration tests of two adapters in parallel — two terminals, or two CI jobs on one self-hosted runner. A leftover run blocking the next one (#488) is the same fixed pair of ports from the other side.
Measured with two installed test controllers side by side: one
DBConnectionon the defaults comes up, a second one on the defaults does not (times out), a second one on 29001/29000 comes up next to the first — four listeners on 127.0.0.1.What
tests.integration(adapterDir, { ports: { objects, states } }).IOBROKER_TESTING_OBJECTS_PORT/IOBROKER_TESTING_STATES_PORT(the option wins), then to the previous defaults 19001/19000 — nothing changes for existing users.DBConnection(server and client settings) and toControllerSetup.setupSystemConfig()(the controller'siobroker.json), so the adapter under test reaches the same DBs.testAdapter()time with a message naming the option or variable.Moving databases to different ports...stays verbatim (the repochecker expects it in the adapter-tests job log); the chosen ports are logged on a separate line.WORK IN PROGRESS) updated;build/rebuilt as in the other feature commits.Tests
src/tests/integration/lib/ports.test.ts— defaults, environment, option over environment, partial option, empty variable, invalid values, equal ports.src/tests/integration/lib/controllerSetup.test.ts— the given ports (and the defaults) land in the system config, the rest of the config stays untouched,DBConnectioncarries its ports.npm run check,npm run lint,npm test(51 passing),npm run build— all green.🤖 Generated with Claude Code