Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Merge branch 'master' into extend-get-feature-view-2
  • Loading branch information
tokoko authored Sep 6, 2024
commit f55ff4b7aec9fd439f99d6b306ed785e92ce9fa5
Original file line number Diff line number Diff line change
Expand Up @@ -121,64 +121,16 @@ def minio_registry(minio_server):
logger = logging.getLogger(__name__)


@pytest.fixture(scope="session")
def pg_registry():
container = (
DockerContainer("postgres:latest")
.with_exposed_ports(5432)
.with_env("POSTGRES_USER", POSTGRES_USER)
.with_env("POSTGRES_PASSWORD", POSTGRES_PASSWORD)
.with_env("POSTGRES_DB", POSTGRES_DB)
)
@pytest.fixture(scope="function")
def pg_registry(postgres_server):
db_name = "".join(random.choices(string.ascii_lowercase, k=10))

_create_pg_database(postgres_server, db_name)

container_port = postgres_server.get_exposed_port(5432)
container_host = postgres_server.get_container_host_ip()

yield SqlRegistry(registry_config, "project", None)

container.stop()


@pytest.fixture(scope="session")
def pg_registry_async():
container = (
DockerContainer("postgres:latest")
.with_exposed_ports(5432)
.with_env("POSTGRES_USER", POSTGRES_USER)
.with_env("POSTGRES_PASSWORD", POSTGRES_PASSWORD)
.with_env("POSTGRES_DB", POSTGRES_DB)
)

container.start()

registry_config = _given_registry_config_for_pg_sql(container, 2, "thread", 3)

yield SqlRegistry(registry_config, "project", None)

container.stop()


def _given_registry_config_for_pg_sql(
container,
cache_ttl_seconds=2,
cache_mode="sync",
thread_pool_executor_worker_count=0,
purge_feast_metadata=False,
):
log_string_to_wait_for = "database system is ready to accept connections"
waited = wait_for_logs(
container=container,
predicate=log_string_to_wait_for,
timeout=30,
interval=10,
)
logger.info("Waited for %s seconds until postgres container was up", waited)
container_port = container.get_exposed_port(5432)
container_host = container.get_container_host_ip()

return SqlRegistryConfig(
registry_config = SqlRegistryConfig(
registry_type="sql",
cache_ttl_seconds=2,
cache_mode="sync",
Expand All @@ -190,21 +142,12 @@ def _given_registry_config_for_pg_sql(
purge_feast_metadata=False,
)


@pytest.fixture(scope="session")
def mysql_registry():
container = MySqlContainer("mysql:latest")
container.start()

registry_config = _given_registry_config_for_mysql(container)

yield SqlRegistry(registry_config, "project", None)


@pytest.fixture(scope="session")
def mysql_registry_async():
container = MySqlContainer("mysql:latest")
container.start()
@pytest.fixture(scope="function")
def pg_registry_async(postgres_server):
db_name = "".join(random.choices(string.ascii_lowercase, k=10))

_create_pg_database(postgres_server, db_name)

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.