Index: tools/telemetry/third_party/gsutilz/gslib/tests/util.py |
diff --git a/tools/telemetry/third_party/gsutilz/gslib/tests/util.py b/tools/telemetry/third_party/gsutilz/gslib/tests/util.py |
index 06da870bf8170ff8ee4b39b6ea028da57d0e795b..7b1e20438dd7cb0b4d10a67bf3d937e71c15b891 100644 |
--- a/tools/telemetry/third_party/gsutilz/gslib/tests/util.py |
+++ b/tools/telemetry/third_party/gsutilz/gslib/tests/util.py |
@@ -26,7 +26,9 @@ import unittest |
import urlparse |
import boto |
+import crcmod |
import gslib.tests as gslib_tests |
+from gslib.util import UsingCrcmodExtension |
if not hasattr(unittest.TestCase, 'assertIsNone'): |
# external dependency unittest2 required for Python <= 2.6 |
@@ -226,12 +228,12 @@ def _RevertBotoConfig(revert_list): |
boto.config.remove_section(section) |
-def PerformsFileToObjectUpload(func): |
- """Decorator indicating that a test uploads from a local file to an object. |
+def SequentialAndParallelTransfer(func): |
+ """Decorator for tests that perform file to object transfers, or vice versa. |
This forces the test to run once normally, and again with special boto |
config settings that will ensure that the test follows the parallel composite |
- upload code path. |
+ upload and/or sliced object download code paths. |
Args: |
func: Function to wrap. |
@@ -244,11 +246,14 @@ def PerformsFileToObjectUpload(func): |
# Run the test normally once. |
func(*args, **kwargs) |
- # Try again, forcing parallel composite uploads. |
- with SetBotoConfigForTest([ |
- ('GSUtil', 'parallel_composite_upload_threshold', '1'), |
- ('GSUtil', 'check_hashes', 'always')]): |
- func(*args, **kwargs) |
+ if not RUN_S3_TESTS and UsingCrcmodExtension(crcmod): |
+ # Try again, forcing parallel upload and sliced download. |
+ with SetBotoConfigForTest([ |
+ ('GSUtil', 'parallel_composite_upload_threshold', '1'), |
+ ('GSUtil', 'sliced_object_download_threshold', '1'), |
+ ('GSUtil', 'sliced_object_download_max_components', '3'), |
+ ('GSUtil', 'check_hashes', 'always')]): |
+ func(*args, **kwargs) |
return Wrapper |