Skip to content

Provide a way to know if a reusable container is already started #909

@juliette-derancourt

Description

@juliette-derancourt

I would like to be able to know if a reusable container is already started before actually "starting" it.

Use case

I need to run some code right after the container has been started, and I could avoid running it once again when the container is being reused.

const container = new GenericContainer().withReuse()...

const startedContainer = container.start()

initializeStuffAfterContainerStart(startedContainer) // useless to run this if the container is already started

Proposal

Add a method isStarted() on TestContainer

const container = new GenericContainer().withReuse()...

const isAlreadyStarted = container.isStarted()
const startedContainer = container.start()

if (!isAlreadyStarted) {
  initializeStuffAfterContainerStart(startedContainer)
}

What do you think? Maybe there is yet another/better solution

I'm willing to work on a PR if needed

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