如何等到 Kafka 容器启动
How to wait until Kafka container is started
我正在使用 https://www.testcontainers.org/modules/kafka/ 并且想要配置容器,以便在我的测试开始之前,确保 Kafka 已启动并且 运行。
如何存档?
Testcontainers 已经有 built-in 等待就绪:
https://www.testcontainers.org/features/startup_and_waits/
KafkaContainer
等到它正在监听 Kafka 的端口(和 ZooKeeper 的端口,如果你使用 build-in 端口),否则它不会启动。
我正在使用 https://www.testcontainers.org/modules/kafka/ 并且想要配置容器,以便在我的测试开始之前,确保 Kafka 已启动并且 运行。
如何存档?
Testcontainers 已经有 built-in 等待就绪: https://www.testcontainers.org/features/startup_and_waits/
KafkaContainer
等到它正在监听 Kafka 的端口(和 ZooKeeper 的端口,如果你使用 build-in 端口),否则它不会启动。