testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

[Bug]: lack of control over hook processing

Open stevenh opened this issue 1 year ago • 0 comments

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.

https://github.com/testcontainers/testcontainers-go/pull/2653 is related to this.

Relevant log output

No response

Additional information

No response

stevenh avatar Jul 20 '24 16:07 stevenh