Minio support#51
Conversation
| access_key=access_key, | ||
| secret_key=secret_key, | ||
| secure=secure | ||
| ) |
There was a problem hiding this comment.
Ideally the test credentials will be included in a shared instance of the MockClient class across a test module. For example,
class MockClient:
def __init__(self, project=None, credentials=None):
self.project = project
# endpoint = credentials.get('endpoint', 'localhost:9000')
access_key = credentials.get('access_key', 'minioadmin')
secret_key = credentials.get('secret_key', 'minioadmin')
secure = credentials.get('secure', False)
self._credentials = credentials
# Pytest fixture to create a shared MockClient instance for the test module
@pytest.fixture(scope="module")
def mock_client():
# Create and return a shared instance of MockClient
client = MockClient()
return client
Here in get_minio_client, you can just return the Minio instance initiated from the previous keys, and remove the default values. Move these values to a test file. Create a tests folder and test for bucket cors. For example, client/amapy-plugin-s3/amapy_plugin_s3/tests/test_aws_storage.py
| def update_cors(data: dict): | ||
| store_url = BlobStoreURL(url=data.get("remote_url")) | ||
| update_by_host_name = {"s3": s3_update_cors, "gs": gcs_update_cors} | ||
| update_by_host_name = {"s3": s3_update_cors, "gs": gcs_update_cors, "minio": minio_update_cors} |
There was a problem hiding this comment.
Here actually the original update_cors() code was flawed, it should have leveraged the AssetStorage class's set_bucket_cors.
for example,
with created.storage(server=True):
remote_url = Config.shared().get_storage_url() # get remote_url from the current project
storage = StorageFactory.storage_for_url(src_url=remote_url) #check the usage of this line, it returns the AssetStorage instance
storage.set_bucket_cors(credentials=data.get("credentials_server"),
bucket_name=store_url.bucket,
origin_url=Configs.shared().frontend_url)
@guptam38-roche Could you help to refactor this? Thanks
There was a problem hiding this comment.
Also, test it using either the api call or asset dashboard create project feature, and check MinIO admin console to verify, it should work like before the refactor.
… minio_support
…a into minio_support
|
@guptam38-roche please allow me to test it today |
Overview:
This PR adds support for MinIO as a storage backend, expanding our storage options beyond the existing solutions. MinIO is an open-source, high-performance, S3-compatible object storage system that can be deployed anywhere.
Changes:
Test:
Steps on How to use:
Access the MinIO Console at http://localhost:9001
Login with:
Enter project-bucket as the bucket name
Click "Create Bucket"
Creating a Project with MinIO Storage
Make a POST request to create a project with MinIO storage: