diff --git a/modules/postgres/testcontainers/postgres/__init__.py b/modules/postgres/testcontainers/postgres/__init__.py index bde21d5b3..c85e8c8de 100644 --- a/modules/postgres/testcontainers/postgres/__init__.py +++ b/modules/postgres/testcontainers/postgres/__init__.py @@ -64,6 +64,11 @@ def __init__( self.driver = f"+{driver}" if driver else "" self.with_exposed_ports(self.port) + self.waiting_for( + LogMessageWaitStrategy( + 'database system is ready to accept connections').with_startup_timeout(10) + ) + def _configure(self) -> None: self.with_env("POSTGRES_USER", self.username) @@ -87,7 +92,6 @@ def get_connection_url(self, host: Optional[str] = None, driver: Optional[str] = port=self.port, ) - @wait_container_is_ready() def _connect(self) -> None: escaped_single_password = self.password.replace("'", "'\"'\"'") result = self.exec(