File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
modules/clickhouse/testcontainers/clickhouse Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 1212# under the License.
1313import os
1414from typing import Optional
15- from urllib .error import HTTPError , URLError
16- from urllib .request import urlopen
1715
1816from testcontainers .core .generic import DbContainer
1917from testcontainers .core .utils import raise_for_deprecated_parameter
20- from testcontainers .core .waiting_utils import wait_container_is_ready
18+ from testcontainers .core .wait_strategies import HttpWaitStrategy
2119
2220
2321class ClickHouseContainer (DbContainer ):
@@ -58,12 +56,9 @@ def __init__(
5856 self .with_exposed_ports (self .port )
5957 self .with_exposed_ports (8123 )
6058
61- @wait_container_is_ready (HTTPError , URLError )
6259 def _connect (self ) -> None :
63- # noinspection HttpUrlsUsage
64- url = f"http://{ self .get_container_host_ip ()} :{ self .get_exposed_port (8123 )} "
65- with urlopen (url ) as r :
66- assert b"Ok" in r .read ()
60+ strategy = HttpWaitStrategy (8123 ).for_response_predicate (lambda response : "Ok" in response )
61+ strategy .wait_until_ready (self )
6762
6863 def _configure (self ) -> None :
6964 self .with_env ("CLICKHOUSE_USER" , self .username )
You can’t perform that action at this time.
0 commit comments