Skip to content

withExposedPorts not working on postgres container #987

@romandecker

Description

@romandecker

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions