def test_irsync_r_dir_to_coll(self): # pick session(s) for the test test_session = self.user_sessions[0] # make test dir dir_name = 'irsync_test_dir' dir_path = os.path.join(self.local_test_dir_path, dir_name) local_files = lib.make_large_local_tmp_dir( dir_path, self.config['test_file_count'], self.config['test_file_size']) # test specific parameters parameters = self.config.copy() parameters['dir_path'] = dir_path parameters['dir_name'] = dir_name parameters['user_name'] = test_session.username parameters['remote_home_collection'] = "/{remote_zone}/home/{user_name}#{local_zone}".format( **parameters) # sync dir with remote collection test_session.assert_icommand( "irsync -r {dir_path} i:{remote_home_collection}/{dir_name}".format(**parameters)) # new collection should be there test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDOUT_SINGLELINE', dir_name) # files should be there rods_files = set(lib.ils_output_to_entries( test_session.run_icommand(['ils', "{remote_home_collection}/{dir_name}".format(**parameters)])[1])) self.assertTrue(set(local_files) == rods_files) # cleanup test_session.assert_icommand( "irm -rf {remote_home_collection}/{dir_name}".format(**parameters)) shutil.rmtree(dir_path)
def test_msirmcoll(self): # pick session(s) for the test test_session = self.user_sessions[0] # make test dir dir_name = 'msiRmColl_test_dir' dir_path = os.path.join(self.local_test_dir_path, dir_name) local_files = lib.make_large_local_tmp_dir( dir_path, self.config['test_file_count'], self.config['test_file_size']) # test specific parameters parameters = self.config.copy() parameters['dir_path'] = dir_path parameters['dir_name'] = dir_name parameters['user_name'] = test_session.username parameters[ 'remote_home_collection'] = "/{remote_zone}/home/{user_name}#{local_zone}".format( **parameters) # put dir in remote collection test_session.assert_icommand( "iput -r {dir_path} {remote_home_collection}/".format( **parameters)) # new collection should be there test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDOUT_SINGLELINE', dir_name) # files should be there rods_files = set( lib.ils_output_to_entries( test_session.run_icommand([ 'ils', "{remote_home_collection}/{dir_name}".format(**parameters) ])[1])) self.assertTrue(set(local_files) == rods_files) # prepare irule sequence # the rule is simple enough not to need a rule file irule_str = '''irule "msiRmColl(*coll, 'forceFlag=', *status); writeLine('stdout', *status)" "*coll={remote_home_collection}/{dir_name}" "ruleExecOut"'''.format( **parameters) # invoke msiRmColl() and checks that it returns 0 test_session.assert_icommand(irule_str, 'STDOUT', '^0$', use_regex=True) # collection should be gone test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDERR_SINGLELINE', 'does not exist') # cleanup shutil.rmtree(dir_path)
def test_icp_r(self): # pick session(s) for the test test_session = self.user_sessions[0] # make test dir dir_name = 'icp_test_dir' dir_path = os.path.join(self.local_test_dir_path, dir_name) local_files = lib.make_large_local_tmp_dir( dir_path, self.config['test_file_count'], self.config['test_file_size']) # test specific parameters parameters = self.config.copy() parameters['dir_path'] = dir_path parameters['dir_name'] = dir_name parameters['user_name'] = test_session.username parameters['local_home_collection'] = test_session.home_collection parameters['remote_home_collection'] = "/{remote_zone}/home/{user_name}#{local_zone}".format( **parameters) # put dir in local collection test_session.assert_icommand( "iput -r {dir_path} {local_home_collection}/".format(**parameters)) # remove local test dir shutil.rmtree(dir_path) # copy dir to remote home collection test_session.assert_icommand( "icp -r {local_home_collection}/{dir_name} {remote_home_collection}/{dir_name}".format(**parameters)) # collection should be there test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDOUT_SINGLELINE', dir_name) # files should be there rods_files = set(lib.ils_output_to_entries( test_session.run_icommand(['ils', "{remote_home_collection}/{dir_name}".format(**parameters)])[1])) self.assertTrue(set(local_files) == rods_files) # get collection back test_session.assert_icommand( "iget -r {remote_home_collection}/{dir_name} {dir_path}".format(**parameters)) # compare list of files received_files = os.listdir(dir_path) self.assertTrue(set(local_files) == set(received_files)) # cleanup test_session.assert_icommand( "irm -rf {local_home_collection}/{dir_name}".format(**parameters)) test_session.assert_icommand( "irm -rf {remote_home_collection}/{dir_name}".format(**parameters)) shutil.rmtree(dir_path)
def test_irm_rf(self): # pick session(s) for the test test_session = self.user_sessions[0] # make test dir dir_name = 'irm_test_dir' dir_path = os.path.join(self.local_test_dir_path, dir_name) local_files = lib.make_large_local_tmp_dir( dir_path, self.config['test_file_count'], self.config['test_file_size']) # test specific parameters parameters = self.config.copy() parameters['dir_path'] = dir_path parameters['dir_name'] = dir_name parameters['user_name'] = test_session.username parameters[ 'remote_home_collection'] = "/{remote_zone}/home/{user_name}#{local_zone}".format( **parameters) # put dir in remote collection test_session.assert_icommand( "iput -r {dir_path} {remote_home_collection}/".format( **parameters)) # new collection should be there test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDOUT_SINGLELINE', dir_name) # files should be there rods_files = set( lib.ils_output_to_entries( test_session.run_icommand([ 'ils', "{remote_home_collection}/{dir_name}".format(**parameters) ])[1])) self.assertTrue(set(local_files) == rods_files) # remove remote coll test_session.assert_icommand( "irm -rf {remote_home_collection}/{dir_name}".format(**parameters)) # coll should be gone test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDERR_SINGLELINE', 'does not exist') # cleanup shutil.rmtree(dir_path)
def test_msirmcoll(self): # pick session(s) for the test test_session = self.user_sessions[0] # make test dir dir_name = 'msiRmColl_test_dir' dir_path = os.path.join(self.local_test_dir_path, dir_name) local_files = lib.make_large_local_tmp_dir( dir_path, self.config['test_file_count'], self.config['test_file_size']) # test specific parameters parameters = self.config.copy() parameters['dir_path'] = dir_path parameters['dir_name'] = dir_name parameters['user_name'] = test_session.username parameters['remote_home_collection'] = "/{remote_zone}/home/{user_name}#{local_zone}".format( **parameters) # put dir in remote collection test_session.assert_icommand( "iput -r {dir_path} {remote_home_collection}/".format(**parameters)) # new collection should be there test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDOUT_SINGLELINE', dir_name) # files should be there rods_files = set(lib.ils_output_to_entries( test_session.run_icommand(['ils', "{remote_home_collection}/{dir_name}".format(**parameters)])[1])) self.assertTrue(set(local_files) == rods_files) # prepare irule sequence # the rule is simple enough not to need a rule file irule_str = '''irule "msiRmColl(*coll, 'forceFlag=', *status); writeLine('stdout', *status)" "*coll={remote_home_collection}/{dir_name}" "ruleExecOut"'''.format( **parameters) # invoke msiRmColl() and checks that it returns 0 test_session.assert_icommand( irule_str, 'STDOUT', '^0$', use_regex=True) # collection should be gone test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDERR_SINGLELINE', 'does not exist') # cleanup shutil.rmtree(dir_path)
def test_irsync_r_coll_to_coll(self): # pick session(s) for the test test_session = self.user_sessions[0] # make test dir dir_name = 'irsync_test_dir' dir_path = os.path.join(self.local_test_dir_path, dir_name) local_files = lib.make_large_local_tmp_dir( dir_path, self.config['test_file_count'], self.config['test_file_size']) # test specific parameters parameters = self.config.copy() parameters['dir_path'] = dir_path parameters['dir_name'] = dir_name parameters['user_name'] = test_session.username parameters['local_home_collection'] = test_session.home_collection parameters[ 'remote_home_collection'] = "/{remote_zone}/home/{user_name}#{local_zone}".format( **parameters) # put dir in local collection test_session.assert_icommand( "iput -r {dir_path} {local_home_collection}/".format(**parameters)) # remove local test dir shutil.rmtree(dir_path) # sync local collection with remote collection test_session.assert_icommand( "irsync -r i:{local_home_collection}/{dir_name} i:{remote_home_collection}/{dir_name}" .format(**parameters)) # collection should be there test_session.assert_icommand( "ils -L {remote_home_collection}/{dir_name}".format(**parameters), 'STDOUT_SINGLELINE', dir_name) # files should be there rods_files = set( lib.ils_output_to_entries( test_session.run_icommand([ 'ils', "{remote_home_collection}/{dir_name}".format(**parameters) ])[1])) self.assertTrue(set(local_files) == rods_files) # get collection back test_session.assert_icommand( "iget -r {remote_home_collection}/{dir_name} {dir_path}".format( **parameters)) # compare list of files received_files = os.listdir(dir_path) self.assertTrue(set(local_files) == set(received_files)) # cleanup test_session.assert_icommand( "irm -rf {local_home_collection}/{dir_name}".format(**parameters)) test_session.assert_icommand( "irm -rf {remote_home_collection}/{dir_name}".format(**parameters)) shutil.rmtree(dir_path)