testcontainers / testcontainers/testcontainers-python

Bug: `testcontainers.core.waiting_utils.wait_for_logs` keeps waiting despite the container has exited.

未关闭
#681 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
2.3k
派生
386
平均合并
4 小时 40 分钟
30 天内合并 PR
1

描述

Describe the bug

The testcontainers.core.waiting_utils.wait_for_logs keeps waiting despite the container has exited. This can be confusing if there is a long wait time.

To Reproduce

from testcontainers.core import container, waiting_utils

if __name__ == "__main__":
    waiting_utils.wait_for_logs(
        container.DockerContainer("flyway/flyway").start(),
        r"Successfully applied \d+ migrations to schema",
        timeout=large_n, # 
    )

# >> Raised Exception has occurred: TimeoutError Container did not emit logs satisfying predicate in `large_n` seconds

Runtime environment

Python:         3.11.9
testcontainers  4.7.2
Implementation: CPython

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 testcontainers.core.waiting_utils 中的 wait_for_logs 开始,检查在等待匹配的日志时如何检查 DockerContainer 的状态。使用 flyway/flyway 重现该示例,并确定容器在 predicate 匹配之前退出时的预期行为。当容器退出后等待不再持续到 timeout 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, python
领域
devops, testing-qa
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。