Rather override request_checksum_calculation by user's config 50/74850/1 stable/2025.1
authorCédric Ollivier <cedric.ollivier@orange.com>
Thu, 10 Apr 2025 13:24:46 +0000 (15:24 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Thu, 10 Apr 2025 13:26:35 +0000 (15:26 +0200)
cat ~/.aws/config
[default]
request_checksum_calculation = WHEN_REQUIRED
response_checksum_validation = WHEN_REQUIRED

Change-Id: I27842b255e0c154d0cbacf9c4e240b8852fddcff
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit 4884e75bcd12e27afb68aabad33667430e4346f9)

xtesting/core/campaign.py
xtesting/core/testcase.py
xtesting/tests/unit/core/test_testcase.py

index 7220743..98b2f1a 100644 (file)
@@ -183,10 +183,7 @@ class Campaign():
                     for filename in files:
                         zfile.write(os.path.join(root, filename))
             b3resource = boto3.resource(
-                's3', endpoint_url=os.environ["S3_ENDPOINT_URL"],
-                config=botocore.config.Config(
-                    request_checksum_calculation="when_required",
-                    response_checksum_validation="when_required"))
+                's3', endpoint_url=os.environ["S3_ENDPOINT_URL"])
             dst_s3_url = os.environ["S3_DST_URL"]
             multipart_threshold = 5 * 1024 ** 5 if "google" in os.environ[
                 "S3_ENDPOINT_URL"] else 8 * 1024 * 1024
index 65d875f..559f35a 100644 (file)
@@ -285,10 +285,7 @@ class TestCase(metaclass=abc.ABCMeta):
         """
         try:
             b3resource = boto3.resource(
-                's3', endpoint_url=os.environ["S3_ENDPOINT_URL"],
-                config=botocore.config.Config(
-                    request_checksum_calculation="when_required",
-                    response_checksum_validation="when_required"))
+                's3', endpoint_url=os.environ["S3_ENDPOINT_URL"])
             dst_s3_url = os.environ["S3_DST_URL"]
             multipart_threshold = 5 * 1024 ** 5 if "google" in os.environ[
                 "S3_ENDPOINT_URL"] else 8 * 1024 * 1024
index 2e48169..f7d1b94 100644 (file)
@@ -354,16 +354,14 @@ class TestCaseTesting(unittest.TestCase):
         self.assertEqual(self.test.publish_artifacts(),
                          testcase.TestCase.EX_PUBLISH_ARTIFACTS_ERROR)
         args[0].assert_called_once_with(
-            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-            config=mock.ANY)
+            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
 
     @mock.patch('boto3.resource', side_effect=Exception)
     def test_publish_artifacts_exc3(self, *args):
         self.assertEqual(self.test.publish_artifacts(),
                          testcase.TestCase.EX_PUBLISH_ARTIFACTS_ERROR)
         args[0].assert_called_once_with(
-            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-            config=mock.ANY)
+            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
 
     @mock.patch('boto3.resource')
     def test_publish_artifacts_exc4(self, *args):
@@ -371,8 +369,7 @@ class TestCaseTesting(unittest.TestCase):
         self.assertEqual(self.test.publish_artifacts(),
                          testcase.TestCase.EX_PUBLISH_ARTIFACTS_ERROR)
         args[0].assert_called_once_with(
-            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-            config=mock.ANY)
+            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
 
     @mock.patch('boto3.resource')
     def test_publish_artifacts_exc5(self, *args):
@@ -383,8 +380,7 @@ class TestCaseTesting(unittest.TestCase):
         self.assertEqual(self.test.publish_artifacts(),
                          testcase.TestCase.EX_PUBLISH_ARTIFACTS_ERROR)
         args[0].assert_called_once_with(
-            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-            config=mock.ANY)
+            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
 
     @mock.patch('mimetypes.guess_type', return_value=(None, None))
     @mock.patch('boto3.resource')
@@ -394,8 +390,7 @@ class TestCaseTesting(unittest.TestCase):
                          testcase.TestCase.EX_OK)
         args[0].assert_called_once_with(self.test.res_dir)
         args[1].assert_called_once_with(
-            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-            config=mock.ANY)
+            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
 
     @mock.patch('mimetypes.guess_type', return_value=(None, None))
     @mock.patch('boto3.resource')
@@ -409,8 +404,7 @@ class TestCaseTesting(unittest.TestCase):
                          testcase.TestCase.EX_OK)
         args[0].assert_called_once_with(self.test.res_dir)
         args[1].assert_called_once_with(
-            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-            config=mock.ANY)
+            's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
 
     @mock.patch('mimetypes.guess_type', return_value=(None, None))
     @mock.patch('os.path.exists', return_value=True)
@@ -423,9 +417,7 @@ class TestCaseTesting(unittest.TestCase):
                          testcase.TestCase.EX_OK)
         args[0].assert_called_once_with(self.test.res_dir)
         expected = [
-            mock.call(
-                's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-                config=mock.ANY),
+            mock.call('s3', endpoint_url=os.environ['S3_ENDPOINT_URL']),
             mock.call().meta.client.head_bucket(Bucket='xtesting'),
             mock.call().Bucket('xtesting'),
             mock.call().Bucket().upload_file(
@@ -459,9 +451,7 @@ class TestCaseTesting(unittest.TestCase):
                          testcase.TestCase.EX_OK)
         args[0].assert_called_once_with(self.test.res_dir)
         expected = [
-            mock.call(
-                's3', endpoint_url=os.environ['S3_ENDPOINT_URL'],
-                config=mock.ANY),
+            mock.call('s3', endpoint_url=os.environ['S3_ENDPOINT_URL']),
             mock.call().meta.client.head_bucket(Bucket='xtesting'),
             mock.call().Bucket('xtesting'),
             mock.call().Bucket().upload_file(