Skip to content

Commit

Permalink
Merge branch 'master' into Add-generic-AWS-S3-domain-support
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Aug 17, 2023
2 parents a97fe58 + 7346685 commit 146435a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2737,6 +2737,8 @@ def upload_snowball_objects(self, bucket_name, object_list, metadata=None,
if not name:
length = fileobj.tell()
fileobj.seek(0)
else:
length = os.stat(name).st_size

if name:
return self.fput_object(bucket_name, object_name, staging_filename,
Expand Down
18 changes: 17 additions & 1 deletion tests/functional/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ def test_remove_bucket(log_entry):
_CLIENT.remove_bucket(bucket_name)


def test_upload_snowball_objects(log_entry):
def _test_upload_snowball_objects(log_entry, staging_filename=None):
"""Test upload_snowball_objects()."""

# Get a unique bucket_name
Expand All @@ -1883,13 +1883,28 @@ def test_upload_snowball_objects(log_entry):
mod_time=datetime.now(),
),
],
staging_filename=staging_filename
)
_test_list_objects_api(bucket_name, 3)
finally:
_CLIENT.remove_object(bucket_name, "my-object1")
_CLIENT.remove_object(bucket_name, "my-object2")
_CLIENT.remove_object(bucket_name, "my-object3")
_CLIENT.remove_bucket(bucket_name)
if staging_filename and os.path.exists(staging_filename):
os.remove(staging_filename)


def test_upload_snowball_objects(log_entry):
"""Test upload_snowball_objects()."""
_test_upload_snowball_objects(log_entry)


def test_upload_snowball_objects_with_staging( # pylint: disable=invalid-name
log_entry):
"""Test upload_snowball_objects() with staging file."""
staging_filename = f"{uuid4()}.tar"
_test_upload_snowball_objects(log_entry, staging_filename)


def main():
Expand Down Expand Up @@ -1989,6 +2004,7 @@ def main():
test_get_bucket_notification: None,
test_select_object_content: None,
test_upload_snowball_objects: None,
test_upload_snowball_objects_with_staging: None,
}
else:
tests = {
Expand Down

0 comments on commit 146435a

Please sign in to comment.