Skip to content

Commit

Permalink
Minor fix to enable S3 smoke tests if S3_TESTS_OFF is present but empty
Browse files Browse the repository at this point in the history
  • Loading branch information
zezha-msft committed Oct 17, 2019
1 parent 9953324 commit dd5f21f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 21 additions & 21 deletions testSuite/scripts/test_service_to_service_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,76 +302,76 @@ def test_copy_single_17mb_file_from_file_to_blob_oauth(self):
# Test from S3 to blob copy.
##################################
def test_copy_single_1kb_file_from_s3_to_blob(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_single_file_from_x_to_x(src_bucket_url, "S3", dst_container_url, "Blob", 1)

def test_copy_single_0kb_file_from_s3_to_blob(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_single_file_from_x_to_x(src_bucket_url, "S3", dst_container_url, "Blob", 0)

def test_copy_single_63mb_file_from_s3_to_blob(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_single_file_from_x_to_x(src_bucket_url, "S3", dst_container_url, "Blob", 63 * 1024 * 1024)

def test_copy_10_files_from_s3_bucket_to_blob_container(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_n_files_from_x_bucket_to_x_bucket(src_bucket_url, "S3", dst_container_url, "Blob")

def test_copy_10_files_from_s3_bucket_to_blob_account(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
self.util_test_copy_n_files_from_s3_bucket_to_blob_account(src_bucket_url, util.test_s2s_dst_blob_account_url)

def test_copy_file_from_s3_bucket_to_blob_container_strip_top_dir_recursive(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_file_from_x_bucket_to_x_bucket_strip_top_dir(src_bucket_url, "S3", dst_container_url, "Blob", True)

def test_copy_file_from_s3_bucket_to_blob_container_strip_top_dir_non_recursive(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_file_from_x_bucket_to_x_bucket_strip_top_dir(src_bucket_url, "S3", dst_container_url, "Blob", False)

def test_copy_n_files_from_s3_dir_to_blob_dir(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_n_files_from_x_dir_to_x_dir(src_bucket_url, "S3", dst_container_url, "Blob")

def test_copy_n_files_from_s3_dir_to_blob_dir_strip_top_dir_recursive(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_n_files_from_x_dir_to_x_dir_strip_top_dir(src_bucket_url, "S3", dst_container_url, "Blob", True)

def test_copy_n_files_from_s3_dir_to_blob_dir_strip_top_dir_non_recursive(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
self.util_test_copy_n_files_from_x_dir_to_x_dir_strip_top_dir(src_bucket_url, "S3", dst_container_url, "Blob", False)

def test_copy_files_from_s3_service_to_blob_account(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
self.util_test_copy_files_from_x_account_to_x_account(
util.test_s2s_src_s3_service_url,
Expand All @@ -381,7 +381,7 @@ def test_copy_files_from_s3_service_to_blob_account(self):
self.bucket_name_s3_blob)

def test_copy_single_file_from_s3_to_blob_propertyandmetadata(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand All @@ -392,7 +392,7 @@ def test_copy_single_file_from_s3_to_blob_propertyandmetadata(self):
"Blob")

def test_copy_single_file_from_s3_to_blob_no_preserve_propertyandmetadata(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand All @@ -404,7 +404,7 @@ def test_copy_single_file_from_s3_to_blob_no_preserve_propertyandmetadata(self):
False)

def test_copy_file_from_s3_bucket_to_blob_container_propertyandmetadata(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand All @@ -415,7 +415,7 @@ def test_copy_file_from_s3_bucket_to_blob_container_propertyandmetadata(self):
"Blob")

def test_copy_file_from_s3_bucket_to_blob_container_no_preserve_propertyandmetadata(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand All @@ -427,7 +427,7 @@ def test_copy_file_from_s3_bucket_to_blob_container_no_preserve_propertyandmetad
False)

def test_overwrite_copy_single_file_from_s3_to_blob(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand All @@ -440,7 +440,7 @@ def test_overwrite_copy_single_file_from_s3_to_blob(self):
True)

def test_non_overwrite_copy_single_file_from_s3_to_blob(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand All @@ -453,7 +453,7 @@ def test_non_overwrite_copy_single_file_from_s3_to_blob(self):
False)

def test_copy_single_file_from_s3_to_blob_with_url_encoded_slash_as_filename(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
src_bucket_url = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dst_container_url = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand All @@ -467,7 +467,7 @@ def test_copy_single_file_from_s3_to_blob_with_url_encoded_slash_as_filename(sel
"%252F") #encoded name for %2F, as path will be decoded

def test_copy_single_file_from_s3_to_blob_excludeinvalidmetadata(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
self.util_test_copy_single_file_from_s3_to_blob_handleinvalidmetadata(
"", # By default it should be ExcludeIfInvalid
Expand All @@ -476,7 +476,7 @@ def test_copy_single_file_from_s3_to_blob_excludeinvalidmetadata(self):
)

def test_copy_single_file_from_s3_to_blob_renameinvalidmetadata(self):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
self.util_test_copy_single_file_from_s3_to_blob_handleinvalidmetadata(
"RenameIfInvalid", # By default it should be ExcludeIfInvalid
Expand All @@ -490,7 +490,7 @@ def util_test_copy_single_file_from_s3_to_blob_handleinvalidmetadata(
invalidMetadataHandleOption,
srcS3Metadata,
expectResolvedMetadata):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
self.skipTest('S3 testing is disabled for this smoke test run.')
srcBucketURL = util.get_object_without_sas(util.test_s2s_src_s3_service_url, self.bucket_name_s3_blob)
dstBucketURL = util.get_object_sas(util.test_s2s_dst_blob_account_url, self.bucket_name_s3_blob)
Expand Down
2 changes: 1 addition & 1 deletion testSuite/scripts/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def clean_test_blob_account(account):
return True

def clean_test_s3_account(account):
if 'S3_TESTS_OFF' in os.environ:
if 'S3_TESTS_OFF' in os.environ and os.environ['S3_TESTS_OFF'] != "":
return True
result = Command("clean").add_arguments(account).add_flags("serviceType", "S3").add_flags("resourceType", "Account").execute_azcopy_clean()
if not result:
Expand Down

0 comments on commit dd5f21f

Please sign in to comment.