Skip to content

Commit ce75c12

Browse files
szachovyCopilot
andcommitted
Raise TimeoutError in wait_until_healthy() on timeout
Replace silent string return with TimeoutError that includes container name, elapsed time, and logs. Deployment now fails fast with a clear root cause instead of cascading silently into downstream failures. Closes #52 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit ce75c12

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97)
1717
* Pull-first with local build fallback for container images during deployment. (#97)
1818

19+
### Fixed
20+
21+
* wait_until_healthy() raises TimeoutError instead of returning a string on timeout. (#52)
22+
1923
### Changed
2024

2125
* Completed [ARCHITECTURE.md](./docs/ARCHITECTURE.md) (#93)

src/container.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ def wait_until_healthy(self, cls: typing.Type[ContainerInstance]) -> str:
205205
if self.client.containers.get(self.container).attrs["State"]["Health"]["Status"] == "healthy":
206206
return f"{self.get_logs()}\nContainer {self.container} is healthy"
207207
time.sleep(cls.healthcheck_interval)
208-
return f"{self.get_logs()}\nTimeout while waiting for {self.container} healthcheck to be healthy"
208+
elapsed = cls.healthcheck_start_period + cls.healthcheck_retries * cls.healthcheck_interval
209+
raise TimeoutError(
210+
f"{self.get_logs()}\nContainer {self.container} not healthy after {elapsed}s"
211+
)
209212

210213
def run_mysql_server(self) -> None:
211214
class MySQLServer(ContainerInstance):

0 commit comments

Comments
 (0)