import uuid import pytest from _openmetadata_testutils.postgres.conftest import postgres_container # noqa: F401 from metadata.generated.schema.api.services.createDatabaseService import ( CreateDatabaseServiceRequest, ) from metadata.generated.schema.entity.services.connections.database.common.basicAuth import ( BasicAuth, ) from metadata.generated.schema.entity.services.connections.database.postgresConnection import ( PostgresConnection, ) from metadata.generated.schema.entity.services.databaseService import ( DatabaseConnection, DatabaseServiceType, ) @pytest.fixture(scope="module") def create_service_request(postgres_container): # noqa: F811 return CreateDatabaseServiceRequest( name=f"docker_test_postgres_{uuid.uuid4().hex[:8]}", serviceType=DatabaseServiceType.Postgres, connection=DatabaseConnection( config=PostgresConnection( username=postgres_container.username, authType=BasicAuth(password=postgres_container.password), hostPort="localhost:" + str(postgres_container.get_exposed_port(postgres_container.port)), database="dvdrental", ) ), )