-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Being able to fix the Postgres listening port property with DevServices #16768
Comments
Not sure what the good way would be here. With contionous testing you wouldn’t want random ports as otherwise there would be conflicts. So it would only be the first one that would be “fixed”. |
I'm more interested in having a fix port in |
@stuartwdouglas I don't know if you have seen this one but I think it makes a lot of sense? If you agree it does, I can work on it. |
Because we are using testcontainers this is not as simple as it sounds, even though it makes sense, as testcontainers always picks a random port. I think the best you could do is open a socket on the 'fixed' port, and just use it to manually port forward to the underlying instance. We may end up needing to do our own stuff rather than continuing to use testcontainers, another use case I have that they don't support is persistent containers, where you create a container with a specific name (based on the project and datasource), leave it running and just re-connect to it if it is already started. |
Looks like you probably could do it if you override the configure() method in PostgreSQLContainer and add a call to addFixedExposedPort. |
Fixes quarkusio#16768 (cherry picked from commit ba938ce)
Fixes quarkusio#16768 (cherry picked from commit ba938ce)
Description
When you use DevServices in Dev and Test mode to startup a Postgres database, the listening port is random and you get a different one each time you startup or execute the tests (eg.
localhost:55046/default
,localhost:55048/default
, etc.). But in development mode, it's sometimes useful to access the database. And to get the port, you need to check the Dev UI to know this random port.Having a random port in test, is fine, but in dev it would be nice to have to fix the port number (using a property).
The text was updated successfully, but these errors were encountered: