Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix S3Bucket.load() for nested MinIO Credentials block (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingrismore authored Dec 18, 2023
1 parent 6aca613 commit 2d6dc28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Bug where `S3Bucket.load()` constructed `AwsCredentials` instead of `MinIOCredentials` - [#359](https://github.com/PrefectHQ/prefect-aws/pull/359)

### Deprecated

### Removed
Expand Down
5 changes: 1 addition & 4 deletions prefect_aws/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class S3Bucket(WritableFileSystem, WritableDeploymentStorage, ObjectStorageBlock

bucket_name: str = Field(default=..., description="Name of your bucket.")

credentials: Union[AwsCredentials, MinIOCredentials] = Field(
credentials: Union[MinIOCredentials, AwsCredentials] = Field(
default_factory=AwsCredentials,
description="A block containing your credentials to AWS or MinIO.",
)
Expand All @@ -425,9 +425,6 @@ class S3Bucket(WritableFileSystem, WritableDeploymentStorage, ObjectStorageBlock
),
)

class Config:
smart_union = True

# Property to maintain compatibility with storage block based deployments
@property
def basepath(self) -> str:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,11 @@ def s3_bucket_with_similar_objects(self, s3_bucket_with_objects, objects_in_fold

def test_credentials_are_correct_type(self, credentials):
s3_bucket = S3Bucket(bucket_name="bucket", credentials=credentials)
s3_bucket_parsed = S3Bucket.parse_obj(
{"bucket_name": "bucket", "credentials": dict(credentials)}
)
assert isinstance(s3_bucket.credentials, type(credentials))
assert isinstance(s3_bucket_parsed.credentials, type(credentials))

@pytest.mark.parametrize("client_parameters", aws_clients[-1:], indirect=True)
def test_list_objects_empty(self, s3_bucket_empty, client_parameters):
Expand Down

0 comments on commit 2d6dc28

Please sign in to comment.