Skip to content

Commit 5b1ac8c

Browse files
committed
fix(trino): add delay time to avoid Trino issue
1 parent 82a2e7b commit 5b1ac8c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/trino/testcontainers/trino/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# License for the specific language governing permissions and limitations
1212
# under the License.
1313
import re
14+
import time
1415

1516
from testcontainers.core.config import testcontainers_config as c
1617
from testcontainers.core.generic import DbContainer
@@ -24,12 +25,14 @@ def __init__(
2425
image="trinodb/trino:latest",
2526
user: str = "test",
2627
port: int = 8080,
28+
delay: int = 5,
2729
**kwargs,
2830
):
2931
super().__init__(image=image, **kwargs)
3032
self.user = user
3133
self.port = port
3234
self.with_exposed_ports(self.port)
35+
self.delay = delay
3336

3437
@wait_container_is_ready()
3538
def _connect(self) -> None:
@@ -39,6 +42,8 @@ def _connect(self) -> None:
3942
c.max_tries,
4043
c.sleep_time,
4144
)
45+
# To avoid `TrinoQueryError(type=INTERNAL_ERROR, name=GENERIC_INTERNAL_ERROR, message="nodes is empty")`
46+
time.sleep(self.delay)
4247
conn = connect(
4348
host=self.get_container_host_ip(),
4449
port=self.get_exposed_port(self.port),

0 commit comments

Comments
 (0)