in testSuite/scripts/utility.py [0:0]
def initialize_test_suite(test_dir_path, container_sas, container_oauth, container_oauth_validate, share_sas_url, premium_container_sas, filesystem_url, filesystem_sas_url,
s2s_src_blob_account_url, s2s_src_file_account_url, s2s_src_s3_service_url, s2s_src_gcp_service_url, s2s_dst_blob_account_url, azcopy_exec_location, test_suite_exec_location):
# test_directory_path is global variable holding the location of test directory to execute all the test cases.
# contents are created, copied, uploaded and downloaded to and from this test directory only
global test_directory_path
# test_container_url is a global variable used in the entire testSuite holding the user given container shared access signature.
# all files / directory are uploaded and downloaded to and from this container.
global test_container_url
# test_oauth_container_url is a global variable used in the entire testSuite holding the user given container for oAuth testing.
# all files / directory are uploaded and downloaded to and from this container.
global test_oauth_container_url
# test_container_oauth_validate_sas_url is same container as test_oauth_container_url, while for validation purpose.
global test_oauth_container_validate_sas_url
# test_premium_account_contaier_url is a global variable used in the entire test suite holding the user given container sas of premium storage account container.
global test_premium_account_contaier_url
# test_share_url is a global variable used in the entire testSuite holding the user given share URL with shared access signature.
# all files / directory are uploaded and downloaded to and from this share.
global test_share_url
# holds the name of the azcopy executable
global azcopy_executable_name
# holds the name of the test suite executable
global test_suite_executable_name
# holds the filesystem url to perform the operations for blob fs service
global test_bfs_account_url
global test_bfs_sas_account_url
# holds account for s2s copy tests
global test_s2s_src_blob_account_url
global test_s2s_dst_blob_account_url
global test_s2s_src_file_account_url
global test_s2s_src_s3_service_url
global test_s2s_src_gcp_service_url
# creating a test_directory in the location given by user.
# this directory will be used to created and download all the test files.
new_dir_path = os.path.join(test_dir_path, "test_data")
# todo finally
try:
# removing the directory and its contents, if directory exists
shutil.rmtree(new_dir_path)
os.mkdir(new_dir_path)
except:
os.mkdir(new_dir_path)
# copying the azcopy executable to the newly created test directory.
# this copying is done to avoid using the executables at location which might be used by the user
# while test suite is running.
if os.path.isfile(azcopy_exec_location):
shutil.copy2(azcopy_exec_location, new_dir_path)
azcopy_executable_name = parse_out_executable_name(azcopy_exec_location)
else:
print("please verify the azcopy executable location")
return False
# copying the test executable to the newly created test directory.
# this copying is done to avoid using the executables at location which might be used by the user
# while test suite is running.
if os.path.isfile(test_suite_exec_location):
shutil.copy2(test_suite_exec_location, new_dir_path)
test_suite_executable_name = parse_out_executable_name(test_suite_exec_location)
else:
print("please verify the test suite executable location")
return False
test_directory_path = new_dir_path
test_bfs_account_url = filesystem_url
test_bfs_sas_account_url = filesystem_sas_url
if not (test_bfs_account_url.endswith("/") and test_bfs_account_url.endswith("\\")):
test_bfs_account_url = test_bfs_account_url + "/"
test_container_url = container_sas
test_oauth_container_url = container_oauth
if not (test_oauth_container_url.endswith("/") and test_oauth_container_url.endwith("\\")):
test_oauth_container_url = test_oauth_container_url + "/"
test_oauth_container_validate_sas_url = container_oauth_validate
test_premium_account_contaier_url = premium_container_sas
test_s2s_src_blob_account_url = s2s_src_blob_account_url
test_s2s_src_file_account_url = s2s_src_file_account_url
test_s2s_dst_blob_account_url = s2s_dst_blob_account_url
test_s2s_src_s3_service_url = s2s_src_s3_service_url
test_s2s_src_gcp_service_url = s2s_src_gcp_service_url
test_share_url = share_sas_url
if not clean_test_filesystem(test_bfs_account_url.rstrip("/").rstrip("\\")): # rstrip because clean fails if trailing /
print("failed to clean test filesystem.")
if not clean_test_container(test_container_url):
print("failed to clean test blob container.")
if not clean_test_container(test_oauth_container_validate_sas_url):
print("failed to clean OAuth test blob container.")
if not clean_test_container(test_premium_account_contaier_url):
print("failed to clean premium container.")
if not clean_test_blob_account(test_s2s_src_blob_account_url):
print("failed to clean s2s blob source account.")
if not clean_test_file_account(test_s2s_src_file_account_url):
print("failed to clean s2s file source account.")
if not clean_test_blob_account(test_s2s_dst_blob_account_url):
print("failed to clean s2s blob destination account.")
if not clean_test_s3_account(test_s2s_src_s3_service_url):
print("failed to clean s3 account.")
if not clean_test_gcp_account(test_s2s_src_gcp_service_url):
print("failed to clean GCS account")
if not clean_test_share(test_share_url):
print("failed to clean test share.")
return True