Expected Behaviour
I would expect that
const postgresContainer = await new PostgreSqlContainer()
.withReuse()
.withExposedPorts({
container: 5432,
host: 54321,
})
.start()
leads to postgresContainer.getPort() to always return 54321
Actual Behaviour
postgresContainer.getPort() actually returns a randomly allocated port each time.
The automatic setting of an available port is nice, but it would be great if the withExposedPorts example given here actually worked as advertised for the postgres container. Yes, it's not recommended, but it can still be useful if you want to inspect your database at a known port after a failed test.
Expected Behaviour
I would expect that
leads to
postgresContainer.getPort()to always return 54321Actual Behaviour
postgresContainer.getPort()actually returns a randomly allocated port each time.The automatic setting of an available port is nice, but it would be great if the
withExposedPortsexample given here actually worked as advertised for the postgres container. Yes, it's not recommended, but it can still be useful if you want to inspect your database at a known port after a failed test.