Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/testcontainers/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def read_tc_properties() -> dict[str, str]:
@dataclass
class TestcontainersConfiguration:
max_tries: int = int(environ.get("TC_MAX_TRIES", "120"))
sleep_time: int = int(environ.get("TC_POOLING_INTERVAL", "1"))
sleep_time: float = float(environ.get("TC_POOLING_INTERVAL", "1"))
ryuk_image: str = environ.get("RYUK_CONTAINER_IMAGE", "testcontainers/ryuk:0.8.1")
ryuk_privileged: bool = get_bool_env("TESTCONTAINERS_RYUK_PRIVILEGED")
ryuk_disabled: bool = get_bool_env("TESTCONTAINERS_RYUK_DISABLED")
Expand Down Expand Up @@ -130,7 +130,7 @@ def tc_properties_get_tc_host(self) -> Union[str, None]:
return self.tc_properties.get("tc.host")

@property
def timeout(self) -> int:
def timeout(self) -> float:
return self.max_tries * self.sleep_time

@property
Expand Down
6 changes: 3 additions & 3 deletions core/testcontainers/core/waiting_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ class WaitStrategy(ABC):
"""Base class for all wait strategies."""

def __init__(self) -> None:
self._startup_timeout: int = config.timeout
self._startup_timeout: float = config.timeout
self._poll_interval: float = config.sleep_time

def with_startup_timeout(self, timeout: Union[int, timedelta]) -> "WaitStrategy":
"""Set the maximum time to wait for the container to be ready."""
if isinstance(timeout, timedelta):
self._startup_timeout = int(timeout.total_seconds())
self._startup_timeout = float(int(timeout.total_seconds()))
else:
self._startup_timeout = timeout
self._startup_timeout = float(timeout)
return self

def with_poll_interval(self, interval: Union[float, timedelta]) -> "WaitStrategy":
Expand Down