testcontainers / testcontainers/testcontainers-java

[Feature]: Inverse of "GenericContainer.waitingFor()" to catch failing startup, avoid long wait

Open
#6,066 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/feature
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

Module

No response

Problem

I have a container that takes quite a while to start up successfully (with somewhat unpredictable time, requiring longish time out for positive signal), but can fail quickly; in both cases there are log lines that are reliable indicators.

But there is no way to check for negative indicators (in my case, log line stating Unable to start server. Exiting...), and as a result failure detection with timeout (failing to find positive signal) takes a very long time, due to necessity of using relatively long timeout for getting success signal.

Solution

It would be great to have an option for short-circuiting this by indicating failure condition(s): this could also be propagated as failure reason to calling code including transparency.

I realize that often testing for negative cases is fool's errand (there may well be countless ways for things to fail); but at least in my case there is one very common failure mode.

Note: it is not necessary to support all the options of waitingFor(): for me ability to match log entries would be sufficient.

Benefit

For use cases like mine there would be much faster runtime for cases where container startup can fail in a detectable way.

Alternatives

I do not TestContainers well enough to know if something like this might already exist (apologies if so; I did try to google for it), or if there is an alternative approach.

Would you like to help contributing this feature?

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GenericContainer.waitingFor() API and trace how its startup result reaches calling code. Determine the scope of a negative log-match condition and how its failure reason should be exposed; done means a documented, tested API that short-circuits on the reported startup failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.