diff --git a/ingestion/setup.py b/ingestion/setup.py index 334514a26144..059bf00d60fc 100644 --- a/ingestion/setup.py +++ b/ingestion/setup.py @@ -533,6 +533,7 @@ VERSIONS["starrocks"], *plugins["vertica"], "testcontainers~=4.8.0", + # S3 client for the S3Proxy-backed object-storage test containers "minio==7.2.5", *plugins["mlflow"], "skops", # mlflow 3.14 switched the mlflow.sklearn serialization default to skops, which mlflow-skinny does not pull in diff --git a/ingestion/tests/integration/auto_classification/containers/conftest.py b/ingestion/tests/integration/auto_classification/containers/conftest.py index e1ee5899b8bb..628f63fc9941 100644 --- a/ingestion/tests/integration/auto_classification/containers/conftest.py +++ b/ingestion/tests/integration/auto_classification/containers/conftest.py @@ -8,7 +8,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""MinIO and S3 container classification test fixtures""" +"""S3 container classification test fixtures""" import csv import io @@ -50,7 +50,7 @@ from metadata.workflow.classification import AutoClassificationWorkflow from metadata.workflow.metadata import MetadataWorkflow -from ...containers import MinioContainerConfigs, get_minio_container # noqa: TID252 +from ...containers import S3ContainerConfigs, get_s3_container # noqa: TID252 @pytest.fixture(scope="module") @@ -60,7 +60,7 @@ def metadata(): @pytest.fixture(scope="module") def service_name(): - return f"s3_container_classification_{uuid.uuid4().hex[:8]}" + return f"s3_classification_{uuid.uuid4().hex[:8]}" @pytest.fixture(scope="module") @@ -70,7 +70,7 @@ def bucket_name(): @pytest.fixture(scope="module", autouse=True) def mock_cloudwatch(): - """Mock CloudWatch client since MinIO doesn't support it""" + """Mock CloudWatch client: the S3 test container has no CloudWatch API""" from metadata.clients.aws_client import AWSClient original_get_client = AWSClient.get_client @@ -88,15 +88,14 @@ def get_client_override(self, service_name): @pytest.fixture(scope="module") -def minio(bucket_name): - config = MinioContainerConfigs(container_name=f"minio_{uuid.uuid4().hex[:8]}") - minio_container = get_minio_container(config) - minio_container.with_exposed_ports(9000, 9001) +def s3(bucket_name): + config = S3ContainerConfigs(container_name=f"s3proxy_{uuid.uuid4().hex[:8]}") + s3_container = get_s3_container(config) - with minio_container: - minio_client = minio_container.get_client() - minio_client.make_bucket(bucket_name) - yield minio_container, minio_client + with s3_container: + s3_client = s3_container.get_client() + s3_client.make_bucket(bucket_name) + yield s3_container, s3_client @pytest.fixture(scope="module") @@ -239,11 +238,11 @@ def pii_employees_parquet(): @pytest.fixture(scope="module") -def upload_test_data(minio, bucket_name, pii_customers_csv, non_pii_orders_csv, pii_employees_parquet): - """Upload test data files to MinIO""" - _, minio_client = minio +def upload_test_data(s3, bucket_name, pii_customers_csv, non_pii_orders_csv, pii_employees_parquet): + """Upload test data files to the S3 container""" + _, s3_client = s3 - minio_client.put_object( + s3_client.put_object( bucket_name, "customers/data.csv", io.BytesIO(pii_customers_csv), @@ -251,7 +250,7 @@ def upload_test_data(minio, bucket_name, pii_customers_csv, non_pii_orders_csv, content_type="text/csv", ) - minio_client.put_object( + s3_client.put_object( bucket_name, "orders/data.csv", io.BytesIO(non_pii_orders_csv), @@ -259,7 +258,7 @@ def upload_test_data(minio, bucket_name, pii_customers_csv, non_pii_orders_csv, content_type="text/csv", ) - minio_client.put_object( + s3_client.put_object( bucket_name, "employees/data.parquet", io.BytesIO(pii_employees_parquet), @@ -286,7 +285,7 @@ def upload_test_data(minio, bucket_name, pii_customers_csv, non_pii_orders_csv, ] } metadata_json = json.dumps(metadata_config).encode("utf-8") - minio_client.put_object( + s3_client.put_object( bucket_name, OPENMETADATA_TEMPLATE_FILE_NAME, io.BytesIO(metadata_json), @@ -296,14 +295,14 @@ def upload_test_data(minio, bucket_name, pii_customers_csv, non_pii_orders_csv, yield - for obj in minio_client.list_objects(bucket_name): - minio_client.remove_object(bucket_name, obj.object_name) + for obj in s3_client.list_objects(bucket_name): + s3_client.remove_object(bucket_name, obj.object_name) @pytest.fixture(scope="module") -def storage_service_config(minio, service_name, bucket_name): - """Storage service configuration for S3/MinIO""" - minio_container, _ = minio +def storage_service_config(s3, service_name, bucket_name): + """Storage service configuration for S3""" + s3_container, _ = s3 return { "source": { "type": "s3", @@ -312,10 +311,10 @@ def storage_service_config(minio, service_name, bucket_name): "config": { "type": "S3", "awsConfig": { - "awsAccessKeyId": minio_container.access_key, - "awsSecretAccessKey": minio_container.secret_key, + "awsAccessKeyId": s3_container.access_key, + "awsSecretAccessKey": s3_container.secret_key, "awsRegion": "us-east-1", - "endPointURL": f"http://localhost:{minio_container.get_exposed_port(9000)}", + "endPointURL": f"http://localhost:{s3_container.get_exposed_port(9000)}", }, "bucketNames": [bucket_name], } @@ -541,8 +540,8 @@ def non_sensitive_pii_tag( @pytest.fixture(scope="module") -def autoclassification_config(storage_service_config, bot_workflow_config, bucket_name, service_name, minio): - minio_container, _ = minio +def autoclassification_config(storage_service_config, bot_workflow_config, bucket_name, service_name, s3): + s3_container, _ = s3 return { "source": { "type": "s3", @@ -551,10 +550,10 @@ def autoclassification_config(storage_service_config, bot_workflow_config, bucke "config": { "type": "S3", "awsConfig": { - "awsAccessKeyId": minio_container.access_key, - "awsSecretAccessKey": minio_container.secret_key, + "awsAccessKeyId": s3_container.access_key, + "awsSecretAccessKey": s3_container.secret_key, "awsRegion": "us-east-1", - "endPointURL": f"http://localhost:{minio_container.get_exposed_port(9000)}", + "endPointURL": f"http://localhost:{s3_container.get_exposed_port(9000)}", }, "bucketNames": [bucket_name], } diff --git a/ingestion/tests/integration/containers.py b/ingestion/tests/integration/containers.py index c4d3128a4086..4bccf32d8a3c 100644 --- a/ingestion/tests/integration/containers.py +++ b/ingestion/tests/integration/containers.py @@ -13,8 +13,10 @@ from dataclasses import asdict, dataclass from typing import Optional +from minio import Minio +from testcontainers.core.container import DockerContainer from testcontainers.core.network import Network -from testcontainers.minio import MinioContainer +from testcontainers.core.waiting_utils import wait_container_is_ready from testcontainers.mysql import MySqlContainer @@ -37,15 +39,54 @@ def with_exposed_port(self, container): self.exposed_port = container.get_exposed_port(self.port) +class S3ProxyContainer(DockerContainer): + """S3-compatible object storage, backed by S3Proxy (https://github.com/gaul/s3proxy). + + Stands in for MinIO, whose image was deleted from Docker Hub. S3Proxy is + Apache-2.0, multi-arch and boots in well under a second. + + S3Proxy answers ``NotImplemented`` to bucket/object tagging and bucket + lifecycle, so tests must not depend on those calls succeeding. + """ + + def __init__(self, image: str, access_key: str, secret_key: str, port: int = 9000, **kwargs): + super().__init__(image, **kwargs) + self.access_key = access_key + self.secret_key = secret_key + self.port = port + self.with_exposed_ports(port) + # S3Proxy listens on :80 out of the box; move it to the S3 port the + # ingestion configs and network aliases already assume. + self.with_env("S3PROXY_ENDPOINT", f"http://0.0.0.0:{port}") + self.with_env("S3PROXY_AUTHORIZATION", "aws-v2-or-v4") + self.with_env("S3PROXY_IDENTITY", access_key) + self.with_env("S3PROXY_CREDENTIAL", secret_key) + + def get_client(self) -> Minio: + return Minio( + f"{self.get_container_host_ip()}:{self.get_exposed_port(self.port)}", + access_key=self.access_key, + secret_key=self.secret_key, + secure=False, + ) + + @wait_container_is_ready(Exception) + def _wait_until_serving(self) -> None: + self.get_client().list_buckets() + + def start(self, *args, **kwargs): + super().start(*args, **kwargs) + self._wait_until_serving() + return self + + @dataclass -class MinioContainerConfigs: - """MinIO Configurations""" - - # testcontainers defaults to minio/minio on Docker Hub, which MinIO has deleted. - # The same release is still published on quay.io. - image: str = "quay.io/minio/minio:RELEASE.2022-12-02T19-19-22Z" - access_key: str = "minio" - secret_key: str = "password" +class S3ContainerConfigs: + """S3-compatible object storage configuration""" + + image: str = "andrewgaul/s3proxy:4.1.1" + access_key: str = "accesskey" + secret_key: str = "secretkey" port: int = 9000 container_name: Optional[str] = None # noqa: UP045 exposed_port: Optional[int] = None # noqa: UP045 @@ -72,10 +113,10 @@ def get_mysql_container(mysql_config: MySqlContainerConfigs): return container -def get_minio_container(minio_config: MinioContainerConfigs): - container = MinioContainer( - **{k: v for k, v in asdict(minio_config).items() if k not in ["exposed_port", "container_name"]} +def get_s3_container(s3_config: S3ContainerConfigs): + container = S3ProxyContainer( + **{k: v for k, v in asdict(s3_config).items() if k not in ["exposed_port", "container_name"]} ) - container.with_name(minio_config.container_name) + container.with_name(s3_config.container_name) return container diff --git a/ingestion/tests/integration/datalake/conftest.py b/ingestion/tests/integration/datalake/conftest.py index 68d73f4a8f57..615b2904535f 100644 --- a/ingestion/tests/integration/datalake/conftest.py +++ b/ingestion/tests/integration/datalake/conftest.py @@ -29,7 +29,7 @@ from metadata.workflow.profiler import ProfilerWorkflow from ..conftest import _safe_delete # noqa: TID252 -from ..containers import MinioContainerConfigs, get_minio_container # noqa: TID252 +from ..containers import S3ContainerConfigs, get_s3_container # noqa: TID252 from ..integration_base import generate_name # noqa: TID252 BUCKET_NAME = "my-bucket" @@ -159,15 +159,15 @@ def ingestion_fqn(datalake_service_name): @pytest.fixture(scope="package") -def minio_container(): - with get_minio_container(MinioContainerConfigs()) as container: +def s3_container(): + with get_s3_container(S3ContainerConfigs()) as container: yield container @pytest.fixture(scope="class", autouse=True) -def setup_s3(minio_container) -> None: +def setup_s3(s3_container) -> None: # Mock our S3 bucket and ingest a file - client = minio_container.get_client() + client = s3_container.get_client() if client.bucket_exists(BUCKET_NAME): return client.make_bucket(BUCKET_NAME) @@ -182,17 +182,17 @@ def setup_s3(minio_container) -> None: @pytest.fixture(scope="class") -def ingestion_config(minio_container, datalake_service_name): +def ingestion_config(s3_container, datalake_service_name): ingestion_config = deepcopy(INGESTION_CONFIG) # Use dynamic service name for test isolation in parallel execution ingestion_config["source"]["serviceName"] = datalake_service_name ingestion_config["source"]["serviceConnection"]["config"]["configSource"].update( { "securityConfig": { - "awsAccessKeyId": minio_container.access_key, - "awsSecretAccessKey": minio_container.secret_key, + "awsAccessKeyId": s3_container.access_key, + "awsSecretAccessKey": s3_container.secret_key, "awsRegion": "us-west-1", - "endPointURL": f"http://localhost:{minio_container.get_exposed_port(minio_container.port)}", + "endPointURL": f"http://localhost:{s3_container.get_exposed_port(s3_container.port)}", } } ) diff --git a/ingestion/tests/integration/datalake/test_datalake_profiler_sampling.py b/ingestion/tests/integration/datalake/test_datalake_profiler_sampling.py index 9a71b6c79a3e..c06d0d1d4358 100644 --- a/ingestion/tests/integration/datalake/test_datalake_profiler_sampling.py +++ b/ingestion/tests/integration/datalake/test_datalake_profiler_sampling.py @@ -12,7 +12,7 @@ """ Integration tests for Datalake profiler with dynamic sampling configurations. Tests static, dynamic smart, and dynamic threshold sampling via ProfilerWorkflow. -Requires a running OpenMetadata server and MinIO container. +Requires a running OpenMetadata server and S3 container. """ from copy import deepcopy diff --git a/ingestion/tests/integration/datalake/test_rule_library_pandas.py b/ingestion/tests/integration/datalake/test_rule_library_pandas.py index babc329db3cf..6b276b634c6a 100644 --- a/ingestion/tests/integration/datalake/test_rule_library_pandas.py +++ b/ingestion/tests/integration/datalake/test_rule_library_pandas.py @@ -9,7 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -Integration tests for Rule Library Pandas Expression validator on Datalake (S3/MinIO) +Integration tests for Rule Library Pandas Expression validator on Datalake (S3) """ from copy import deepcopy diff --git a/ingestion/tests/integration/datalake/test_table_rule_library_pandas.py b/ingestion/tests/integration/datalake/test_table_rule_library_pandas.py index fe111200e0ba..d988f38143d8 100644 --- a/ingestion/tests/integration/datalake/test_table_rule_library_pandas.py +++ b/ingestion/tests/integration/datalake/test_table_rule_library_pandas.py @@ -9,7 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -Integration tests for Table Rule Library Pandas Expression validator on Datalake (S3/MinIO) +Integration tests for Table Rule Library Pandas Expression validator on Datalake (S3) """ from copy import deepcopy diff --git a/ingestion/tests/integration/s3/conftest.py b/ingestion/tests/integration/s3/conftest.py index 1538a885c576..516bc9d51087 100644 --- a/ingestion/tests/integration/s3/conftest.py +++ b/ingestion/tests/integration/s3/conftest.py @@ -22,7 +22,7 @@ from metadata.generated.schema.entity.services.storageService import StorageService from metadata.workflow.metadata import MetadataWorkflow -from ..containers import MinioContainerConfigs, get_minio_container # noqa: TID252 +from ..containers import S3ContainerConfigs, get_s3_container # noqa: TID252 RESOURCES_DIR = Path(__file__).parent / "resources" @@ -42,7 +42,7 @@ def bucket_name(): return "test-bucket" -def upload_directory_to_minio(client: Minio, local_directory: Path, bucket_name: str): +def upload_directory_to_s3(client: Minio, local_directory: Path, bucket_name: str): """ Validate it with list(client.list_objects(bucket_name=bucket_name, recursive=True)) @@ -52,7 +52,7 @@ def upload_directory_to_minio(client: Minio, local_directory: Path, bucket_name: for filename in files: # Create the file path local_file_path = os.path.join(root, filename) # noqa: PTH118 - # Generate the object name for MinIO by stripping the local directory path + # Generate the object name by stripping the local directory path object_name = os.path.relpath(local_file_path, local_directory) # Upload the file @@ -60,28 +60,27 @@ def upload_directory_to_minio(client: Minio, local_directory: Path, bucket_name: @pytest.fixture(scope="package") -def minio(bucket_name): - config = MinioContainerConfigs(container_name=str(uuid.uuid4())) - minio_container = get_minio_container(config) - minio_container.with_exposed_ports(9000, 9001) +def s3(bucket_name): + config = S3ContainerConfigs(container_name=str(uuid.uuid4())) + s3_container = get_s3_container(config) - with minio_container: - minio_client = minio_container.get_client() - minio_client.make_bucket(bucket_name) + with s3_container: + s3_client = s3_container.get_client() + s3_client.make_bucket(bucket_name) - yield minio_container, minio_client + yield s3_container, s3_client @pytest.fixture(scope="module") -def create_data(minio, bucket_name): - _, minio_client = minio - upload_directory_to_minio(minio_client, RESOURCES_DIR, bucket_name) +def create_data(s3, bucket_name): + _, s3_client = s3 + upload_directory_to_s3(s3_client, RESOURCES_DIR, bucket_name) yield @pytest.fixture(scope="module") -def ingest_s3_storage(minio, metadata, service_name, create_data): - minio_container, _ = minio +def ingest_s3_storage(s3, metadata, service_name, create_data): + s3_container, _ = s3 config = f""" source: type: s3 @@ -90,10 +89,10 @@ def ingest_s3_storage(minio, metadata, service_name, create_data): config: type: S3 awsConfig: - awsAccessKeyId: {minio_container.access_key} - awsSecretAccessKey: {minio_container.secret_key} + awsAccessKeyId: {s3_container.access_key} + awsSecretAccessKey: {s3_container.secret_key} awsRegion: us-east-1 - endPointURL: http://localhost:{minio_container.get_exposed_port(9000)} + endPointURL: http://localhost:{s3_container.get_exposed_port(9000)} sourceConfig: config: type: StorageMetadata diff --git a/ingestion/tests/integration/s3/test_s3_manifest_wildcards.py b/ingestion/tests/integration/s3/test_s3_manifest_wildcards.py index 4e1565ce0638..c9ae24261c51 100644 --- a/ingestion/tests/integration/s3/test_s3_manifest_wildcards.py +++ b/ingestion/tests/integration/s3/test_s3_manifest_wildcards.py @@ -11,7 +11,7 @@ """Integration tests for manifest wildcards and the defaultManifest fallback. -Runs against MinIO using the same fixtures as ``test_s3_storage.py``. +Runs against the S3 test container using the same fixtures as ``test_s3_storage.py``. Each test uses a unique service name and a unique bucket so manifests don't collide between scenarios. """ @@ -36,7 +36,7 @@ def _build_pipeline_config( *, service_name: str, - minio_container, + s3_container, default_manifest_json: str | None = None, ) -> dict: """Build a storage ingestion pipeline config. ``default_manifest_json`` @@ -53,10 +53,10 @@ def _build_pipeline_config( "config": { "type": "S3", "awsConfig": { - "awsAccessKeyId": minio_container.access_key, - "awsSecretAccessKey": minio_container.secret_key, + "awsAccessKeyId": s3_container.access_key, + "awsSecretAccessKey": s3_container.secret_key, "awsRegion": "us-east-1", - "endPointURL": f"http://localhost:{minio_container.get_exposed_port(9000)}", + "endPointURL": f"http://localhost:{s3_container.get_exposed_port(9000)}", }, "bucketNames": [service_name], } @@ -83,8 +83,8 @@ def _run_workflow(config: dict) -> None: workflow.stop() -def _put_object(minio_client, bucket: str, key: str, body: bytes) -> None: - minio_client.put_object(bucket, key, BytesIO(body), length=len(body)) +def _put_object(s3_client, bucket: str, key: str, body: bytes) -> None: + s3_client.put_object(bucket, key, BytesIO(body), length=len(body)) def _cleanup_service(metadata, service_name: str) -> None: @@ -98,20 +98,20 @@ def _cleanup_service(metadata, service_name: str) -> None: ) -def _copy_parquet_files(minio_client, src_bucket: str, src_prefix: str, dst_bucket: str, dst_prefix: str) -> None: +def _copy_parquet_files(s3_client, src_bucket: str, src_prefix: str, dst_bucket: str, dst_prefix: str) -> None: """Copy all objects from ``src_bucket/src_prefix`` into ``dst_bucket/dst_prefix``. Used so each test bucket has fresh sample data independent of the shared ``test-bucket`` fixture.""" - for obj in minio_client.list_objects(src_bucket, prefix=src_prefix, recursive=True): + for obj in s3_client.list_objects(src_bucket, prefix=src_prefix, recursive=True): relative = obj.object_name[len(src_prefix) :].lstrip("/") dst_key = f"{dst_prefix.rstrip('/')}/{relative}".lstrip("/") if relative else dst_prefix - response = minio_client.get_object(src_bucket, obj.object_name) + response = s3_client.get_object(src_bucket, obj.object_name) try: body = response.read() finally: response.close() response.release_conn() - _put_object(minio_client, dst_bucket, dst_key, body) + _put_object(s3_client, dst_bucket, dst_key, body) # ---------------------------------------------------------------------- @@ -120,27 +120,27 @@ def _copy_parquet_files(minio_client, src_bucket: str, src_prefix: str, dst_buck @pytest.fixture -def wildcard_bucket(minio, bucket_name, create_data): +def wildcard_bucket(s3, bucket_name, create_data): """A dedicated bucket seeded with a few parquet files grouped into Hive-style partitions so we can exercise glob matching + partition auto-detection. Dropped after each test.""" - _, minio_client = minio + _, s3_client = s3 bucket = f"wildcards-{uuid.uuid4().hex[:8]}" - minio_client.make_bucket(bucket) + s3_client.make_bucket(bucket) # Reuse the already-uploaded ``cities`` dataset (State=AL/State=AZ # partitions with parquet files). We copy it into a couple of # distinct logical paths to exercise the glob expansion. - _copy_parquet_files(minio_client, bucket_name, "cities/", bucket, "data/sales/") - _copy_parquet_files(minio_client, bucket_name, "cities/", bucket, "data/orders/") - _copy_parquet_files(minio_client, bucket_name, "cities/", bucket, "archive/old_sales/") + _copy_parquet_files(s3_client, bucket_name, "cities/", bucket, "data/sales/") + _copy_parquet_files(s3_client, bucket_name, "cities/", bucket, "data/orders/") + _copy_parquet_files(s3_client, bucket_name, "cities/", bucket, "archive/old_sales/") yield bucket # Tear down: empty bucket then remove. - for obj in minio_client.list_objects(bucket, recursive=True): - minio_client.remove_object(bucket, obj.object_name) - minio_client.remove_bucket(bucket) + for obj in s3_client.list_objects(bucket, recursive=True): + s3_client.remove_object(bucket, obj.object_name) + s3_client.remove_bucket(bucket) # ---------------------------------------------------------------------- @@ -151,8 +151,8 @@ def wildcard_bucket(minio, bucket_name, create_data): class TestBucketManifestWildcards: """A bucket with an openmetadata.json whose dataPath is a glob.""" - def test_glob_datapath_resolves_to_multiple_containers(self, minio, metadata, wildcard_bucket): - _, minio_client = minio + def test_glob_datapath_resolves_to_multiple_containers(self, s3, metadata, wildcard_bucket): + _, s3_client = s3 service_name = f"wc-glob-{uuid.uuid4().hex[:8]}" manifest = { @@ -166,7 +166,7 @@ def test_glob_datapath_resolves_to_multiple_containers(self, minio, metadata, wi ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -175,7 +175,7 @@ def test_glob_datapath_resolves_to_multiple_containers(self, minio, metadata, wi # Service points at exactly this bucket. config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -218,7 +218,7 @@ class TestDefaultManifestFallback: """defaultManifest on the pipeline config is applied when a bucket has no openmetadata.json of its own.""" - def test_default_manifest_used_when_bucket_has_no_file(self, minio, metadata, wildcard_bucket): + def test_default_manifest_used_when_bucket_has_no_file(self, s3, metadata, wildcard_bucket): service_name = f"wc-default-{uuid.uuid4().hex[:8]}" default_manifest = json.dumps( @@ -235,7 +235,7 @@ def test_default_manifest_used_when_bucket_has_no_file(self, minio, metadata, wi ) config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], default_manifest_json=default_manifest, ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -264,8 +264,8 @@ class TestBucketFileWinsOverDefault: """When both a bucket openmetadata.json and a defaultManifest exist, the bucket file must win (precedence).""" - def test_bucket_file_takes_precedence(self, minio, metadata, wildcard_bucket): - _, minio_client = minio + def test_bucket_file_takes_precedence(self, s3, metadata, wildcard_bucket): + _, s3_client = s3 service_name = f"wc-prec-{uuid.uuid4().hex[:8]}" # Bucket manifest: only data/sales @@ -279,7 +279,7 @@ def test_bucket_file_takes_precedence(self, minio, metadata, wildcard_bucket): ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(bucket_manifest).encode(), @@ -300,7 +300,7 @@ def test_bucket_file_takes_precedence(self, minio, metadata, wildcard_bucket): ) config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], default_manifest_json=default_manifest, ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -354,8 +354,8 @@ class TestInvalidDefaultManifest: """Invalid JSON in defaultManifest must be ignored rather than breaking the whole ingestion. The bucket file, if any, still wins.""" - def test_invalid_default_manifest_is_ignored(self, minio, metadata, wildcard_bucket): - _, minio_client = minio + def test_invalid_default_manifest_is_ignored(self, s3, metadata, wildcard_bucket): + _, s3_client = s3 service_name = f"wc-bad-{uuid.uuid4().hex[:8]}" # Bucket has a valid manifest covering data/sales only. @@ -369,7 +369,7 @@ def test_invalid_default_manifest_is_ignored(self, minio, metadata, wildcard_buc ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(bucket_manifest).encode(), @@ -377,7 +377,7 @@ def test_invalid_default_manifest_is_ignored(self, minio, metadata, wildcard_buc config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], default_manifest_json="this is not valid json {", ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -406,13 +406,13 @@ class TestMalformedBucketManifest: workflow. Ingestion falls back to the defaultManifest (if any) and surfaces a warning so users can diagnose.""" - def test_invalid_json_falls_back_to_default(self, minio, metadata, wildcard_bucket): - _, minio_client = minio + def test_invalid_json_falls_back_to_default(self, s3, metadata, wildcard_bucket): + _, s3_client = s3 service_name = f"wc-bad-bucket-{uuid.uuid4().hex[:8]}" # Bucket file is malformed JSON. _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", b"{ this is not valid json", @@ -432,7 +432,7 @@ def test_invalid_json_falls_back_to_default(self, minio, metadata, wildcard_buck ) config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], default_manifest_json=default_manifest, ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -451,14 +451,14 @@ def test_invalid_json_falls_back_to_default(self, minio, metadata, wildcard_buck finally: _cleanup_service(metadata, service_name) - def test_invalid_json_no_default_still_gets_bucket_container(self, minio, metadata, wildcard_bucket): + def test_invalid_json_no_default_still_gets_bucket_container(self, s3, metadata, wildcard_bucket): """Without a defaultManifest, a broken bucket file leaves only the top-level bucket container. Ingestion MUST NOT abort.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-bad-only-{uuid.uuid4().hex[:8]}" _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", b'{ "entries": [ broken', @@ -466,7 +466,7 @@ def test_invalid_json_no_default_still_gets_bucket_container(self, minio, metada config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -491,16 +491,16 @@ def test_invalid_json_no_default_still_gets_bucket_container(self, minio, metada finally: _cleanup_service(metadata, service_name) - def test_schema_violation_in_bucket_manifest(self, minio, metadata, wildcard_bucket): + def test_schema_violation_in_bucket_manifest(self, s3, metadata, wildcard_bucket): """Valid JSON but schema violation (entry missing required ``dataPath``). Pydantic should flag; ingestion falls back.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-schema-{uuid.uuid4().hex[:8]}" # Valid JSON, but an entry is missing the required ``dataPath``. bad_manifest = {"entries": [{"structureFormat": "parquet"}]} # no dataPath _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(bad_manifest).encode(), @@ -520,7 +520,7 @@ def test_schema_violation_in_bucket_manifest(self, minio, metadata, wildcard_buc ) config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], default_manifest_json=default_manifest, ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -536,15 +536,15 @@ def test_schema_violation_in_bucket_manifest(self, minio, metadata, wildcard_buc finally: _cleanup_service(metadata, service_name) - def test_empty_entries_in_bucket_manifest(self, minio, metadata, wildcard_bucket): + def test_empty_entries_in_bucket_manifest(self, s3, metadata, wildcard_bucket): """Bucket file with ``entries: []`` is valid but produces no nested containers. Ingestion should complete cleanly and fall through to defaultManifest (if any).""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-empty-{uuid.uuid4().hex[:8]}" _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps({"entries": []}).encode(), @@ -563,7 +563,7 @@ def test_empty_entries_in_bucket_manifest(self, minio, metadata, wildcard_bucket ) config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], default_manifest_json=default_manifest, ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -593,15 +593,15 @@ class TestFileReadEdgeCases: issues — corrupt content, unknown extensions, etc. These exercise ``expand_entry`` / schema extraction error isolation.""" - def test_corrupt_file_does_not_break_other_tables(self, minio, metadata, wildcard_bucket): + def test_corrupt_file_does_not_break_other_tables(self, s3, metadata, wildcard_bucket): """One unreadable parquet in one table should not block other tables matched by the same glob.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-corrupt-{uuid.uuid4().hex[:8]}" # Drop a bogus parquet into data/orders/ alongside the real ones. _put_object( - minio_client, + s3_client, wildcard_bucket, "data/orders/State=AL/corrupt.parquet", b"this is not a valid parquet file, just random bytes", @@ -617,7 +617,7 @@ def test_corrupt_file_does_not_break_other_tables(self, minio, metadata, wildcar ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -625,7 +625,7 @@ def test_corrupt_file_does_not_break_other_tables(self, minio, metadata, wildcar config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -644,10 +644,10 @@ def test_corrupt_file_does_not_break_other_tables(self, minio, metadata, wildcar finally: _cleanup_service(metadata, service_name) - def test_glob_matches_no_files_yields_only_bucket(self, minio, metadata, wildcard_bucket): + def test_glob_matches_no_files_yields_only_bucket(self, s3, metadata, wildcard_bucket): """Glob pattern matches zero files — ingestion succeeds, bucket container exists, no nested containers are created.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-nomatch-{uuid.uuid4().hex[:8]}" manifest = { @@ -659,7 +659,7 @@ def test_glob_matches_no_files_yields_only_bucket(self, minio, metadata, wildcar ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -667,7 +667,7 @@ def test_glob_matches_no_files_yields_only_bucket(self, minio, metadata, wildcar config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -689,22 +689,22 @@ def test_glob_matches_no_files_yields_only_bucket(self, minio, metadata, wildcar finally: _cleanup_service(metadata, service_name) - def test_glob_without_structureformat_and_unknown_extension_is_skipped(self, minio, metadata, wildcard_bucket): + def test_glob_without_structureformat_and_unknown_extension_is_skipped(self, s3, metadata, wildcard_bucket): """When the file extension is not recognized and no ``structureFormat`` is set, the expand step should skip the container (WARNING log) rather than crash.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-unknown-ext-{uuid.uuid4().hex[:8]}" # Put files with an unknown extension. _put_object( - minio_client, + s3_client, wildcard_bucket, "blobs/item1.bin", b"\x00\x01\x02\x03", ) _put_object( - minio_client, + s3_client, wildcard_bucket, "blobs/item2.bin", b"\x00\x01\x02\x03", @@ -717,7 +717,7 @@ def test_glob_without_structureformat_and_unknown_extension_is_skipped(self, min ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -725,7 +725,7 @@ def test_glob_without_structureformat_and_unknown_extension_is_skipped(self, min config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -748,15 +748,15 @@ def test_glob_without_structureformat_and_unknown_extension_is_skipped(self, min finally: _cleanup_service(metadata, service_name) - def test_unstructured_catalogs_one_container_per_file(self, minio, metadata, wildcard_bucket): + def test_unstructured_catalogs_one_container_per_file(self, s3, metadata, wildcard_bucket): """With ``unstructuredData: true`` each matched file becomes its own container (no schema extraction).""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-unstr-{uuid.uuid4().hex[:8]}" - _put_object(minio_client, wildcard_bucket, "images/a.png", b"\x89PNG\x00") - _put_object(minio_client, wildcard_bucket, "images/b.png", b"\x89PNG\x00") - _put_object(minio_client, wildcard_bucket, "images/nested/c.png", b"\x89PNG\x00") + _put_object(s3_client, wildcard_bucket, "images/a.png", b"\x89PNG\x00") + _put_object(s3_client, wildcard_bucket, "images/b.png", b"\x89PNG\x00") + _put_object(s3_client, wildcard_bucket, "images/nested/c.png", b"\x89PNG\x00") manifest = { "entries": [ @@ -767,7 +767,7 @@ def test_unstructured_catalogs_one_container_per_file(self, minio, metadata, wil ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -775,7 +775,7 @@ def test_unstructured_catalogs_one_container_per_file(self, minio, metadata, wil config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -811,8 +811,8 @@ class TestReIngestionIdempotency: """Running the same manifest twice must update the same entity, not create duplicates. This is the migration guarantee — FQN stability.""" - def test_glob_re_ingestion_preserves_entity_id(self, minio, metadata, wildcard_bucket): - _, minio_client = minio + def test_glob_re_ingestion_preserves_entity_id(self, s3, metadata, wildcard_bucket): + _, s3_client = s3 service_name = f"wc-idemp-{uuid.uuid4().hex[:8]}" manifest = { @@ -825,7 +825,7 @@ def test_glob_re_ingestion_preserves_entity_id(self, minio, metadata, wildcard_b ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -833,7 +833,7 @@ def test_glob_re_ingestion_preserves_entity_id(self, minio, metadata, wildcard_b config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -859,11 +859,11 @@ def test_glob_re_ingestion_preserves_entity_id(self, minio, metadata, wildcard_b finally: _cleanup_service(metadata, service_name) - def test_literal_to_glob_migration_preserves_entity_id(self, minio, metadata, wildcard_bucket): + def test_literal_to_glob_migration_preserves_entity_id(self, s3, metadata, wildcard_bucket): """A user starts with a literal-path manifest. Later they switch to a glob that resolves to the *same* container name. FQNs must match so existing lineage/tags/descriptions are preserved.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-migrate-{uuid.uuid4().hex[:8]}" # Phase 1: literal manifest @@ -877,7 +877,7 @@ def test_literal_to_glob_migration_preserves_entity_id(self, minio, metadata, wi ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(literal).encode(), @@ -885,7 +885,7 @@ def test_literal_to_glob_migration_preserves_entity_id(self, minio, metadata, wi config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -911,7 +911,7 @@ def test_literal_to_glob_migration_preserves_entity_id(self, minio, metadata, wi ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(glob).encode(), @@ -941,11 +941,11 @@ class TestPerEntryResilience: bad regex, runtime error in our code) must NOT block the other entries in the same manifest.""" - def test_bad_entry_does_not_block_good_entry(self, minio, metadata, wildcard_bucket, monkeypatch): + def test_bad_entry_does_not_block_good_entry(self, s3, metadata, wildcard_bucket, monkeypatch): """Simulate: one entry triggers an exception deep in expand_entry; the other entry is a clean literal path that must still produce its container.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-resilience-{uuid.uuid4().hex[:8]}" manifest = { @@ -961,7 +961,7 @@ def test_bad_entry_does_not_block_good_entry(self, minio, metadata, wildcard_buc ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -982,7 +982,7 @@ def fake_list_keys(self, bucket_name, prefix): config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -1010,12 +1010,12 @@ class TestSpecialCharsInPaths: brackets, plus). A literal dataPath containing such chars MUST be matched exactly — pattern_to_regex should escape them.""" - def test_path_with_regex_special_chars_matches_literally(self, minio, metadata, wildcard_bucket): - _, minio_client = minio + def test_path_with_regex_special_chars_matches_literally(self, s3, metadata, wildcard_bucket): + _, s3_client = s3 service_name = f"wc-special-{uuid.uuid4().hex[:8]}" # Upload a parquet into a directory whose name contains a '+'. - _copy_parquet_files(minio_client, "test-bucket", "cities/", wildcard_bucket, "rare+data/") + _copy_parquet_files(s3_client, "test-bucket", "cities/", wildcard_bucket, "rare+data/") # Literal dataPath — passes through expand_entry unchanged. manifest = { @@ -1028,7 +1028,7 @@ def test_path_with_regex_special_chars_matches_literally(self, minio, metadata, ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -1036,7 +1036,7 @@ def test_path_with_regex_special_chars_matches_literally(self, minio, metadata, config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -1066,10 +1066,10 @@ class TestContainerFilterPatternAgainstManifestPaths: inference. Both paths now go through ``filter_manifest_entries`` and ``_is_excluded_artifact``.""" - def test_success_sentinel_in_manifest_is_skipped(self, minio, metadata, wildcard_bucket): + def test_success_sentinel_in_manifest_is_skipped(self, s3, metadata, wildcard_bucket): """A manifest that accidentally lists ``_SUCCESS`` (or a path containing ``_SUCCESS``) must NOT produce a container.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-succ-{uuid.uuid4().hex[:8]}" manifest = { @@ -1085,14 +1085,14 @@ def test_success_sentinel_in_manifest_is_skipped(self, minio, metadata, wildcard ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), ) config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -1121,11 +1121,11 @@ def test_success_sentinel_in_manifest_is_skipped(self, minio, metadata, wildcard finally: _cleanup_service(metadata, service_name) - def test_container_filter_excludes_applies_to_manifest_paths(self, minio, metadata, wildcard_bucket): + def test_container_filter_excludes_applies_to_manifest_paths(self, s3, metadata, wildcard_bucket): """``containerFilterPattern.excludes`` set on the pipeline config must drop matching entries from a bucket manifest, not just top-level buckets.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-excl-{uuid.uuid4().hex[:8]}" manifest = { @@ -1143,7 +1143,7 @@ def test_container_filter_excludes_applies_to_manifest_paths(self, minio, metada ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -1151,7 +1151,7 @@ def test_container_filter_excludes_applies_to_manifest_paths(self, minio, metada config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] # Exclude orders at the pipeline level. containerFilterPattern @@ -1179,10 +1179,10 @@ def test_container_filter_excludes_applies_to_manifest_paths(self, minio, metada finally: _cleanup_service(metadata, service_name) - def test_container_filter_includes_applies_to_manifest_paths(self, minio, metadata, wildcard_bucket): + def test_container_filter_includes_applies_to_manifest_paths(self, s3, metadata, wildcard_bucket): """Likewise ``containerFilterPattern.includes`` restricts which manifest entries become containers.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-incl-{uuid.uuid4().hex[:8]}" manifest = { @@ -1200,7 +1200,7 @@ def test_container_filter_includes_applies_to_manifest_paths(self, minio, metada ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -1208,7 +1208,7 @@ def test_container_filter_includes_applies_to_manifest_paths(self, minio, metada config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] # Left-anchored regex: ``.*sales`` matches any path that contains 'sales'. @@ -1231,13 +1231,13 @@ def test_container_filter_includes_applies_to_manifest_paths(self, minio, metada finally: _cleanup_service(metadata, service_name) - def test_filter_applies_after_glob_expansion(self, minio, metadata, wildcard_bucket): + def test_filter_applies_after_glob_expansion(self, s3, metadata, wildcard_bucket): """End-to-end: a glob ``dataPath`` plus a pipeline-level ``containerFilterPattern`` must expand the glob THEN drop the matching excludes. Without this ordering, an innocent ``data/**/*.parquet`` pattern would sweep archive/staging dirs that the user already tried to exclude at the pipeline level.""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-glob-excl-{uuid.uuid4().hex[:8]}" manifest = { @@ -1250,7 +1250,7 @@ def test_filter_applies_after_glob_expansion(self, minio, metadata, wildcard_buc ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -1258,7 +1258,7 @@ def test_filter_applies_after_glob_expansion(self, minio, metadata, wildcard_buc config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] # Drop orders even though the glob would match it. @@ -1283,21 +1283,21 @@ def test_filter_applies_after_glob_expansion(self, minio, metadata, wildcard_buc finally: _cleanup_service(metadata, service_name) - def test_success_file_in_sample_directory_is_not_picked(self, minio, metadata, wildcard_bucket): + def test_success_file_in_sample_directory_is_not_picked(self, s3, metadata, wildcard_bucket): """Sample-file selection must skip ``_SUCCESS`` so pyarrow doesn't crash on a 0-byte sentinel (original reported crash).""" - _, minio_client = minio + _, s3_client = s3 service_name = f"wc-sampsucc-{uuid.uuid4().hex[:8]}" # Drop 0-byte Spark sentinels alongside the valid parquet files. _put_object( - minio_client, + s3_client, wildcard_bucket, "data/sales/State=AL/_SUCCESS", b"", ) _put_object( - minio_client, + s3_client, wildcard_bucket, "data/sales/State=AL/_SUCCESS.crc", b"", @@ -1313,7 +1313,7 @@ def test_success_file_in_sample_directory_is_not_picked(self, minio, metadata, w ] } _put_object( - minio_client, + s3_client, wildcard_bucket, "openmetadata.json", json.dumps(manifest).encode(), @@ -1321,7 +1321,7 @@ def test_success_file_in_sample_directory_is_not_picked(self, minio, metadata, w config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] @@ -1345,7 +1345,7 @@ def test_success_file_in_sample_directory_is_not_picked(self, minio, metadata, w class TestMalformedDefaultManifest: """Symmetric coverage for defaultManifest parse errors.""" - def test_default_manifest_schema_violation_is_ignored(self, minio, metadata, wildcard_bucket): + def test_default_manifest_schema_violation_is_ignored(self, s3, metadata, wildcard_bucket): """Valid JSON but wrong schema — e.g. an entry missing required ``containerName`` / ``dataPath``. Must be logged & skipped.""" service_name = f"wc-bad-default-{uuid.uuid4().hex[:8]}" @@ -1354,7 +1354,7 @@ def test_default_manifest_schema_violation_is_ignored(self, minio, metadata, wil default_manifest = json.dumps({"entries": [{"structureFormat": "parquet"}]}) config = _build_pipeline_config( service_name=service_name, - minio_container=minio[0], + s3_container=s3[0], default_manifest_json=default_manifest, ) config["source"]["serviceConnection"]["config"]["bucketNames"] = [wildcard_bucket] diff --git a/ingestion/tests/integration/sources/database/delta_lake/conftest.py b/ingestion/tests/integration/sources/database/delta_lake/conftest.py index ff718159a8e1..2558b71a9634 100644 --- a/ingestion/tests/integration/sources/database/delta_lake/conftest.py +++ b/ingestion/tests/integration/sources/database/delta_lake/conftest.py @@ -14,35 +14,34 @@ import pytest -from ....containers import MinioContainerConfigs, get_minio_container # noqa: TID252 +from ....containers import S3ContainerConfigs, get_s3_container # noqa: TID252 class DeltaLakeStorageTestConfig: def __init__(self): - self.minio_config = MinioContainerConfigs() + self.s3_config = S3ContainerConfigs() self.bucket_name = "bucket" self.prefix = "prefix" self.storage_options = { - "AWS_ACCESS_KEY_ID": self.minio_config.access_key, - "AWS_SECRET_ACCESS_KEY": self.minio_config.secret_key, + "AWS_ACCESS_KEY_ID": self.s3_config.access_key, + "AWS_SECRET_ACCESS_KEY": self.s3_config.secret_key, "AWS_REGION": "us-east-2", "AWS_ALLOW_HTTP": "true", "AWS_S3_ALLOW_UNSAFE_RENAME": "true", } - def with_exposed_port(self, minio): - self.minio_config.with_exposed_port(minio) - self.storage_options["AWS_ENDPOINT_URL"] = f"http://localhost:{self.minio_config.exposed_port}" + def with_exposed_port(self, container): + self.s3_config.with_exposed_port(container) + self.storage_options["AWS_ENDPOINT_URL"] = f"http://localhost:{self.s3_config.exposed_port}" @pytest.fixture(scope="module") def deltalake_storage_environment(): config = DeltaLakeStorageTestConfig() - minio = get_minio_container(config.minio_config) - with minio: - minio_client = minio.get_client() - minio_client.make_bucket(config.bucket_name) + s3_container = get_s3_container(config.s3_config) + with s3_container: + s3_container.get_client().make_bucket(config.bucket_name) - config.with_exposed_port(minio) + config.with_exposed_port(s3_container) yield config diff --git a/ingestion/tests/integration/sources/mlmodels/mlflow/conftest.py b/ingestion/tests/integration/sources/mlmodels/mlflow/conftest.py index d4f4db8586fe..0ecb94e0d064 100644 --- a/ingestion/tests/integration/sources/mlmodels/mlflow/conftest.py +++ b/ingestion/tests/integration/sources/mlmodels/mlflow/conftest.py @@ -16,7 +16,7 @@ 2. Get a testcontainer Container for - MlFlow Image - MySQL - - MinIO + - S3 (S3Proxy) * For each container, an open port is found to be able to reach it from the host. 3. A Docker Network is created so that they can reach each other easily without the need to use the host. 4. The containers are started @@ -37,11 +37,11 @@ from testcontainers.core.docker_client import DockerClient from ....containers import ( # noqa: TID252 - MinioContainerConfigs, MySqlContainerConfigs, + S3ContainerConfigs, get_docker_network, - get_minio_container, get_mysql_container, + get_s3_container, ) @@ -67,7 +67,7 @@ def __init__(self): password="password", dbname="experiments", ) - self.minio_configs = MinioContainerConfigs() + self.s3_configs = S3ContainerConfigs() self.mlflow_configs = MlflowContainerConfigs() @@ -81,29 +81,29 @@ def mlflow_environment(): config = MlflowTestConfiguration() mysql_container_name = f"mlflow-db-{unique_id}" config.mysql_configs.container_name = mysql_container_name - config.minio_configs.container_name = f"mlflow-artifact-{unique_id}" + config.s3_configs.container_name = f"mlflow-artifact-{unique_id}" config.mlflow_configs.backend_uri = f"mysql+pymysql://mlflow:password@{mysql_container_name}:3306/experiments" docker_network = get_docker_network(name=f"docker_mlflow_test_nw_{unique_id}") - minio_container = get_minio_container(config.minio_configs) + s3_container = get_s3_container(config.s3_configs) mysql_container = get_mysql_container(config.mysql_configs) # mlflow 3.8.1+ creates a trigger at backend init; with binlog on (mysql:8 # default) this needs SUPER unless log_bin_trust_function_creators=1. mysql_container.with_command("mysqld --log-bin-trust-function-creators=1") - mlflow_container = build_and_get_mlflow_container(config.mlflow_configs, config.minio_configs, unique_id) + mlflow_container = build_and_get_mlflow_container(config.mlflow_configs, config.s3_configs, unique_id) with docker_network: - minio_container.with_network(docker_network) + s3_container.with_network(docker_network) mysql_container.with_network(docker_network) mlflow_container.with_network(docker_network) - with mysql_container, minio_container, mlflow_container: - # minio setup - minio_client = minio_container.get_client() - minio_client.make_bucket(config.mlflow_configs.artifact_bucket) + with mysql_container, s3_container, mlflow_container: + # object storage setup + s3_client = s3_container.get_client() + s3_client.make_bucket(config.mlflow_configs.artifact_bucket) config.mysql_configs.with_exposed_port(mysql_container) - config.minio_configs.with_exposed_port(minio_container) + config.s3_configs.with_exposed_port(s3_container) config.mlflow_configs.with_exposed_port(mlflow_container) # Wait for MySQL to be ready @@ -140,7 +140,7 @@ def mlflow_environment(): def build_and_get_mlflow_container( mlflow_config: MlflowContainerConfigs, - minio_config: MinioContainerConfigs, + s3_config: S3ContainerConfigs, unique_id: str, ): docker_client = DockerClient() @@ -161,11 +161,11 @@ def build_and_get_mlflow_container( container = DockerContainer(image_tag) container.with_exposed_ports(mlflow_config.port) - container.with_env("AWS_ACCESS_KEY_ID", minio_config.access_key) - container.with_env("AWS_SECRET_ACCESS_KEY", minio_config.secret_key) + container.with_env("AWS_ACCESS_KEY_ID", s3_config.access_key) + container.with_env("AWS_SECRET_ACCESS_KEY", s3_config.secret_key) container.with_env( "MLFLOW_S3_ENDPOINT_URL", - f"http://{minio_config.container_name}:{minio_config.port}", + f"http://{s3_config.container_name}:{s3_config.port}", ) container.with_env("MLFLOW_BOTO_CLIENT_ADDRESSING_STYLE", "path") container.with_command( diff --git a/ingestion/tests/integration/sources/mlmodels/mlflow/test_mlflow.py b/ingestion/tests/integration/sources/mlmodels/mlflow/test_mlflow.py index b18e78f43c6e..92a85e34b2c4 100644 --- a/ingestion/tests/integration/sources/mlmodels/mlflow/test_mlflow.py +++ b/ingestion/tests/integration/sources/mlmodels/mlflow/test_mlflow.py @@ -104,26 +104,28 @@ def create_data(mlflow_environment): mlflow_uri = f"http://localhost:{mlflow_environment.mlflow_configs.exposed_port}" mlflow.set_tracking_uri(mlflow_uri) - minio_endpoint = f"http://localhost:{mlflow_environment.minio_configs.exposed_port}" - os.environ["AWS_ACCESS_KEY_ID"] = mlflow_environment.minio_configs.access_key - os.environ["AWS_SECRET_ACCESS_KEY"] = mlflow_environment.minio_configs.secret_key - os.environ["MLFLOW_S3_ENDPOINT_URL"] = minio_endpoint + s3_endpoint = f"http://localhost:{mlflow_environment.s3_configs.exposed_port}" + os.environ["AWS_ACCESS_KEY_ID"] = mlflow_environment.s3_configs.access_key + os.environ["AWS_SECRET_ACCESS_KEY"] = mlflow_environment.s3_configs.secret_key + os.environ["MLFLOW_S3_ENDPOINT_URL"] = s3_endpoint os.environ["MLFLOW_BOTO_CLIENT_ADDRESSING_STYLE"] = "path" - # Reset boto3's cached default session so it picks up the MinIO env vars above. + # Reset boto3's cached default session so it picks up the S3 env vars above. # Earlier tests (e.g. test_ometa_secrets_manager) may have created DEFAULT_SESSION - # which caches credentials from ~/.aws/credentials — sending real AWS creds to MinIO - # instead of "minio"/"password", causing InvalidAccessKeyId. + # which caches credentials from ~/.aws/credentials — sending real AWS creds to the + # test S3 container instead of its own, causing InvalidAccessKeyId. import boto3 boto3.DEFAULT_SESSION = None - # Verify MinIO is reachable before proceeding (may be slow under Docker load) + # Verify object storage is reachable before proceeding (may be slow under Docker + # load). S3Proxy has no health endpoint; an unauthenticated GET / answers 403 once + # it is serving, which is all we need here. import requests for _ in range(15): try: - requests.get(f"{minio_endpoint}/minio/health/live", timeout=5) + requests.get(s3_endpoint, timeout=5) break except Exception: time.sleep(2) diff --git a/ingestion/tests/integration/trino/conftest.py b/ingestion/tests/integration/trino/conftest.py index d6a5c4d95fa0..7599d78f5dc3 100644 --- a/ingestion/tests/integration/trino/conftest.py +++ b/ingestion/tests/integration/trino/conftest.py @@ -13,7 +13,6 @@ from tenacity import retry, retry_if_exception_type, stop_after_delay, wait_fixed from testcontainers.core.container import DockerContainer from testcontainers.core.generic import DbContainer -from testcontainers.minio import MinioContainer from testcontainers.mysql import MySqlContainer from _openmetadata_testutils.helpers.docker import try_bind @@ -30,7 +29,7 @@ ) from ..conftest import ingestion_config as base_ingestion_config # noqa: F401, TID252 -from ..containers import MinioContainerConfigs # noqa: TID252 +from ..containers import S3ContainerConfigs, get_s3_container # noqa: TID252 HIVE_METASTORE_IMAGE = ( "bitsondatadev/hive-metastore@sha256:b44a186b6dcffafc6a72327aaa5912a5824feecb50718aaf661727ff6aef011b" @@ -145,7 +144,7 @@ def docker_network(): @pytest.fixture(scope="package") -def trino_container(hive_metastore_container, minio_container, docker_network): +def trino_container(hive_metastore_container, s3_container, docker_network): container = ( TrinoContainer(image="trinodb/trino:418") .with_network(docker_network) @@ -154,8 +153,8 @@ def trino_container(hive_metastore_container, minio_container, docker_network): f"thrift://metastore:{hive_metastore_container.port}", ) .with_env( - "MINIO_ENDPOINT", - f"http://minio:{minio_container.port}", + "S3_ENDPOINT", + f"http://s3:{s3_container.port}", ) ) with try_bind(container, container.port, container.port + 1) as trino: @@ -174,7 +173,7 @@ def mysql_container(docker_network): @pytest.fixture(scope="package") -def hive_metastore_container(mysql_container, minio_container, docker_network): +def hive_metastore_container(mysql_container, s3_container, docker_network): with ( HiveMetaStoreContainer(HIVE_METASTORE_IMAGE) .with_network(docker_network) @@ -186,20 +185,21 @@ def hive_metastore_container(mysql_container, minio_container, docker_network): f"jdbc:mysql://mariadb:{mysql_container.port}/{mysql_container.dbname}", ) .with_env( - "MINIO_ENDPOINT", - f"http://minio:{minio_container.port}", + "S3_ENDPOINT", + f"http://s3:{s3_container.port}", ) as hive ): yield hive @pytest.fixture(scope="package") -def minio_container(docker_network): - container = MinioContainer(MinioContainerConfigs.image).with_network(docker_network).with_network_aliases("minio") - with try_bind(container, container.port, container.port) as minio: - client = minio.get_client() - client.make_bucket("hive-warehouse") - yield minio +def s3_container(docker_network): + # The Trino catalog and Hive metastore configs authenticate as these credentials. + config = S3ContainerConfigs(access_key="hiveaccesskey", secret_key="hivesecretkey") + container = get_s3_container(config).with_network(docker_network).with_network_aliases("s3") + with try_bind(container, config.port, config.port) as s3: + s3.get_client().make_bucket("hive-warehouse") + yield s3 @pytest.fixture(scope="package") diff --git a/ingestion/tests/integration/trino/hive/Dockerfile b/ingestion/tests/integration/trino/hive/Dockerfile index eec58520002e..703ad0873a6e 100644 --- a/ingestion/tests/integration/trino/hive/Dockerfile +++ b/ingestion/tests/integration/trino/hive/Dockerfile @@ -3,7 +3,7 @@ FROM ${BASE_IMAGE} COPY conf/metastore-site.xml /opt/apache-hive-metastore-3.0.0-bin/conf/metastore-site.xml COPY entrypoint.sh /entrypoint.sh ENV JDBC_CONNECTION_URL="" -ENV MINIO_ENDPOINT="" +ENV S3_ENDPOINT="" USER root RUN chmod +x /entrypoint.sh USER hive diff --git a/ingestion/tests/integration/trino/hive/conf/metastore-site.xml b/ingestion/tests/integration/trino/hive/conf/metastore-site.xml index bee736fbacb4..b62d5c4aafac 100644 --- a/ingestion/tests/integration/trino/hive/conf/metastore-site.xml +++ b/ingestion/tests/integration/trino/hive/conf/metastore-site.xml @@ -34,15 +34,15 @@ fs.s3a.access.key - minioadmin + hiveaccesskey fs.s3a.secret.key - minioadmin + hivesecretkey fs.s3a.endpoint - %MINIO_ENDPOINT% + %S3_ENDPOINT% fs.s3a.path.style.access diff --git a/ingestion/tests/integration/trino/hive/entrypoint.sh b/ingestion/tests/integration/trino/hive/entrypoint.sh index 8862209c63c8..a2fb4861b391 100644 --- a/ingestion/tests/integration/trino/hive/entrypoint.sh +++ b/ingestion/tests/integration/trino/hive/entrypoint.sh @@ -7,7 +7,7 @@ export METASTORE_DB_HOSTNAME=${METASTORE_DB_HOSTNAME:-localhost} export METASTORE_TYPE=${METASTORE_TYPE:-mysql} sed -i "s|%JDBC_CONNECTION_URL%|${JDBC_CONNECTION_URL}|g" /opt/apache-hive-metastore-3.0.0-bin/conf/metastore-site.xml -sed -i "s|%MINIO_ENDPOINT%|${MINIO_ENDPOINT}|g" /opt/apache-hive-metastore-3.0.0-bin/conf/metastore-site.xml +sed -i "s|%S3_ENDPOINT%|${S3_ENDPOINT}|g" /opt/apache-hive-metastore-3.0.0-bin/conf/metastore-site.xml MYSQL='mysql' POSTGRES='postgres' diff --git a/ingestion/tests/integration/trino/trino/Dockerfile b/ingestion/tests/integration/trino/trino/Dockerfile index 98c0ab84592b..5b5709ee7b63 100644 --- a/ingestion/tests/integration/trino/trino/Dockerfile +++ b/ingestion/tests/integration/trino/trino/Dockerfile @@ -1,5 +1,5 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} -ENV MINIO_ENDPOINT="" +ENV S3_ENDPOINT="" ENV HIVE_METASTORE_URI="" COPY etc /etc/trino \ No newline at end of file diff --git a/ingestion/tests/integration/trino/trino/etc/catalog/minio.properties b/ingestion/tests/integration/trino/trino/etc/catalog/minio.properties index 1ef0314b4694..4f3ac27a1f60 100644 --- a/ingestion/tests/integration/trino/trino/etc/catalog/minio.properties +++ b/ingestion/tests/integration/trino/trino/etc/catalog/minio.properties @@ -1,9 +1,9 @@ connector.name=hive hive.metastore.uri=${ENV:HIVE_METASTORE_URI} hive.s3.path-style-access=true -hive.s3.endpoint=${ENV:MINIO_ENDPOINT} -hive.s3.aws-access-key=minioadmin -hive.s3.aws-secret-key=minioadmin +hive.s3.endpoint=${ENV:S3_ENDPOINT} +hive.s3.aws-access-key=hiveaccesskey +hive.s3.aws-secret-key=hivesecretkey hive.non-managed-table-writes-enabled=true hive.s3select-pushdown.enabled=true hive.storage-format=ORC diff --git a/openmetadata-integration-tests/src/test/java/org/openmetadata/it/bootstrap/TestSuiteBootstrap.java b/openmetadata-integration-tests/src/test/java/org/openmetadata/it/bootstrap/TestSuiteBootstrap.java index 3aeacb140b40..fd2f4dfbe8b7 100644 --- a/openmetadata-integration-tests/src/test/java/org/openmetadata/it/bootstrap/TestSuiteBootstrap.java +++ b/openmetadata-integration-tests/src/test/java/org/openmetadata/it/bootstrap/TestSuiteBootstrap.java @@ -146,7 +146,7 @@ public class TestSuiteBootstrap implements LauncherSessionListener { private static GenericContainer FUSEKI_CONTAINER; private static GenericContainer REDIS_CONTAINER; private static K3sContainer K3S_CONTAINER; - private static GenericContainer MINIO_CONTAINER; + private static GenericContainer OBJECT_STORAGE_CONTAINER; private static DropwizardAppExtension APP; private static final List> ADDITIONAL_APPS = java.util.Collections.synchronizedList(new ArrayList<>()); @@ -635,14 +635,14 @@ private void startApplication() throws Exception { createIndices(); - // Start MinIO before app boot if object storage is configured to use S3 so that the + // Start object storage before app boot if it is configured to use S3 so that the // S3AssetService picks up the correct endpoint. if (config.getObjectStorage() != null && config.getObjectStorage().isEnabled() && "s3".equalsIgnoreCase(config.getObjectStorage().getProvider())) { - setupMinIO(); + setupObjectStorage(); if (config.getObjectStorage().getS3Configuration() != null) { - config.getObjectStorage().getS3Configuration().setEndpoint(getMinIOEndpoint()); + config.getObjectStorage().getS3Configuration().setEndpoint(getObjectStorageEndpoint()); } } @@ -936,40 +936,43 @@ private void cleanup() { } try { - if (MINIO_CONTAINER != null) { - MINIO_CONTAINER.stop(); + if (OBJECT_STORAGE_CONTAINER != null) { + OBJECT_STORAGE_CONTAINER.stop(); } } catch (Exception e) { - LOG.warn("Error stopping MinIO container", e); + LOG.warn("Error stopping object storage container", e); } } - // === On-demand MinIO container for object-storage tests === + // === On-demand S3 container for object-storage tests === - public static synchronized void setupMinIO() { - if (MINIO_CONTAINER != null && MINIO_CONTAINER.isRunning()) { - LOG.info("MinIO already running at {}", getMinIOEndpoint()); + public static synchronized void setupObjectStorage() { + if (OBJECT_STORAGE_CONTAINER != null && OBJECT_STORAGE_CONTAINER.isRunning()) { + LOG.info("Object storage already running at {}", getObjectStorageEndpoint()); return; } - LOG.info("Starting MinIO Testcontainer on-demand..."); - // Pin the MinIO image to a known-good release so a newly-published :latest tag - // cannot break integration tests without a code change. Pull from quay.io: MinIO - // deleted the minio/minio repository from Docker Hub, and Docker Hub reports a - // removed repository as "pull access denied ... may require 'docker login'". - MINIO_CONTAINER = - new GenericContainer<>("quay.io/minio/minio:RELEASE.2024-01-16T16-07-38Z") + LOG.info("Starting S3Proxy Testcontainer on-demand..."); + // S3Proxy stands in for MinIO, whose image was deleted from Docker Hub. It does not + // implement bucket lifecycle or object tagging, which S3LogStorage and the asset + // service already treat as best-effort. Pin the tag so a newly-published :latest + // cannot break integration tests without a code change. + OBJECT_STORAGE_CONTAINER = + new GenericContainer<>("andrewgaul/s3proxy:4.1.1") .withExposedPorts(9000) - .withEnv("MINIO_ROOT_USER", "minio") - .withEnv("MINIO_ROOT_PASSWORD", "minio123") - .withCommand("server /data") + .withEnv("S3PROXY_ENDPOINT", "http://0.0.0.0:9000") + .withEnv("S3PROXY_AUTHORIZATION", "aws-v2-or-v4") + .withEnv("S3PROXY_IDENTITY", "accesskey") + .withEnv("S3PROXY_CREDENTIAL", "secretkey") .waitingFor( - Wait.forHttp("/minio/health/live") + // S3Proxy has no health endpoint; an unauthenticated GET / answers 403 + // as soon as it is serving requests. + Wait.forHttp("/") .forPort(9000) - .forStatusCode(200) + .forStatusCodeMatching(code -> code == 403 || code == 200) .withStartupTimeout(java.time.Duration.ofSeconds(60))); - MINIO_CONTAINER.start(); + OBJECT_STORAGE_CONTAINER.start(); - String endpoint = getMinIOEndpoint(); + String endpoint = getObjectStorageEndpoint(); // Create the default test bucket so tests can upload immediately. software.amazon.awssdk.services.s3.S3Client s3 = @@ -978,7 +981,7 @@ public static synchronized void setupMinIO() { .credentialsProvider( software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create( software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create( - "minio", "minio123"))) + "accesskey", "secretkey"))) .endpointOverride(java.net.URI.create(endpoint)) .serviceConfiguration( software.amazon.awssdk.services.s3.S3Configuration.builder() @@ -999,16 +1002,20 @@ public static synchronized void setupMinIO() { } // Expose endpoint to tests that read a system property / env var. - System.setProperty("IT_MINIO_ENDPOINT", endpoint); + System.setProperty("IT_S3_ENDPOINT", endpoint); - LOG.info("MinIO started at {}", endpoint); + LOG.info("Object storage started at {}", endpoint); } - public static String getMinIOEndpoint() { - if (MINIO_CONTAINER == null || !MINIO_CONTAINER.isRunning()) { - throw new IllegalStateException("MinIO container not running. Call setupMinIO() first."); + public static String getObjectStorageEndpoint() { + if (OBJECT_STORAGE_CONTAINER == null || !OBJECT_STORAGE_CONTAINER.isRunning()) { + throw new IllegalStateException( + "Object storage container not running. Call setupObjectStorage() first."); } - return "http://" + MINIO_CONTAINER.getHost() + ":" + MINIO_CONTAINER.getMappedPort(9000); + return "http://" + + OBJECT_STORAGE_CONTAINER.getHost() + + ":" + + OBJECT_STORAGE_CONTAINER.getMappedPort(9000); } // === Static accessor methods for tests === diff --git a/openmetadata-integration-tests/src/test/java/org/openmetadata/it/drive/DriveFileUploadIT.java b/openmetadata-integration-tests/src/test/java/org/openmetadata/it/drive/DriveFileUploadIT.java index f9c8dd319a8b..e789f428a5e9 100644 --- a/openmetadata-integration-tests/src/test/java/org/openmetadata/it/drive/DriveFileUploadIT.java +++ b/openmetadata-integration-tests/src/test/java/org/openmetadata/it/drive/DriveFileUploadIT.java @@ -77,13 +77,13 @@ import software.amazon.awssdk.services.s3.model.S3Object; /** - * Integration test for Context Center Drive file upload with MinIO-backed S3 storage using + * Integration test for Context Center Drive file upload with S3-backed object storage using * fixture files from src/test/resources. */ @ExtendWith(TestNamespaceExtension.class) class DriveFileUploadIT { - private static final String MINIO_BUCKET = "test-bucket"; + private static final String S3_BUCKET = "test-bucket"; private static final String TIKA_TESSERACT_PATH_PROPERTY = "collate.tika.tesseract.path"; private static final Duration EXTRACTION_TIMEOUT = Duration.ofSeconds(60); private static final Duration SEARCH_VISIBLE_TIMEOUT = Duration.ofSeconds(60); @@ -195,7 +195,7 @@ private ContextFile readCreatedContextFile(Response response, String failurePref private String resolveStoredObjectKey(S3Client s3Client, String assetId) { return s3Client - .listObjectsV2Paginator(ListObjectsV2Request.builder().bucket(MINIO_BUCKET).build()) + .listObjectsV2Paginator(ListObjectsV2Request.builder().bucket(S3_BUCKET).build()) .contents() .stream() .map(S3Object::key) @@ -204,22 +204,22 @@ private String resolveStoredObjectKey(S3Client s3Client, String assetId) { .orElse(null); } - private S3Client buildMinioClient() { + private S3Client buildS3Client() { return S3Client.builder() .region(Region.US_EAST_1) .credentialsProvider( - StaticCredentialsProvider.create(AwsBasicCredentials.create("minio", "minio123"))) + StaticCredentialsProvider.create(AwsBasicCredentials.create("accesskey", "secretkey"))) .endpointOverride( URI.create( System.getProperty( - "IT_MINIO_ENDPOINT", - System.getenv().getOrDefault("IT_MINIO_ENDPOINT", "http://localhost:9000")))) + "IT_S3_ENDPOINT", + System.getenv().getOrDefault("IT_S3_ENDPOINT", "http://localhost:9000")))) .serviceConfiguration(S3Configuration.builder().pathStyleAccessEnabled(true).build()) .build(); } - private void assertStoredInMinIO(String assetId, byte[] expectedBytes) { - try (S3Client s3Client = buildMinioClient()) { + private void assertStoredInS3(String assetId, byte[] expectedBytes) { + try (S3Client s3Client = buildS3Client()) { await() .pollDelay(Duration.ZERO) .pollInterval(Duration.ofMillis(200)) @@ -230,15 +230,15 @@ private void assertStoredInMinIO(String assetId, byte[] expectedBytes) { assertNotNull(objectKey, "Expected uploaded object for asset " + assetId); try (ResponseInputStream objectStream = s3Client.getObject( - GetObjectRequest.builder().bucket(MINIO_BUCKET).key(objectKey).build())) { + GetObjectRequest.builder().bucket(S3_BUCKET).key(objectKey).build())) { assertArrayEquals(expectedBytes, objectStream.readAllBytes()); } }); } } - private void assertRemovedFromMinIO(String assetId) { - try (S3Client s3Client = buildMinioClient()) { + private void assertRemovedFromS3(String assetId) { + try (S3Client s3Client = buildS3Client()) { await() .pollInterval(POLL_INTERVAL) .atMost(Duration.ofSeconds(10)) @@ -413,17 +413,17 @@ private void deleteRecursively(Path root) throws IOException { } @Test - void testUploadPdfToMinIO(TestNamespace ns) throws Exception { + void testUploadPdfToS3(TestNamespace ns) throws Exception { byte[] content = readFixture("/drive/sample-report.pdf"); ContextFile file; try (Response response = uploadUniqueFixture(ns, "/drive/sample-report.pdf", "Annual Report")) { - file = readCreatedContextFile(response, "Upload to MinIO failed"); + file = readCreatedContextFile(response, "Upload to S3 failed"); assertNotNull(file.getId()); assertNotNull(file.getAssetId(), "File should have assetId from S3 upload"); assertNotNull(file.getHeadContentId(), "File should point at a current content snapshot"); assertEquals("Annual Report", file.getDisplayName()); assertEquals(content.length, file.getFileSize().intValue()); - assertStoredInMinIO(file.getAssetId(), content); + assertStoredInS3(file.getAssetId(), content); } ContextFile refreshed = awaitProcessed(file.getId(), "Context Center PDF Fixture"); @@ -431,7 +431,7 @@ void testUploadPdfToMinIO(TestNamespace ns) throws Exception { } @Test - void testUploadSpreadsheetToMinIO(TestNamespace ns) throws Exception { + void testUploadSpreadsheetToS3(TestNamespace ns) throws Exception { byte[] content = readFixture("/drive/sample-pricing.xlsx"); Response response = uploadUniqueFixture(ns, "/drive/sample-pricing.xlsx", "Pricing Sheet"); @@ -443,7 +443,7 @@ void testUploadSpreadsheetToMinIO(TestNamespace ns) throws Exception { } @Test - void testUploadCsvToMinIO(TestNamespace ns) throws Exception { + void testUploadCsvToS3(TestNamespace ns) throws Exception { byte[] content = readFixture("/drive/sample-data.csv"); String uploadedFileName = uniqueUploadedFileName(ns, "/drive/sample-data.csv"); Response response = uploadFixture("/drive/sample-data.csv", uploadedFileName, null, null); @@ -616,7 +616,7 @@ void testUploadRejectsDuplicateFileNameCaseInsensitiveInRoot(TestNamespace ns) t assertEquals(CREATED.getStatusCode(), resp1.getStatus(), "First upload failed: " + body1); ContextFile file = JsonUtils.readValue(body1, ContextFile.class); assertEquals("First Title", file.getDisplayName()); - assertStoredInMinIO(file.getAssetId(), content); + assertStoredInS3(file.getAssetId(), content); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp2.getStatus(), body2); assertTrue(body2.contains("duplicate.pdf")); @@ -645,7 +645,7 @@ void testUploadRejectsDuplicateFileNameCaseInsensitiveInSameFolder(TestNamespace ContextFile file = JsonUtils.readValue(body1, ContextFile.class); assertEquals("Nested First", file.getDisplayName()); assertEquals(folder.getId(), file.getFolder().getId()); - assertStoredInMinIO(file.getAssetId(), content); + assertStoredInS3(file.getAssetId(), content); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp2.getStatus(), body2); assertTrue(body2.contains("nestedduplicate.txt")); @@ -667,7 +667,7 @@ void testUploadRejectsDuplicateSanitizedFileName() throws Exception { assertEquals(CREATED.getStatusCode(), resp1.getStatus(), "First upload failed: " + body1); ContextFile file = JsonUtils.readValue(body1, ContextFile.class); assertEquals(expectedName, file.getName()); - assertStoredInMinIO(file.getAssetId(), content); + assertStoredInS3(file.getAssetId(), content); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp2.getStatus(), body2); assertTrue(body2.contains(expectedName)); @@ -704,8 +704,8 @@ void testUploadAllowsSameFileNameInDifferentFolders(TestNamespace ns) throws Exc assertEquals(secondFolder.getId(), secondFile.getFolder().getId()); assertEquals("First Folder Title", firstFile.getDisplayName()); assertEquals("Second Folder Different Title", secondFile.getDisplayName()); - assertStoredInMinIO(firstFile.getAssetId(), content); - assertStoredInMinIO(secondFile.getAssetId(), content); + assertStoredInS3(firstFile.getAssetId(), content); + assertStoredInS3(secondFile.getAssetId(), content); } } @@ -956,19 +956,19 @@ void testSoftDeletedFileCanDownloadFromTrash(TestNamespace ns) throws Exception } @Test - void testHardDeleteRemovesObjectFromMinIO(TestNamespace ns) throws Exception { + void testHardDeleteRemovesObjectFromS3(TestNamespace ns) throws Exception { byte[] content = readFixture("/drive/sample-notes.txt"); RestClient rest = RestClient.admin(); Response uploadResponse = uploadUniqueFixture(ns, "/drive/sample-notes.txt", "Hard Delete"); ContextFile file = readCreatedContextFile(uploadResponse, "Upload failed"); - assertStoredInMinIO(file.getAssetId(), content); + assertStoredInS3(file.getAssetId(), content); rest.hardDelete("v1/contextCenter/drive/files", file.getId()); // Hard delete is asynchronous: the server returns 200 immediately, then a background // worker soft-deletes (if needed), removes search/relationship state, drops the row, - // and unlinks the object from MinIO. Under CI load this chain can take well over 10s, + // and unlinks the object from S3. Under CI load this chain can take well over 10s, // so poll with a generous ceiling rather than gambling on a tight window. await() .pollInterval(Duration.ofMillis(200)) @@ -980,6 +980,6 @@ void testHardDeleteRemovesObjectFromMinIO(TestNamespace ns) throws Exception { assertEquals(404, deletedResponse.getStatus()); } }); - assertRemovedFromMinIO(file.getAssetId()); + assertRemovedFromS3(file.getAssetId()); } } diff --git a/openmetadata-integration-tests/src/test/resources/openmetadata-secure-test.yaml b/openmetadata-integration-tests/src/test/resources/openmetadata-secure-test.yaml index 7ff24e907b97..0f7c624010cc 100644 --- a/openmetadata-integration-tests/src/test/resources/openmetadata-secure-test.yaml +++ b/openmetadata-integration-tests/src/test/resources/openmetadata-secure-test.yaml @@ -112,8 +112,8 @@ objectStorage: s3: bucketName: test-bucket region: us-east-1 - accessKey: minio - secretKey: minio123 + accessKey: accesskey + secretKey: secretkey endpoint: http://placeholder:9000 # RDF Configuration - will be dynamically configured by TestSuiteBootstrap