File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed
modules/minio/testcontainers/minio Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change 1- from typing import TYPE_CHECKING
2-
3- from requests import ConnectionError , get
4-
51from minio import Minio
62from testcontainers .core .container import DockerContainer
73from testcontainers .core .utils import raise_for_deprecated_parameter
8- from testcontainers .core .waiting_utils import wait_container_is_ready
9-
10- if TYPE_CHECKING :
11- from requests import Response
4+ from testcontainers .core .wait_strategies import HttpWaitStrategy
125
136
147class MinioContainer (DockerContainer ):
@@ -98,17 +91,12 @@ def get_config(self) -> dict:
9891 "secret_key" : self .secret_key ,
9992 }
10093
101- @wait_container_is_ready (ConnectionError )
102- def _healthcheck (self ) -> None :
103- """This is an internal method used to check if the Minio container
104- is healthy and ready to receive requests."""
105- url = f"http://{ self .get_config ()['endpoint' ]} /minio/health/live"
106- response : Response = get (url )
107- response .raise_for_status ()
108-
10994 def start (self ) -> "MinioContainer" :
11095 """This method starts the Minio container and runs the healthcheck
11196 to verify that the container is ready to use."""
11297 super ().start ()
113- self ._healthcheck ()
98+ HttpWaitStrategy (
99+ port = self .port ,
100+ path = "/minio/health/live" ,
101+ ).wait_until_ready (self )
114102 return self
You can’t perform that action at this time.
0 commit comments