Bug: HealthcheckWaitStrategy returns error with DockerCompose
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- docker-compose, python
- Ambito
- devops, testing-qa
Direzione di ricerca
Leggi testcontainers/compose/compose.py intorno a start e testcontainers/core/wait_strategies.py intorno a HealthcheckWaitStrategy.wait_until_ready. Riproduci l’esempio Docker Compose fornito ed esamina i test esistenti delle strategie di attesa. Il lavoro è completato quando l’attesa dell’healthcheck di DockerCompose non accede più a un attributo ComposeContainer non supportato e il test di regressione passa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
When applying a 'waiting_for' to a DockerCompose object with a HealthcheckWaitStrategy, it returns an AttributeError: “ComposeContainer” object has no attribute “attrs”.
To Reproduce
import os
from testcontainers.compose import DockerCompose
from testcontainers.core.wait_strategies import HealthcheckWaitStrategy
BASE_DIR = os.path.dirname(__file__)
compose = DockerCompose(context=BASE_DIR, compose_file_name = "docker-compose.yml")
compose.waiting_for({"web": HealthcheckWaitStrategy().with_startup_timeout(60)})
compose.start()
docker-compose.yml:
version: '3.8'
services:
web:
image: nginx
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
Traceback:
Traceback (most recent call last):
File "<path>/test.py", line 9, in <module>
compose.start()
File "testcontainers/compose/compose.py", line 303, in start
strategy.wait_until_ready(container)
File "testcontainers/core/wait_strategies.py", line 487, in wait_until_ready
health = wrapped.attrs.get("State", {}).get("Health", {})
^^^^^^^^^^^^^
AttributeError: 'ComposeContainer' object has no attribute 'attrs'
Runtime environment
$ uname -a
Linux kali 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 3.12.1
$ poetry show | grep testcontainers
testcontainers 4.13.2
- Lingua principale
- Python
- Stelle
- 2.3k
- Fork
- 386
- Merge medio
- 4h 40m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di testcontainers/testcontainers-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
testcontainers/testcontainers-python#1115 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Updating the documentation Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
testcontainers/testcontainers-python#1086 · 1 commento ·
-
Bug: [minio] _healthcheck calls for nested wait_container_is_ready resulting in long wait time Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
testcontainers/testcontainers-python#578 · 5 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
Tutte le issue di testcontainers/testcontainers-python
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·