Skip to content

Fail fast in Startables#deepStart #2249

@findepi

Description

@findepi

Consider code:

Startables.deepStart(asList(slowContainer, anotherSlowContainer, containerQuicklyFailingToStart)).get();

the call should fail fast.

currently (in v 1.12.4) it hangs:

2020-01-14T11:02:57.501+0100	INFO	testcontainers-lifecycle-2	🐳 [my_image]	Creating container for image: my_image
2020-01-14T11:02:57.501+0100	INFO	testcontainers-lifecycle-1	🐳 [my_image]	Creating container for image: my_image
2020-01-14T11:02:57.501+0100	INFO	testcontainers-lifecycle-0	🐳 [my_image]	Creating container for image: my_image
2020-01-14T11:02:58.379+0100	INFO	testcontainers-lifecycle-0	🐳 [my_image]	Starting container with ID: 153b43060fba728912683e389f98516fefb10ec3df1bbba8e52d4be8827764aa
2020-01-14T11:02:58.380+0100	INFO	testcontainers-lifecycle-1	🐳 [my_image]	Starting container with ID: 7de43b8c95356a1f5ec9531c94cd80348740ecdaf7e4b48913bd9a453e430867
2020-01-14T11:02:58.387+0100	INFO	testcontainers-lifecycle-2	🐳 [my_image]	Starting container with ID: f7c1b31465749aad2777dc9c05f458ee5762b8e72c2bd3ce9d3d3fec1304f417
....
2020-01-14T11:02:59.968+0100	ERROR	testcontainers-lifecycle-1	🐳 [my_image]	Could not start container
java.lang.IllegalStateException: Container did not start correctly.
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:423)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:317)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:315)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:302)
	at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:705)
	at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:687)
	at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)


2020-01-14T11:03:00.002+0100	ERROR	testcontainers-lifecycle-1	🐳 [my_image]	Log output from the failed container:
+ false
....
(startup continues)

Note: I'm using #2227 (comment)
as a workaround for #2225).
Apparently, with builtin wait strategy the stacktrace might not get printed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions