testcontainers / testcontainers/testcontainers-java
Mapped port polling on container startup causes race conditions with containers that terminate on startup
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 8.7k
- Forks
- 1.9k
- Merge moyen
- 2 j 17 h
- PR mergées (30 j)
- 9
Description
It appears that https://github.com/testcontainers/testcontainers-java/pull/4263 introduced some flakiness in a subset of our tests. In particular, we have a few tests that test failure conditions for a container. In those tests, we either override waitUntilContainerStarted to check for a special log message or use a OneShotStartupCheckStrategy to detect when the desired state has been achieved. However, after upgrading to a version of TestContainers that includes the PR above (in this case, from 1.15.3 to 1.17.1), we started occasionally getting failures like this:
...
Caused by: org.testcontainers.shaded.org.awaitility.core.ConditionTimeoutException: Lambda expression in org.testcontainers.containers.GenericContainer: expected the predicate to return <true> but it returned <false> for input of ...
at org.testcontainers.shaded.org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
at org.testcontainers.shaded.org.awaitility.core.AbstractHamcrestCondition.await(AbstractHamcrestCondition.java:86)
at org.testcontainers.shaded.org.awaitility.core.ConditionFactory.until(ConditionFactory.java:985)
at org.testcontainers.shaded.org.awaitility.core.ConditionFactory.until(ConditionFactory.java:691)
at org.testcontainers.shaded.org.awaitility.core.ConditionFactory.until(ConditionFactory.java:708)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:450)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:340)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:338)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:326)
...
My belief is that, when it fails, the container terminates in between polling attempts, causing the until block to never succeed.
My expectation would be that the block to detect mapped ports should not throw an exception in this case.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez dans GenericContainer.java, au niveau de tryStart, en utilisant la trace de la pile et l’interrogation des ports mappés introduite par PR 4263 comme points d’entrée. Reproduisez un test de condition d’échec avec OneShotStartupCheckStrategy ou un waitUntilContainerStarted redéfini, tandis que le conteneur se termine pendant l’interrogation. C’est terminé lorsque la gestion du démarrage n’expire plus uniquement parce que le conteneur se termine entre deux tentatives d’interrogation des ports mappés.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- docker, java
- Domaine
- testing
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100