Skip to content

[Bug]: lack of control over hook processing #2663

@stevenh

Description

@stevenh

Testcontainers version

0.32.0

Using the latest Testcontainers version?

Yes

Host OS

N/A

Host arch

N/A

Go version

N/A

Docker version

N/A

Docker info

N/A

What happened?

When writing a container module developers can easily assume that hooks are processed in the order given and that if a failure occurs this will prevent subsequent hooks being called however this is not the case.

When hooks are added depending on pre or post they are order differently and depending on the type of the hook some fail fast and some execute all which is confusing to the user.

We need to look at the way these are handled and either ensure its clearer or provide control such as fatal error processing or always failing fast.

As an example of this the kafka module has two PostStarts hooks, the first sets up the container config the second waits for it to be ready. Unfortunately if the copy fails the wait is still run, meaning its a long time till the user gets the result which is a timeout.

#2653 is related to this.

Relevant log output

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue with the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions