Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.
Closed
Changes from 2 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
34 changes: 31 additions & 3 deletions ibis-server/tests/routers/v3/connector/oracle/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pathlib
import time

import pandas as pd
import pytest
import sqlalchemy
from sqlalchemy import text
from sqlalchemy import NullPool, text
from testcontainers.oracle import OracleDbContainer

from app.config import get_config
Expand All @@ -24,11 +25,38 @@ def pytest_collection_modifyitems(items):
item.add_marker(pytestmark)


@pytest.fixture(scope="module")
@pytest.fixture(scope="session")
def oracle(request) -> OracleDbContainer:
oracle = OracleDbContainer(
"gvenzl/oracle-free:23.6-slim-faststart", oracle_password=f"{oracle_password}"
).start()

max_retries = 30
retry_interval = 10
engine = None

for i in range(max_retries):
try:
engine = sqlalchemy.create_engine(
oracle.get_connection_url(),
poolclass=NullPool,
pool_pre_ping=True,
)
with engine.connect() as conn:
result = conn.execute(text("SELECT 1"))
result.fetchone()
break
except Exception:
if i == max_retries - 1:
oracle.stop()
raise TimeoutError(
f"Oracle container failed to start after {max_retries * retry_interval}s"
)
time.sleep(retry_interval)
finally:
if engine:
engine.dispose()

orders_schema = {
"o_orderkey": sqlalchemy.Integer(),
"o_custkey": sqlalchemy.Integer(),
Expand All @@ -50,7 +78,7 @@ def oracle(request) -> OracleDbContainer:
"c_mktsegment": sqlalchemy.Text(),
"c_comment": sqlalchemy.Text(),
}
engine = sqlalchemy.create_engine(oracle.get_connection_url())
engine = sqlalchemy.create_engine(oracle.get_connection_url(), poolclass=NullPool)
with engine.begin() as conn:
# assign dtype to avoid to create CLOB column for text columns
pd.read_parquet(file_path("resource/tpch/data/orders.parquet")).to_sql(
Expand Down
Loading