Skip to content

Commit

Permalink
3/4 tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderankin committed Mar 9, 2024
1 parent cd90aa7 commit af2907e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/opensearch/testcontainers/opensearch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from testcontainers.core.container import DockerContainer
from testcontainers.core.utils import raise_for_deprecated_parameter
from testcontainers.core.waiting_utils import wait_container_is_ready
from testcontainers.core.waiting_utils import wait_container_is_ready, wait_for_logs


class OpenSearchContainer(DockerContainer):
Expand Down Expand Up @@ -90,16 +90,18 @@ def get_client(self, verify_certs: bool = False, **kwargs) -> OpenSearch:
**kwargs,
)

'''
@wait_container_is_ready(ConnectionError, TransportError, ProtocolError, ConnectionResetError)
def _healthcheck(self) -> None:
"""This is an internal method used to check if the OpenSearch container
is healthy and ready to receive requests."""
client: OpenSearchContainer = self.get_client()
client.cluster.health(wait_for_status="green")
'''

def start(self) -> "OpenSearchContainer":
"""This method starts the OpenSearch container and runs the healthcheck
to verify that the container is ready to use."""
super().start()
self._healthcheck()
wait_for_logs(self, "Node started")
return self

0 comments on commit af2907e

Please sign in to comment.