SUSE/BCI-tests

Use random port binding for creating 389ds container

jlausuch opened this issue · 3 comments

Since we are using always the same port when launching a 390ds container using
extra_launch_args=["-p", "3389:3389"],
https://github.com/SUSE/BCI-tests/blob/main/bci_tester/data.py#L318
The tests that are using this container fail with

Bind for 0.0.0.0:3389 failed: port is already allocated.

It would be better to create some random number for the host side.

A ugly solution would be

port = random.randint(3000, 4000) # or whatever range that fits better
extra_launch_args=["-p", port+":3389"],

with proper syntax, ofc...

The container is marked as a singleton (

singleton=True,
), so in theory, pytest_container should only ever launch a single instance of this container image.

It would be better to create some random number for the host side.

That will make testing super ugly, because the 389ds test runs an ldapquery from the host on the 389ds container and you'd therefore need to know the port…

ok, then something is wrong with singleton..