def test_local_imkdir_with_parent(self): # local setup mytestdir = "parent/testingimkdirwithparent" # assertions assertiCmdFail(s.adminsession, "ils -L " + mytestdir, "LIST", mytestdir) # should not be listed assertiCmd(s.adminsession, "imkdir -p " + mytestdir) # imkdir with parent assertiCmd(s.adminsession, "ils -L " + mytestdir, "LIST", mytestdir) # should be listed
def test_local_imkdir(self): # local setup mytestdir = "testingimkdir" # assertions assertiCmdFail(s.adminsession, "ils -L " + mytestdir, "LIST", mytestdir) # should not be listed assertiCmd(s.adminsession, "imkdir " + mytestdir) # imkdir assertiCmd(s.adminsession, "ils -L " + mytestdir, "LIST", mytestdir) # should be listed
def test_modify_resource_comment(self): mycomment = "thisisacomment with some spaces" assertiCmdFail(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment) assertiCmd(s.adminsession, "iadmin modresc " + self.testresc + " comment '" + mycomment + "'") assertiCmd(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment) assertiCmd(s.adminsession, "iadmin modresc " + self.testresc + " comment 'none'") assertiCmdFail(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment)
def test_iadmin_mkuser(self): # A few examples of valid and invalid usernames valid = ['bob', 'jim-bob', 'boB', '123.456', '___haysoos___'] invalid = ['bo', '.bob', 'bob.', 'jim--bob', 'jamesbond..007', '________________________________longer_than_NAME_LEN________________________________________________'] # Test valid names for name in valid: assertiCmd(s.adminsession,"iadmin mkuser "+name+" rodsuser") # should be accepted assertiCmd(s.adminsession,"iadmin lu","LIST",name+"#"+s.adminsession.getZoneName()) # should be listed assertiCmd(s.adminsession,"iadmin rmuser "+name) # remove user assertiCmdFail(s.adminsession,"iadmin lu","LIST",name+"#"+s.adminsession.getZoneName()) # should be gone # Test invalid names for name in invalid: assertiCmd(s.adminsession,"iadmin mkuser "+name+" rodsuser","ERROR","SYS_INVALID_INPUT_PARAM") # should be rejected # Invalid names with special characters assertiCmd(s.adminsession,r"iadmin mkuser hawai\'i rodsuser","ERROR","SYS_INVALID_INPUT_PARAM") # should be rejected assertiCmd(s.adminsession,r"iadmin mkuser \\\/\!\*\?\|\$ rodsuser","ERROR","SYS_INVALID_INPUT_PARAM") # should be rejected
def test_set_resource_comment_to_emptystring_ticket_2434(self): mycomment = "notemptystring" assertiCmdFail(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment) assertiCmd(s.adminsession, "iadmin modresc " + self.testresc + " comment '" + mycomment + "'") assertiCmd(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment) assertiCmd(s.adminsession, "iadmin modresc " + self.testresc + " comment ''") assertiCmdFail(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment)
def test_local_iput_with_force_and_destination_resource__ticket_1706(self): # local setup filename = "iputwithforceanddestination.txt" filepath = create_local_testfile(filename) doublefile = "doublefile.txt" os.system("cat %s %s > %s" % (filename, filename, doublefile)) doublesize = str(os.stat(doublefile).st_size) # assertions assertiCmd(s.adminsession, "ils -L " + filename, "ERROR", "does not exist") # should not be listed assertiCmd(s.adminsession, "iput " + filename) # put file assertiCmd(s.adminsession, "irepl -R " + self.testresc + " " + filename) # replicate to test resource assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) assertiCmd(s.adminsession, "iput -f -R %s %s %s" % (self.testresc, doublefile, filename)) # overwrite test repl with different data assertiCmd( s.adminsession, "ils -L " + filename, "LIST", [" 0 ", " " + filename]) # default resource should have dirty copy assertiCmdFail(s.adminsession, "ils -L " + filename, "LIST", [" 0 ", " " + doublesize + " ", " " + filename ]) # default resource should not have doublesize file assertiCmd(s.adminsession, "ils -L " + filename, "LIST", [" 1 ", " " + doublesize + " ", "& " + filename ]) # targeted resource should have new double clean copy # local cleanup os.remove(filepath) os.remove(doublefile)
def test_local_imkdir_with_trailing_slash_already_exists(self): # local setup mytestdir = "testingimkdirwithslash" # assertions assertiCmd(s.adminsession, "imkdir " + mytestdir + "/") # imkdir assertiCmdFail(s.adminsession, "imkdir " + mytestdir) # should fail, already exists assertiCmdFail(s.adminsession, "imkdir " + mytestdir + "/") # should fail, already exists
def test_ireg_as_rodsuser_in_vault(self): # get vault base path cmdout = s.sessions[1].runCmd( 'iquest', ["%s", "select RESC_VAULT_PATH where RESC_NAME = 'demoResc'"]) vaultpath = cmdout[0].rstrip('\n') # make dir in vault if necessary dir = os.path.join(vaultpath, 'home', s.sessions[1].getUserName()) if not os.path.exists(dir): os.makedirs(dir) # create file in vault filename = "newfile.txt" filepath = os.path.join(dir, filename) f = open(filepath, 'wb') f.write("TESTFILE -- [" + filepath + "]") f.close() # assertions assertiCmd(s.adminsession, "ils -L " + filename, "ERROR", "does not exist") # should not be listed assertiCmd(s.sessions[1], "ireg " + filepath + " /" + s.sessions[1].getZoneName() + "/home/" + s.sessions[1].getUserName() + "/" + s.sessions[1].sessionId + "/" + filename, "ERROR", "PATH_REG_NOT_ALLOWED") # ireg assertiCmdFail(s.sessions[1], "ils -L " + filename, "LIST", filename) # should not be listed # local cleanup output = commands.getstatusoutput('rm ' + filepath)
def test_local_imkdir_with_trailing_slash(self): # local setup mytestdir = "testingimkdirwithslash" # assertions assertiCmdFail(s.adminsession, "ils -L " + mytestdir + "/", "LIST", mytestdir) # should not be listed assertiCmd(s.adminsession, "imkdir " + mytestdir + "/") # imkdir assertiCmd(s.adminsession, "ils -L " + mytestdir, "LIST", mytestdir) # should be listed
def test_irepl_over_existing_second_replica__ticket_1705(self): # local setup filename = "secondreplicatest.txt" filepath = create_local_testfile(filename) # assertions assertiCmd(s.adminsession, "ils -L " + filename, "ERROR", "does not exist") # should not be listed assertiCmd(s.adminsession, "iput -R " + self.testresc + " " + filename) # put file assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) # for debugging assertiCmd(s.adminsession, "irepl " + filename) # replicate to default resource assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) # for debugging assertiCmd(s.adminsession, "irepl " + filename) # replicate overtop default resource assertiCmdFail( s.adminsession, "ils -L " + filename, "LIST", [" 2 ", " & " + filename]) # should not have a replica 2 assertiCmd(s.adminsession, "irepl -R " + self.testresc + " " + filename) # replicate overtop test resource assertiCmdFail( s.adminsession, "ils -L " + filename, "LIST", [" 2 ", " & " + filename]) # should not have a replica 2 # local cleanup os.remove(filepath)
def test_iadmin_mkuser(self): # A few examples of valid and invalid usernames valid = ['bob', 'jim-bob', 'boB', '123.456', '___haysoos___'] invalid = [ 'bo', '.bob', 'bob.', 'jim--bob', 'jamesbond..007', '________________________________longer_than_NAME_LEN________________________________________________' ] # Test valid names for name in valid: assertiCmd(s.adminsession, "iadmin mkuser " + name + " rodsuser") # should be accepted assertiCmd(s.adminsession, "iadmin lu", "LIST", name + "#" + s.adminsession.getZoneName()) # should be listed assertiCmd(s.adminsession, "iadmin rmuser " + name) # remove user assertiCmdFail(s.adminsession, "iadmin lu", "LIST", name + "#" + s.adminsession.getZoneName()) # should be gone # Test invalid names for name in invalid: assertiCmd(s.adminsession, "iadmin mkuser " + name + " rodsuser", "ERROR", "SYS_INVALID_INPUT_PARAM") # should be rejected # Invalid names with special characters assertiCmd(s.adminsession, r"iadmin mkuser hawai\'i rodsuser", "ERROR", "SYS_INVALID_INPUT_PARAM") # should be rejected assertiCmd(s.adminsession, r"iadmin mkuser \\\/\!\*\?\|\$ rodsuser", "ERROR", "SYS_INVALID_INPUT_PARAM") # should be rejected
def test_local_imkdir_when_dir_already_exists(self): # local setup mytestdir = "testingimkdiralreadyexists" # assertions assertiCmd(s.adminsession, "imkdir " + mytestdir) # imkdir assertiCmdFail(s.adminsession, "imkdir " + mytestdir) # should fail, already exists
def test_local_iput_interrupt_largefile(self): # local setup datafilename = "bigfile" print "-------------------" print "creating " + datafilename + "..." output = commands.getstatusoutput('dd if=/dev/zero of=' + datafilename + ' bs=1M count=150') print output[1] assert output[0] == 0, "dd did not successfully exit" rf = "bigrestartfile" # assertions iputcmd = "iput --lfrestart " + rf + " " + datafilename if os.path.exists(rf): os.unlink(rf) interruptiCmd(s.adminsession, iputcmd, rf, 10) # once restartfile reaches 10 bytes assert os.path.exists(rf), rf + " should now exist, but did not" output = commands.getstatusoutput('cat ' + rf) print " restartfile [" + rf + "] contents --> [" + output[1] + "]" today = datetime.date.today() assertiCmd( s.adminsession, "ils -L " + datafilename, "LIST", [" 0 " + today.isoformat(), datafilename]) # will have zero length assertiCmd(s.adminsession, iputcmd, "LIST", datafilename + " was restarted successfully") # confirm the restart assertiCmdFail(s.adminsession, "ils -L " + datafilename, "LIST", [" 0 " + today.isoformat(), datafilename ]) # length should not be zero # local cleanup output = commands.getstatusoutput('rm ' + datafilename) output = commands.getstatusoutput('rm ' + rf)
def test_irm_recursive(self): assertiCmd(s.adminsession, "icp -r " + self.testdir + " copydir") # make a dir copy assertiCmd(s.adminsession, "ils -L ", "LIST", "copydir") # should be listed assertiCmd(s.adminsession, "irm -r copydir") # should remove assertiCmdFail(s.adminsession, "ils -L ", "LIST", "copydir") # should not be listed
def test_imeta_set_single_object_triple_to_double_empty_unit(self, user=None): if user is None: user = s.sessions[1].get_username() set_and_check_avu(user, 'att0', 'val0', 'unt0') set_and_check_avu(user, 'att0', 'val1', '""') assertiCmdFail(s.adminsession, 'imeta ls -u ' + user + ' att0', 'STDOUT', 'units: unt0')
def test_create_and_remove_unixfilesystem_resource_without_spaces(self): testresc1 = "testResc1" assertiCmdFail(s.adminsession,"iadmin lr","LIST",testresc1) # should not be listed output = commands.getstatusoutput("hostname") hostname = output[1] assertiCmd(s.adminsession,"iadmin mkresc "+testresc1+" unixfilesystem "+hostname+":/tmp/pydevtest_"+testresc1, "LIST", "Creating") # unix assertiCmd(s.adminsession,"iadmin lr","LIST",testresc1) # should be listed assertiCmd(s.adminsession,"iadmin rmresc "+testresc1) # good remove assertiCmdFail(s.adminsession,"iadmin lr","LIST",testresc1) # should be gone
def test_list_groups(self): assertiCmd(s.adminsession, "iadmin lg", "LIST", self.testgroup) assertiCmdFail(s.adminsession, "iadmin lg", "LIST", "notagroup") assertiCmd(s.adminsession, "iadmin lg " + self.testgroup, "LIST", [s.sessions[1].getUserName()]) assertiCmd(s.adminsession, "iadmin lg " + self.testgroup, "LIST", [s.sessions[2].getUserName()]) assertiCmdFail(s.adminsession, "iadmin lg " + self.testgroup, "LIST", "notauser")
def test_irm_specific_replica(self): assertiCmd(s.adminsession,"ils -L "+self.testfile,"LIST",self.testfile) # should be listed assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+self.testfile) # creates replica assertiCmd(s.adminsession,"ils -L "+self.testfile,"LIST",self.testfile) # should be listed twice assertiCmd(s.adminsession,"irm -n 0 "+self.testfile) # remove original from grid assertiCmd(s.adminsession,"ils -L "+self.testfile,"LIST",["1 "+self.testresc,self.testfile]) # replica 1 should be there assertiCmdFail(s.adminsession,"ils -L "+self.testfile,"LIST",["0 "+s.adminsession.getDefResource(),self.testfile]) # replica 0 should be gone trashpath = "/"+s.adminsession.getZoneName()+"/trash/home/"+s.adminsession.getUserName()+"/"+s.adminsession.sessionId assertiCmdFail(s.adminsession,"ils -L "+trashpath+"/"+self.testfile,"LIST",["0 "+s.adminsession.getDefResource(),self.testfile]) # replica should not be in trash
def test_irm_with_write_permission(self): assertiCmd(s.sessions[2], "icd ../../public") # switch to shared area assertiCmd(s.sessions[2], "ils -AL " + self.testfile, "LIST", self.testfile) # should be listed assertiCmdFail( s.sessions[2], "irm " + self.testfile) # write perm should not be allowed to remove assertiCmd(s.sessions[2], "ils -AL " + self.testfile, "LIST", self.testfile) # should still be listed
def test_imeta_set_single_object_triple_to_double_no_unit(self, user=None): if user is None: user = s.users[1]['name'] set_and_check_avu(user, 'att0', 'val0', 'unt0') set_and_check_avu(user, 'att0', 'val1', '') assertiCmdFail(s.adminsession, 'imeta ls -u ' + user + ' att0', 'STDOUT', 'units: unt0')
def test_mso_http(self): test_file_path = "/"+s.adminsession.getZoneName()+"/home/"+s.adminsession.getUserName()+"/"+s.adminsession.sessionId assertiCmd( s.adminsession, 'ireg -D mso -R archiveResc "//http://people.renci.org/~jasonc/irods/http_mso_test_file.txt" '+test_file_path+'/test_file.txt') assertiCmd( s.adminsession, 'iget -f '+test_file_path+'/test_file.txt') assertiCmdFail( s.adminsession, 'ils -L '+test_file_path+'/test_file.txt', 'STDOUT', ' -99 ') os.remove( 'test_file.txt' ) # unregister the object assertiCmd( s.adminsession, 'irm -U '+test_file_path+'/test_file.txt') assertiCmd( s.adminsession, 'ils -L', 'STDOUT', 'tempZone')
def test_modify_resource_comment(self): mycomment = "thisisacomment with some spaces" assertiCmdFail(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment) assertiCmd( s.adminsession, "iadmin modresc " + self.testresc + " comment '" + mycomment + "'") assertiCmd(s.adminsession, "iadmin lr " + self.testresc, "LIST", mycomment)
def test_imeta_set_single_object_abandoned_avu_triple_to_double_empty_unit(self): user = s.sessions[1].get_username() set_and_check_avu(user, 'att0', 'val0', 'unt0') assertiCmd(s.adminsession, 'imeta rm -u %s %s %s %s' % (user, 'att0', 'val0', 'unt0')) set_and_check_avu(user, 'att0', 'val0', '""') assertiCmdFail(s.adminsession, 'imeta ls -u ' + user + ' att0', 'STDOUT', 'units: unt0')
def test_irm(self): assertiCmd(s.adminsession, "ils -L " + self.testfile, "LIST", self.testfile) # should be listed assertiCmd(s.adminsession, "irm " + self.testfile) # remove from grid assertiCmdFail(s.adminsession, "ils -L " + self.testfile, "LIST", self.testfile) # should be deleted trashpath = "/" + s.adminsession.getZoneName( ) + "/trash/home/" + s.adminsession.getUserName( ) + "/" + s.adminsession.sessionId assertiCmd(s.adminsession, "ils -L " + trashpath + "/" + self.testfile, "LIST", self.testfile) # should be in trash
def test_create_and_remove_coordinating_resource(self): testresc1 = "testResc1" assertiCmdFail(s.adminsession,"iadmin lr","LIST",testresc1) # should not be listed output = commands.getstatusoutput("hostname") hostname = output[1] assertiCmd(s.adminsession,"iadmin mkresc "+testresc1+" replication", "LIST", "Creating") # replication assertiCmd(s.adminsession,"iadmin lr","LIST",testresc1) # should be listed assertiCmd(s.adminsession,"iadmin lr "+testresc1,"LIST",["resc_net","EMPTY_RESC_HOST"]) # should have empty host assertiCmd(s.adminsession,"iadmin lr "+testresc1,"LIST",["resc_def_path","EMPTY_RESC_PATH"]) # should have empty path assertiCmd(s.adminsession,"iadmin rmresc "+testresc1) # good remove assertiCmdFail(s.adminsession,"iadmin lr","LIST",testresc1) # should be gone
def test_irmtrash_admin(self): # assertions assertiCmd(s.adminsession, "irm " + self.testfile) # remove from grid assertiCmd(s.adminsession, "ils -rL /" + s.adminsession.getZoneName() + "/trash/home/" + s.adminsession.getUserName() + "/", "LIST", self.testfile) # should be listed assertiCmd(s.adminsession, "irmtrash") # should be listed assertiCmdFail(s.adminsession, "ils -rL /" + s.adminsession.getZoneName() + "/trash/home/" + s.adminsession.getUserName() + "/", "LIST", self.testfile) # should be deleted
def test_mso_http(self): test_file_path = "/" + s.adminsession.get_zone_name() + "/home/" + s.adminsession.get_username() + \ "/" + s.adminsession._session_id assertiCmd(s.adminsession, 'ireg -D mso -R archiveResc "//http://people.renci.org/~jasonc/irods/http_mso_test_file.txt" ' + test_file_path + '/test_file.txt') assertiCmd(s.adminsession, 'iget -f ' + test_file_path + '/test_file.txt') assertiCmdFail(s.adminsession, 'ils -L ' + test_file_path + '/test_file.txt', 'STDOUT', ' -99 ') os.remove('test_file.txt') # unregister the object assertiCmd(s.adminsession, 'irm -U ' + test_file_path + '/test_file.txt') assertiCmd(s.adminsession, 'ils -L', 'STDOUT', 'tempZone')
def test_local_iget_with_overwrite(self): # local setup localfile = "local.txt" # assertions assertiCmd(s.adminsession,"iget "+self.testfile+" "+localfile) # iget assertiCmdFail(s.adminsession,"iget "+self.testfile+" "+localfile) # already exists assertiCmd(s.adminsession,"iget -f "+self.testfile+" "+localfile) # already exists, so force output = commands.getstatusoutput( 'ls '+localfile ) print " output: ["+output[1]+"]" assert output[1] == localfile # local cleanup output = commands.getstatusoutput( 'rm '+localfile )
def test_local_iput_onto_specific_resource(self): # local setup datafilename = "anotherfile.txt" f = open(datafilename,'wb') f.write("TESTFILE -- ["+datafilename+"]") f.close() # assertions assertiCmdFail(s.adminsession,"ils -L "+datafilename,"LIST",datafilename) # should not be listed assertiCmd(s.adminsession,"iput -R "+self.testresc+" "+datafilename) # iput assertiCmd(s.adminsession,"ils -L "+datafilename,"LIST",datafilename) # should be listed assertiCmd(s.adminsession,"ils -L "+datafilename,"LIST",self.testresc) # should be listed # local cleanup output = commands.getstatusoutput( 'rm '+datafilename )
def test_imeta_set_single_object_abandoned_avu_triple_to_double_empty_unit( self): user = s.users[1]['name'] set_and_check_avu(user, 'att0', 'val0', 'unt0') assertiCmd(s.adminsession, 'imeta rm -u %s %s %s %s' % (user, 'att0', 'val0', 'unt0')) set_and_check_avu(user, 'att0', 'val0', '""') assertiCmdFail(s.adminsession, 'imeta ls -u ' + user + ' att0', 'STDOUT', 'units: unt0')
def test_local_iput(self): '''also needs to count and confirm number of replicas after the put''' # local setup datafilename = "newfile.txt" f = open(datafilename,'wb') f.write("TESTFILE -- ["+datafilename+"]") f.close() # assertions assertiCmdFail(s.adminsession,"ils -L "+datafilename,"LIST",datafilename) # should not be listed assertiCmd(s.adminsession,"iput "+datafilename) # iput assertiCmd(s.adminsession,"ils -L "+datafilename,"LIST",datafilename) # should be listed # local cleanup output = commands.getstatusoutput( 'rm '+datafilename )
def test_create_and_remove_unixfilesystem_resource_without_spaces(self): testresc1 = "testResc1" assertiCmdFail(s.adminsession, "iadmin lr", "LIST", testresc1) # should not be listed output = commands.getstatusoutput("hostname") hostname = output[1] assertiCmd(s.adminsession, "iadmin mkresc " + testresc1 + " unixfilesystem " + hostname + ":/tmp/pydevtest_" + testresc1, "LIST", "Creating") # unix assertiCmd(s.adminsession, "iadmin lr", "LIST", testresc1) # should be listed assertiCmd(s.adminsession, "iadmin rmresc " + testresc1) # good remove assertiCmdFail(s.adminsession, "iadmin lr", "LIST", testresc1) # should be gone
def test_ireg_as_rodsuser(self): # local setup filename = "newfile.txt" filepath = os.path.abspath(filename) f = open(filepath,'wb') f.write("TESTFILE -- ["+filepath+"]") f.close() # assertions assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.sessions[1],"ireg "+filepath+" /"+s.sessions[1].getZoneName()+"/home/"+s.sessions[1].getUserName()+"/"+s.sessions[1].sessionId+"/"+filename, "ERROR","PATH_REG_NOT_ALLOWED") # ireg assertiCmdFail(s.sessions[1],"ils -L "+filename,"LIST",filename) # should not be listed # local cleanup output = commands.getstatusoutput( 'rm '+filepath )
def test_local_iput(self): '''also needs to count and confirm number of replicas after the put''' # local setup datafilename = "newfile.txt" f = open(datafilename, 'wb') f.write("TESTFILE -- [" + datafilename + "]") f.close() # assertions assertiCmdFail(s.adminsession, "ils -L " + datafilename, "LIST", datafilename) # should not be listed assertiCmd(s.adminsession, "iput " + datafilename) # iput assertiCmd(s.adminsession, "ils -L " + datafilename, "LIST", datafilename) # should be listed # local cleanup output = commands.getstatusoutput('rm ' + datafilename)
def test_local_iget_with_overwrite(self): # local setup localfile = "local.txt" # assertions assertiCmd(s.adminsession, "iget " + self.testfile + " " + localfile) # iget assertiCmdFail(s.adminsession, "iget " + self.testfile + " " + localfile) # already exists assertiCmd(s.adminsession, "iget -f " + self.testfile + " " + localfile) # already exists, so force output = commands.getstatusoutput('ls ' + localfile) print " output: [" + output[1] + "]" assert output[1] == localfile # local cleanup output = commands.getstatusoutput('rm ' + localfile)
def test_irepl_over_existing_second_replica__ticket_1705(self): # local setup filename = "secondreplicatest.txt" filepath = create_local_testfile(filename) # assertions assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.adminsession,"iput -R "+self.testresc+" "+filename) # put file assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmd(s.adminsession,"irepl "+filename) # replicate to default resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmd(s.adminsession,"irepl "+filename) # replicate overtop default resource assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 2 "," & "+filename]) # should not have a replica 2 assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+filename) # replicate overtop test resource assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 2 "," & "+filename]) # should not have a replica 2 # local cleanup os.remove(filepath)
def test_iadmin_mkuser(self): # A few examples of valid and invalid usernames valid = ['bo', 'bob', 'jim-bob', 'boB', '123.456', 'user@email', 'u@e', '[email protected]', '___haysoos___'] invalid = ['#', '.', '..', '<bob>', '________________________________longer_than_NAME_LEN________________________________________________'] # invalid = ['.bob', # 'bob.', # 'jim--bob', # 'user@email.', # 'user.', # 'jamesbond..007', # '________________________________longer_than_NAME_LEN________________________________________________'] # Test valid names for name in valid: assertiCmd(s.adminsession, "iadmin mkuser " + name + " rodsuser") # should be accepted # should be listed assertiCmd(s.adminsession, "iadmin lu", "LIST", [name + "#" + s.adminsession.getZoneName()]) assertiCmd(s.adminsession, "iadmin rmuser " + name) # remove user # should be gone assertiCmdFail(s.adminsession, "iadmin lu", "LIST", [name + "#" + s.adminsession.getZoneName()]) # Test invalid names for name in invalid: assertiCmd(s.adminsession, "iadmin mkuser " + name + " rodsuser", "LIST", "Invalid user name format") # should be rejected # Invalid names with special characters assertiCmd(s.adminsession, r"iadmin mkuser hawai\'i rodsuser", "LIST", "Invalid user name format") # should be rejected assertiCmd(s.adminsession, r"iadmin mkuser \\\/\!\*\?\|\$ rodsuser", "LIST", "Invalid user name format") # should be rejected
def test_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 assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.adminsession,"iput --purgec "+filename) # put file assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 0 ",filename]) # should be listed once assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 1 ",filename]) # should be listed only once assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 2 ",filename]) # should be listed only once # local cleanup output = commands.getstatusoutput( 'rm '+filepath )
def test_irepl_update_replicas(self): # local setup filename = "updatereplicasfile.txt" filepath = create_local_testfile(filename) hostname = get_hostname() doublefile = "doublefile.txt" os.system("cat %s %s > %s" % (filename, filename, doublefile)) doublesize = str(os.stat(doublefile).st_size) # assertions assertiCmd(s.adminsession,"iadmin mkresc thirdresc unixfilesystem %s:/tmp/thirdrescVault" % hostname, "LIST", "Creating") # create third resource assertiCmd(s.adminsession,"iadmin mkresc fourthresc unixfilesystem %s:/tmp/fourthrescVault" % hostname, "LIST", "Creating") # create fourth resource assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.adminsession,"iput "+filename) # put file assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+filename) # replicate to test resource assertiCmd(s.adminsession,"irepl -R thirdresc "+filename) # replicate to third resource assertiCmd(s.adminsession,"irepl -R fourthresc "+filename) # replicate to fourth resource assertiCmd(s.adminsession,"iput -f -R "+self.testresc+" "+doublefile+" "+filename) # repave overtop test resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 0 "," & "+filename]) # should have a dirty copy assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 1 "," & "+filename]) # should have a clean copy assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 2 "," & "+filename]) # should have a dirty copy assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 3 "," & "+filename]) # should have a dirty copy assertiCmd(s.adminsession,"irepl -U "+filename) # update last replica assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 0 "," & "+filename]) # should have a dirty copy assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 1 "," & "+filename]) # should have a clean copy assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 2 "," & "+filename]) # should have a dirty copy assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 3 "," & "+filename]) # should have a clean copy assertiCmd(s.adminsession,"irepl -aU "+filename) # update all replicas assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 0 "," & "+filename]) # should have a clean copy assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 1 "," & "+filename]) # should have a clean copy assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 2 "," & "+filename]) # should have a clean copy assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 3 "," & "+filename]) # should have a clean copy assertiCmd(s.adminsession,"irm -f "+filename) # cleanup file assertiCmd(s.adminsession,"iadmin rmresc thirdresc") # remove third resource assertiCmd(s.adminsession,"iadmin rmresc fourthresc") # remove third resource # local cleanup os.remove(filepath) os.remove(doublefile)
def test_local_iput_onto_specific_resource(self): # local setup datafilename = "anotherfile.txt" f = open(datafilename, 'wb') f.write("TESTFILE -- [" + datafilename + "]") f.close() # assertions assertiCmdFail(s.adminsession, "ils -L " + datafilename, "LIST", datafilename) # should not be listed assertiCmd(s.adminsession, "iput -R " + self.testresc + " " + datafilename) # iput assertiCmd(s.adminsession, "ils -L " + datafilename, "LIST", datafilename) # should be listed assertiCmd(s.adminsession, "ils -L " + datafilename, "LIST", self.testresc) # should be listed # local cleanup output = commands.getstatusoutput('rm ' + datafilename)
def test_irmtrash_admin_2461(self): # 'irmtrash -M' was not deleting the r_objt_metamap entries for collections it was deleting # leading to orphaned avu's that 'iadmin rum' could never remove collection_basename = sys._getframe().f_code.co_name assertiCmd(s.adminsession, 'imkdir {collection_basename}'.format(**vars())) file_basename = 'dummy_file_to_trigger_recursive_rm' pydevtest_common.make_file(file_basename, 10) file_irods_path = os.path.join(collection_basename, file_basename) assertiCmd(s.adminsession, 'iput {file_basename} {file_irods_path}'.format(**vars())) a, v, u = ('attribute_' + collection_basename, 'value_' + collection_basename, 'unit_' + collection_basename) assertiCmd(s.adminsession, 'imeta add -C {collection_basename} {a} {v} {u}'.format(**vars())) assertiCmd(s.adminsession, 'imeta ls -C {collection_basename}'.format(**vars()), 'STDOUT_MULTILINE', [a, v, u]) assertiCmd(s.adminsession, 'irm -r {collection_basename}'.format(**vars())) assertiCmd(s.adminsession, 'irmtrash -M') assertiCmd(s.adminsession, 'iadmin rum') assertiCmdFail(s.adminsession, '''iquest "select META_DATA_ATTR_NAME where META_DATA_ATTR_NAME = '{a}'"'''.format(**vars()), 'STDOUT', a)
def test_create_and_remove_coordinating_resource(self): testresc1 = "testResc1" assertiCmdFail(s.adminsession, "iadmin lr", "LIST", testresc1) # should not be listed output = commands.getstatusoutput("hostname") hostname = output[1] assertiCmd(s.adminsession, "iadmin mkresc " + testresc1 + " replication", "LIST", "Creating") # replication assertiCmd(s.adminsession, "iadmin lr", "LIST", testresc1) # should be listed assertiCmd(s.adminsession, "iadmin lr " + testresc1, "LIST", ["resc_net", "EMPTY_RESC_HOST"]) # should have empty host assertiCmd( s.adminsession, "iadmin lr " + testresc1, "LIST", ["resc_def_path", "EMPTY_RESC_PATH"]) # should have empty path assertiCmd(s.adminsession, "iadmin rmresc " + testresc1) # good remove assertiCmdFail(s.adminsession, "iadmin lr", "LIST", testresc1) # should be gone
def test_local_iput_with_force_and_destination_resource__ticket_1706(self): # local setup filename = "iputwithforceanddestination.txt" filepath = create_local_testfile(filename) doublefile = "doublefile.txt" os.system("cat %s %s > %s" % (filename, filename, doublefile)) doublesize = str(os.stat(doublefile).st_size) # assertions assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.adminsession,"iput "+filename) # put file assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+filename) # replicate to test resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) assertiCmd(s.adminsession,"iput -f -R %s %s %s" % (self.testresc, doublefile, filename) ) # overwrite test repl with different data assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 0 "," "+filename]) # default resource should have dirty copy assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 0 "," "+doublesize+" "," "+filename]) # default resource should not have doublesize file assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 1 "," "+doublesize+" ","& "+filename]) # targeted resource should have new double clean copy # local cleanup os.remove(filepath) os.remove(doublefile)
def test_host_access_control(self): my_ip = socket.gethostbyname(socket.gethostname()) # manipulate the core.re to enable host access control corefile = get_irods_config_dir() + "/core.re" backupcorefile = corefile + "--" + self._testMethodName shutil.copy(corefile, backupcorefile) os.system( '''sed -e '/^acChkHostAccessControl { }/i acChkHostAccessControl { msiCheckHostAccessControl; }' /etc/irods/core.re > /tmp/irods/core.re''') time.sleep(1) # remove once file hash fix is commited #2279 os.system("cp /tmp/irods/core.re /etc/irods/core.re") time.sleep(1) # remove once file hash fix is commited #2279 # restart the server to reread the new core.re os.system(get_irods_top_level_dir() + "/iRODS/irodsctl stop") os.system(get_irods_top_level_dir() + "/iRODS/irodsctl start") host_access_control = '' if os.path.isfile('/etc/irods/host_access_control.json'): host_access_control = '/etc/irods/host_access_control.json' else: install_dir = os.path.dirname( os.path.dirname( os.path.realpath(__file__))) host_access_control = install_dir + '/iRODS/server/config/host_access_control.json' orig_file = host_access_control + '.orig' os.system('cp %s %s' % (host_access_control, orig_file)) write_host_access_control(host_access_control, 'nope', 'nope', '', '') assertiCmdFail(s.adminsession, "ils", "ERROR", "SYS_AGENT_INIT_ERR") write_host_access_control(host_access_control, 'all', 'all', my_ip, '255.255.255.255') assertiCmd(s.adminsession, "ils", "LIST", "tempZone") # restore the original host_access_control.json os.system('mv %s %s' % (orig_file, host_access_control)) # restore the original core.re shutil.copy(backupcorefile, corefile) os.remove(backupcorefile)
def test_irepl_over_existing_bad_replica__ticket_1705(self): # local setup filename = "reploverwritebad.txt" filepath = create_local_testfile(filename) doublefile = "doublefile.txt" os.system("cat %s %s > %s" % (filename, filename, doublefile)) doublesize = str(os.stat(doublefile).st_size) # assertions assertiCmd(s.adminsession, "ils -L " + filename, "ERROR", "does not exist") # should not be listed assertiCmd(s.adminsession, "iput " + filename) # put file assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) # for debugging assertiCmd(s.adminsession, "irepl -R " + self.testresc + " " + filename) # replicate to test resource assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) # for debugging assertiCmd(s.adminsession, "iput -f %s %s" % (doublefile, filename)) # overwrite default repl with different data assertiCmd(s.adminsession, "ils -L " + filename, "LIST", [" 0 ", " & " + filename ]) # default resource should have clean copy assertiCmd(s.adminsession, "ils -L " + filename, "LIST", [" 0 ", " " + doublesize + " ", " & " + filename ]) # default resource should have new double clean copy assertiCmdFail( s.adminsession, "ils -L " + filename, "LIST", [" 1 " + self.testresc, " " + doublesize + " ", " " + filename ]) # test resource should not have doublesize file assertiCmd(s.adminsession, "irepl -R " + self.testresc + " " + filename) # replicate back onto test resource assertiCmd( s.adminsession, "ils -L " + filename, "LIST", [" 1 " + self.testresc, " " + doublesize + " ", " & " + filename ]) # test resource should have new clean doublesize file assertiCmdFail( s.adminsession, "ils -L " + filename, "LIST", [" 2 ", " & " + filename]) # should not have a replica 2 # local cleanup os.remove(filepath) os.remove(doublefile)
def test_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 assertiCmd(s.adminsession, "ils -L " + filename, "ERROR", "does not exist") # should not be listed assertiCmd(s.adminsession, "iput --purgec " + filename) # put file assertiCmd(s.adminsession, "ils -L " + filename, "LIST", [" 0 ", filename]) # should be listed once assertiCmdFail(s.adminsession, "ils -L " + filename, "LIST", [" 1 ", filename]) # should be listed only once assertiCmdFail(s.adminsession, "ils -L " + filename, "LIST", [" 2 ", filename]) # should be listed only once # local cleanup output = commands.getstatusoutput('rm ' + filepath)
def test_ireg_as_rodsuser(self): # local setup filename = "newfile.txt" filepath = os.path.abspath(filename) f = open(filepath, 'wb') f.write("TESTFILE -- [" + filepath + "]") f.close() # assertions assertiCmd(s.adminsession, "ils -L " + filename, "ERROR", "does not exist") # should not be listed assertiCmd(s.sessions[1], "ireg " + filepath + " /" + s.sessions[1].getZoneName() + "/home/" + s.sessions[1].getUserName() + "/" + s.sessions[1].sessionId + "/" + filename, "ERROR", "PATH_REG_NOT_ALLOWED") # ireg assertiCmdFail(s.sessions[1], "ils -L " + filename, "LIST", filename) # should not be listed # local cleanup output = commands.getstatusoutput('rm ' + filepath)
def test_irepl_over_existing_third_replica__ticket_1705(self): # local setup filename = "thirdreplicatest.txt" filepath = create_local_testfile(filename) hostname = get_hostname() # assertions assertiCmd( s.adminsession, "iadmin mkresc thirdresc unixfilesystem %s:/tmp/thirdrescVault" % hostname, "LIST", "Creating") # create third resource assertiCmd(s.adminsession, "ils -L " + filename, "ERROR", "does not exist") # should not be listed assertiCmd(s.adminsession, "iput " + filename) # put file assertiCmd(s.adminsession, "irepl -R " + self.testresc + " " + filename) # replicate to test resource assertiCmd(s.adminsession, "irepl -R thirdresc " + filename) # replicate to third resource assertiCmd(s.adminsession, "irepl " + filename) # replicate overtop default resource assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) # for debugging assertiCmd(s.adminsession, "irepl -R " + self.testresc + " " + filename) # replicate overtop test resource assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) # for debugging assertiCmd(s.adminsession, "irepl -R thirdresc " + filename) # replicate overtop third resource assertiCmd(s.adminsession, "ils -L " + filename, "LIST", filename) # for debugging assertiCmdFail( s.adminsession, "ils -L " + filename, "LIST", [" 3 ", " & " + filename]) # should not have a replica 3 assertiCmdFail( s.adminsession, "ils -L " + filename, "LIST", [" 4 ", " & " + filename]) # should not have a replica 4 assertiCmd(s.adminsession, "irm -f " + filename) # cleanup file assertiCmd(s.adminsession, "iadmin rmresc thirdresc") # remove third resource # local cleanup os.remove(filepath)
def test_irm_specific_replica(self): assertiCmd(s.adminsession, "ils -L " + self.testfile, "LIST", self.testfile) # should be listed assertiCmd(s.adminsession, "irepl -R " + self.testresc + " " + self.testfile) # creates replica assertiCmd(s.adminsession, "ils -L " + self.testfile, "LIST", self.testfile) # should be listed twice assertiCmd(s.adminsession, "irm -n 0 " + self.testfile) # remove original from grid assertiCmd( s.adminsession, "ils -L " + self.testfile, "LIST", ["1 " + self.testresc, self.testfile]) # replica 1 should be there assertiCmdFail(s.adminsession, "ils -L " + self.testfile, "LIST", ["0 " + s.adminsession.getDefResource(), self.testfile ]) # replica 0 should be gone trashpath = "/" + s.adminsession.getZoneName( ) + "/trash/home/" + s.adminsession.getUserName( ) + "/" + s.adminsession.sessionId assertiCmdFail(s.adminsession, "ils -L " + trashpath + "/" + self.testfile, "LIST", ["0 " + s.adminsession.getDefResource(), self.testfile ]) # replica should not be in trash
def test_create_and_remove_new_user(self): testuser1 = "testaddandremoveuser" assertiCmdFail(s.adminsession,"iadmin lu","LIST",testuser1+"#"+s.adminsession.getZoneName()) # should not be listed assertiCmd(s.adminsession,"iadmin mkuser "+testuser1+" rodsuser") # add rodsuser assertiCmd(s.adminsession,"iadmin lu","LIST",testuser1+"#"+s.adminsession.getZoneName()) # should be listed assertiCmdFail(s.adminsession,"iadmin rmuser notauser") # bad remove assertiCmd(s.adminsession,"iadmin rmuser "+testuser1) # good remove assertiCmdFail(s.adminsession,"iadmin lu","LIST",testuser1+"#"+s.adminsession.getZoneName()) # should be gone
def test_irepl_over_existing_bad_replica__ticket_1705(self): # local setup filename = "reploverwritebad.txt" filepath = create_local_testfile(filename) doublefile = "doublefile.txt" os.system("cat %s %s > %s" % (filename, filename, doublefile)) doublesize = str(os.stat(doublefile).st_size) # assertions assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.adminsession,"iput "+filename) # put file assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+filename) # replicate to test resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmd(s.adminsession,"iput -f %s %s" % (doublefile, filename) ) # overwrite default repl with different data assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 0 "," & "+filename]) # default resource should have clean copy assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 0 "," "+doublesize+" "," & "+filename]) # default resource should have new double clean copy assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 1 "+self.testresc," "+doublesize+" "," "+filename]) # test resource should not have doublesize file assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+filename) # replicate back onto test resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",[" 1 "+self.testresc," "+doublesize+" "," & "+filename]) # test resource should have new clean doublesize file assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 2 "," & "+filename]) # should not have a replica 2 # local cleanup os.remove(filepath) os.remove(doublefile)
def test_irepl_over_existing_third_replica__ticket_1705(self): # local setup filename = "thirdreplicatest.txt" filepath = create_local_testfile(filename) hostname = get_hostname() # assertions assertiCmd(s.adminsession,"iadmin mkresc thirdresc unixfilesystem %s:/tmp/thirdrescVault" % hostname, "LIST", "Creating") # create third resource assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.adminsession,"iput "+filename) # put file assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+filename) # replicate to test resource assertiCmd(s.adminsession,"irepl -R thirdresc "+filename) # replicate to third resource assertiCmd(s.adminsession,"irepl "+filename) # replicate overtop default resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmd(s.adminsession,"irepl -R "+self.testresc+" "+filename) # replicate overtop test resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmd(s.adminsession,"irepl -R thirdresc "+filename) # replicate overtop third resource assertiCmd(s.adminsession,"ils -L "+filename,"LIST",filename) # for debugging assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 3 "," & "+filename]) # should not have a replica 3 assertiCmdFail(s.adminsession,"ils -L "+filename,"LIST",[" 4 "," & "+filename]) # should not have a replica 4 assertiCmd(s.adminsession,"irm -f "+filename) # cleanup file assertiCmd(s.adminsession,"iadmin rmresc thirdresc") # remove third resource # local cleanup os.remove(filepath)
def test_local_iput_interrupt_largefile(self): # local setup datafilename = "bigfile" print "-------------------" print "creating "+datafilename+"..." output = commands.getstatusoutput( 'dd if=/dev/zero of='+datafilename+' bs=1M count=150' ) print output[1] assert output[0] == 0, "dd did not successfully exit" rf="bigrestartfile" # assertions iputcmd = "iput --lfrestart "+rf+" "+datafilename if os.path.exists(rf): os.unlink(rf) interruptiCmd(s.adminsession,iputcmd,rf,10) # once restartfile reaches 10 bytes assert os.path.exists(rf), rf+" should now exist, but did not" output = commands.getstatusoutput( 'cat '+rf ) print " restartfile ["+rf+"] contents --> ["+output[1]+"]" today = datetime.date.today() assertiCmd(s.adminsession,"ils -L "+datafilename,"LIST",[" 0 "+today.isoformat(),datafilename]) # will have zero length assertiCmd(s.adminsession,iputcmd,"LIST",datafilename+" was restarted successfully") # confirm the restart assertiCmdFail(s.adminsession,"ils -L "+datafilename,"LIST",[" 0 "+today.isoformat(),datafilename]) # length should not be zero # local cleanup output = commands.getstatusoutput( 'rm '+datafilename ) output = commands.getstatusoutput( 'rm '+rf )
def test_ireg_as_rodsuser_in_vault(self): # get vault base path cmdout = s.sessions[1].runCmd('iquest',["%s", "select RESC_VAULT_PATH where RESC_NAME = 'demoResc'"]) vaultpath = cmdout[0].rstrip('\n') # make dir in vault if necessary dir = os.path.join(vaultpath, 'home', s.sessions[1].getUserName()) if not os.path.exists(dir): os.makedirs(dir) # create file in vault filename = "newfile.txt" filepath = os.path.join(dir, filename) f = open(filepath,'wb') f.write("TESTFILE -- ["+filepath+"]") f.close() # assertions assertiCmd(s.adminsession,"ils -L "+filename,"ERROR","does not exist") # should not be listed assertiCmd(s.sessions[1],"ireg "+filepath+" /"+s.sessions[1].getZoneName()+"/home/"+s.sessions[1].getUserName()+"/"+s.sessions[1].sessionId+"/"+filename, "ERROR","PATH_REG_NOT_ALLOWED") # ireg assertiCmdFail(s.sessions[1],"ils -L "+filename,"LIST",filename) # should not be listed # local cleanup output = commands.getstatusoutput( 'rm '+filepath )
def test_create_and_remove_new_user(self): testuser1 = "testaddandremoveuser" assertiCmdFail(s.adminsession, "iadmin lu", "LIST", testuser1 + "#" + s.adminsession.getZoneName()) # should not be listed assertiCmd(s.adminsession, "iadmin mkuser " + testuser1 + " rodsuser") # add rodsuser assertiCmd(s.adminsession, "iadmin lu", "LIST", testuser1 + "#" + s.adminsession.getZoneName()) # should be listed assertiCmdFail(s.adminsession, "iadmin rmuser notauser") # bad remove assertiCmd(s.adminsession, "iadmin rmuser " + testuser1) # good remove assertiCmdFail(s.adminsession, "iadmin lu", "LIST", testuser1 + "#" + s.adminsession.getZoneName()) # should be gone
def test_imeta_set_single_object_multi_avu_removal(self): user = s.sessions[1].get_username() original_avus = [('att' + str(i), 'val' + str(i), 'unt' + str(i)) for i in range(30)] for avu in original_avus: add_and_check_avu(user, *avu) set_and_check_avu(user, 'att_new', 'val_new', 'unt_new') for a, v, u in original_avus: assertiCmdFail(s.adminsession, 'imeta ls -u %s %s' % (user, a), 'STDOUT', ['attribute: ' + a + '$']) assertiCmdFail(s.adminsession, 'imeta ls -u %s %s' % (user, a), 'STDOUT', ['value: ' + v + '$']) assertiCmdFail(s.adminsession, 'imeta ls -u %s %s' % (user, a), 'STDOUT', ['units:' + u + '$'])