File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
modules/kafka/testcontainers/kafka Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import os .path
2+ import re
23import tarfile
34import time
45from io import BytesIO
56from textwrap import dedent
67
78from testcontainers .core .container import DockerContainer
8- from testcontainers .core .waiting_utils import wait_for_logs
9+ from testcontainers .core .wait_strategies import LogMessageWaitStrategy
910
1011
1112class RedpandaContainer (DockerContainer ):
@@ -34,6 +35,7 @@ def __init__(
3435 self .redpanda_port = 9092
3536 self .schema_registry_port = 8081
3637 self .with_exposed_ports (self .redpanda_port , self .schema_registry_port )
38+ self .wait_for : re .Pattern [str ] = re .compile (r".*Started Kafka API server.*" )
3739
3840 def get_bootstrap_server (self ) -> str :
3941 host = self .get_container_host_ip ()
@@ -70,7 +72,9 @@ def start(self, timeout=10) -> "RedpandaContainer":
7072 self .with_command (command )
7173 super ().start ()
7274 self .tc_start ()
73- wait_for_logs (self , r".*Started Kafka API server.*" , timeout = timeout )
75+ wait_strategy = LogMessageWaitStrategy (self .wait_for )
76+ wait_strategy .with_startup_timeout (timeout )
77+ wait_strategy .wait_until_ready (self )
7478 return self
7579
7680 def create_file (self , content : bytes , path : str ) -> None :
You can’t perform that action at this time.
0 commit comments