Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirakuru.exceptions.AlreadyRunning - When using xdist postgresql_proc_fixture's get_port may return the same port number #872

Open
dale-vendia opened this issue Jan 9, 2024 · 1 comment

Comments

@dale-vendia
Copy link

dale-vendia commented Jan 9, 2024

What action do you want to perform

Use this fixture with pytest xdist

What are the results

Around 50% of the time, tests would throw an error with mirakuru.exceptions.AlreadyRunning

What are the expected results

Ideal: Should use a port number / range based on the xdist worker id
Alternative solution: create a port range postgresql_my_proc = factories.postgresql_proc(port=random.randint(10000, 50000)) -- it is possible with this method that ports still conflict.

I am currently working through on how I would implement the ideal solution, currently working with the alternative approach

Why is this happening?

When concurrently executing session fixtures postgresql_proc_fixture's get_port may return the same port number. When the same port number is used the tests will (correctly) fail with a mirakuru.exceptions.AlreadyRunning.

@fizyk
Copy link
Member

fizyk commented Jan 10, 2024

@dale-vendia I think that's a good idea :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants