Skip to content

DockerComposeEnvironment is missing getServicePort #1175

@nidomiro

Description

@nidomiro

The java version of DockerComposeEnvironment supports getServicePort, which can be used to retrieve dynamic port mappings.

In my usecase I want to start a Compose file with randomized exposed ports for test isolation, but the application under test should still be able to communicate with the services.

A workaround is to use this:

const pgContainer = startedComposeEnv.getContainer('postgres-1');
const pgPort = pgContainer.getMappedPort('5432/tcp')

Is the workaround I presented really a workaround, or did you explicitly decide not to do it the java way?

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