]> git.apps.os.sepia.ceph.com Git - s3-tests.git/commitdiff
s3: disable checksum calculation for test_object_create_bad_contentlength_negative
authorCasey Bodley <cbodley@redhat.com>
Fri, 14 Feb 2025 16:35:54 +0000 (11:35 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 14 Feb 2025 17:31:41 +0000 (12:31 -0500)
if tls is enabled, boto will switch to STREAMING-UNSIGNED-PAYLOAD-TRAILER
and omit the provided content-length header. this leads to test failure:

> ________________ test_object_create_bad_contentlength_negative _________________
>       e = assert_raises(ClientError, client.put_object, Bucket=bucket_name, Key=key_name, ContentLength=-1)
> AssertionError: ClientError not raised

Signed-off-by: Casey Bodley <cbodley@redhat.com>
s3tests_boto3/functional/test_headers.py

index 557f23460b47c09cf1082aa2122eff7c69be50e7..360a2e6643b82230d1891cb5f3302619de2f9183 100644 (file)
@@ -1,5 +1,6 @@
 import boto3
 import pytest
+import botocore.config
 from botocore.exceptions import ClientError
 from email.utils import formatdate
 
@@ -209,7 +210,10 @@ def test_object_create_bad_contentlength_empty():
 @pytest.mark.auth_common
 @pytest.mark.fails_on_mod_proxy_fcgi
 def test_object_create_bad_contentlength_negative():
-    client = get_client()
+    # to test Content-Length=-1, we have to prevent the checksum calculation
+    # from switching to STREAMING-UNSIGNED-PAYLOAD-TRAILER
+    config = botocore.config.Config(request_checksum_calculation = 'when_required')
+    client = get_client(config)
     bucket_name = get_new_bucket()
     key_name = 'foo'
     e = assert_raises(ClientError, client.put_object, Bucket=bucket_name, Key=key_name, ContentLength=-1)