]> git.apps.os.sepia.ceph.com Git - s3-tests.git/commitdiff
add test_get_object_torrent
authorCasey Bodley <cbodley@redhat.com>
Sun, 19 Feb 2023 17:32:47 +0000 (12:32 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 14 Mar 2023 17:43:08 +0000 (13:43 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit bb27e04c456cc1b551d898a6814cda307f960de4)

s3tests_boto3/functional/test_s3.py

index e4c70526d7d337975cedf23a9ff5d290bb317e59..b8c638feb6eb5e9521a7785b4e73b30efdc633b0 100644 (file)
@@ -12786,3 +12786,24 @@ def test_sse_s3_encrypted_upload_1mb():
 @pytest.mark.fails_on_dbstore
 def test_sse_s3_encrypted_upload_8mb():
     _test_sse_s3_encrypted_upload(8*1024*1024)
+
+def test_get_object_torrent():
+    client = get_client()
+    bucket_name = get_new_bucket()
+    key = 'Avatar.mpg'
+
+    file_size = 7 * 1024 * 1024
+    data = 'A' * file_size
+
+    client.put_object(Bucket=bucket_name, Key=key, Body=data)
+
+    response = None
+    try:
+        response = client.get_object_torrent(Bucket=bucket_name, Key=key)
+        # if successful, verify the torrent contents are different from the body
+        assert data != _get_body(response)
+    except ClientError as e:
+        # accept 404 errors - torrent support may not be configured
+        status, error_code = _get_status_and_error_code(e.response)
+        assert status == 404
+        assert error_code == 'NoSuchKey'