self.admin.assert_icommand("ils -L "+self.testfile,'STDOUT_SINGLELINE',self.testfile)# should be listed twice
self.admin.assert_icommand("irm -n 0 "+self.testfile)# remove original from cacheResc only
self.admin.assert_icommand("ils -L "+self.testfile,'STDOUT_SINGLELINE',["2 "+self.testresc,self.testfile])# replica 2 should still be there
self.admin.assert_icommand_fail("ils -L "+self.testfile,'STDOUT_SINGLELINE',["0 "+self.admin.default_resource,self.testfile])# replica 0 should be gone
trashpath=self.admin.session_collection_trash
self.admin.assert_icommand_fail("ils -L "+trashpath+"/"+self.testfile,'STDOUT_SINGLELINE',["0 "+self.admin.default_resource,self.testfile])# replica should not be in trash
@unittest.skip("--wlock has possible race condition due to Compound/Replication PDMO")
deftest_local_iput_collision_with_wlock(self):
pass
@unittest.skip("NOTSURE / FIXME ... -K not supported, perhaps")
deftest_local_iput_checksum(self):
pass
@unittest.skip("EMPTY_RESC_PATH - no vault path for coordinating resources")
deftest_ireg_as_rodsuser_in_vault(self):
pass
@unittest.skip("No Vault for S3 archive resource")
self.admin.assert_icommand("ils -L "+filename,'STDERR_SINGLELINE',"does not exist")# should not be listed
self.admin.assert_icommand("iput "+filename)# put file
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',filename)# for debugging
self.admin.assert_icommand("irepl -R "+self.testresc+" "+filename)# replicate to test resource
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',filename)# for debugging
self.admin.assert_icommand("iput -f %s %s"%(doublefile,filename))# overwrite default repl with different data
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 0 "," & "+filename])# default resource cache should have clean copy
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 0 "," "+doublesize+" "," & "+filename])# default resource cache should have new double clean copy
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 1 "," & "+filename])# default resource archive should have clean copy
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 1 "," "+doublesize+" "," & "+filename])# default resource archive should have new double clean copy
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',[" 2 "+self.testresc," "+doublesize+" "," "+filename])# test resource should not have doublesize file
self.admin.assert_icommand("irepl -R "+self.testresc+" "+filename)# replicate back onto test resource
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 2 "+self.testresc," "+doublesize+" "," & "+filename])# test resource should have new clean doublesize file
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',[" 3 "," & "+filename])# should not have a replica 3
# local cleanup
os.remove(filepath)
os.remove(doublefile)
deftest_iput_with_purgec(self):
# local setup
filename="purgecfile.txt"
filepath=os.path.abspath(filename)
f=open(filepath,'wb')
f.write("TESTFILE -- ["+filepath+"]")
f.close()
# assertions
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',filename)# should not be listed
self.admin.assert_icommand("iput --purgec "+filename)# put file
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',[" 0 ",filename])# should not be listed (trimmed)
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 1 ",filename])# should be listed once - replica 1
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',[" 2 ",filename])# should be listed only once
# local cleanup
output=commands.getstatusoutput('rm '+filepath)
deftest_iget_with_purgec(self):
# local setup
filename="purgecgetfile.txt"
filepath=os.path.abspath(filename)
f=open(filepath,'wb')
f.write("TESTFILE -- ["+filepath+"]")
f.close()
# assertions
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',filename)# should not be listed
self.admin.assert_icommand("iput "+filename)# put file
self.admin.assert_icommand("iget -f --purgec "+filename)# get file and purge 'cached' replica
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',[" 0 ",filename])# should not be listed (trimmed)
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 1 ",filename])# should be listed once
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',[" 2 ",filename])# should not be listed
# local cleanup
output=commands.getstatusoutput('rm '+filepath)
deftest_irepl_with_purgec(self):
# local setup
filename="purgecreplfile.txt"
filepath=os.path.abspath(filename)
f=open(filepath,'wb')
f.write("TESTFILE -- ["+filepath+"]")
f.close()
# assertions
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',filename)# should not be listed
self.admin.assert_icommand("iput "+filename)# put file
self.admin.assert_icommand("irepl -R "+self.testresc+" --purgec "+filename)# replicate to test resource
self.admin.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',[" 0 ",filename])# should not be listed (trimmed)
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 1 ",filename])# should be listed twice - 2 of 3
self.admin.assert_icommand("ils -L "+filename,'STDOUT_SINGLELINE',[" 2 ",filename])# should be listed twice - 1 of 3
# local cleanup
output=commands.getstatusoutput('rm '+filepath)
deftest_decoupled_naming_policy(self):
ifself.archive_naming_policy!='decoupled':
self.skipTest("Archive naming policy is not set to 'decoupled'")
# local setup
filename="testfile.txt"
filepath=os.path.abspath(filename)
f=open(filepath,'wb')
f.write("TESTFILE -- ["+filepath+"]")
f.close()
# run as regular user
session=self.user0
collection=session.session_collection
# iquest to get the object id of the replica on the S3 archive
id_query=("select DATA_ID where COLL_NAME ="+"'"+collection+"'"+
" and DATA_NAME ="+"'"+filename+"'"+
" and DATA_REPL_NUM ='1'")
# iquest to get the pysical path of the replica on the S3 archive
path_query=("select DATA_PATH where COLL_NAME ="+"'"+collection+"'"+
" and DATA_NAME ="+"'"+filename+"'"+
" and DATA_REPL_NUM ='1'")
# assertions
session.assert_icommand_fail("ils -L "+filename,'STDOUT_SINGLELINE',filename)# should not be listed
session.assert_icommand("iput "+filename)# put file