Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
Why not just use a generic container for this?
If using DockerContaine("trinodb/trino:latest"), the get_exposed_port with @wait_container_is_ready() will be stuck until 120s timeout.
The Trino docker image does not default expose the port. We need to bind the port explicitly.
And it should check .*======== SERVER STARTED ========.* and execute a statement to trigger the node register like below.
@wait_container_is_ready()
def _connect(self) -> None:
wait_for_logs(
self,
re.compile(".*======== SERVER STARTED ========.*", re.MULTILINE).search,
c.max_tries,
c.sleep_time,
)
conn = connect(
host=self.get_container_host_ip(),
port=self.get_exposed_port(self.port),
user="test",
)
cur = conn.cursor()
cur.execute("SELECT 1")
cur.fetchall()
conn.close()
What is the new container you'd like to have? Trino Official website: https://trino.io Github: https://github.com/trinodb/trino Docker hub: https://hub.docker.com/r/trinodb/trino
Why not just use a generic container for this? If using
DockerContaine("trinodb/trino:latest")
, theget_exposed_port
with@wait_container_is_ready()
will be stuck until 120s timeout.The Trino docker image does not default expose the port. We need to bind the port explicitly.
And it should check
.*======== SERVER STARTED ========.*
and execute a statement to trigger the node register like below.Other references: Follow https://github.com/testcontainers/testcontainers-python/pull/152
I already created a
TrinoContainer
in project wren-engine. If you agreed, I can add a pull request to implement this issue.