Skip to content

Commit

Permalink
Use the correct endpoints for minio s3
Browse files Browse the repository at this point in the history
  • Loading branch information
javiermtorres committed Jan 10, 2025
1 parent 8a6a7d1 commit 091cb6b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lumigator/python/mzai/backend/backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import uuid
from pathlib import Path
from unittest.mock import Mock, patch
from unittest.mock import MagicMock, patch

import boto3
import fsspec
Expand Down Expand Up @@ -130,32 +130,32 @@ def fake_s3fs() -> S3FileSystem:
@pytest.fixture(scope="function")
def fake_s3_client(fake_s3fs) -> S3Client:
"""Provide a fake S3 client using MemoryFileSystem as underlying storage."""
os.environ["AWS_ACCESS_KEY_ID"] = "test"
os.environ["AWS_ACCESS_KEY_ID"] = "lumigator"
# Please check https://github.com/localstack/localstack/issues/5894
# for info about the test region used
os.environ["AWS_DEFAULT_REGION"] = "us-east-1"
os.environ["AWS_SECRET_ACCESS_KEY"] = "test" # pragma: allowlist secret
os.environ["AWS_ENDPOINT_URL"] = "http://example.com:4566"
os.environ["AWS_DEFAULT_REGION"] = "us-east-2"
os.environ["AWS_SECRET_ACCESS_KEY"] = "lumigator" # pragma: allowlist secret
os.environ["AWS_ENDPOINT_URL"] = "http://example.com:9000"
return FakeS3Client(MemoryFileSystem.store)


@pytest.fixture(scope="function")
def boto_s3_client() -> S3Client:
"""Provide a real S3 client."""
os.environ["AWS_ACCESS_KEY_ID"] = "test"
os.environ["AWS_ACCESS_KEY_ID"] = "lumigator"
# Please check https://github.com/localstack/localstack/issues/5894
# for info about the test region used
os.environ["AWS_DEFAULT_REGION"] = "us-east-1"
os.environ["AWS_SECRET_ACCESS_KEY"] = "test" # pragma: allowlist secret
os.environ["AWS_ENDPOINT_URL"] = "http://localhost:4566"
os.environ["AWS_DEFAULT_REGION"] = "us-east-2"
os.environ["AWS_SECRET_ACCESS_KEY"] = "lumigator" # pragma: allowlist secret
os.environ["AWS_ENDPOINT_URL"] = "http://localhost:9000"
return boto3.client("s3")


@pytest.fixture(scope="function")
def boto_s3fs() -> S3FileSystem:
"""Provide a real s3fs client."""
s3fs = S3FileSystem()
mock_s3fs = Mock(wraps=s3fs)
mock_s3fs = MagicMock(wraps=s3fs)
yield mock_s3fs
logger.info(f"intercepted s3fs calls: {str(mock_s3fs.mock_calls)}")

Expand Down

0 comments on commit 091cb6b

Please sign in to comment.