Skip to content

Commit

Permalink
[#2183] Fix tests using --purgec
Browse files Browse the repository at this point in the history
  • Loading branch information
SwooshyCueb authored and alanking committed Apr 26, 2024
1 parent 44406a0 commit de04e4d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
21 changes: 15 additions & 6 deletions packaging/resource_suite_s3_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def test_iput_with_purgec(self):

try:
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("iput --purgec " + filename, 'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # put file
# should not be listed (trimmed)
self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', [" 0 ", filename])
# should be listed once - replica 1
Expand All @@ -369,7 +369,9 @@ def test_iput_with_purgec(self):
self.admin.assert_icommand(['irm', '-f', filename])

self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', filename) # should not be listed
self.admin.assert_icommand(['iput', '-b', '--purgec', filename]) # put file... in bulk!
# put file... in bulk!
self.admin.assert_icommand(
['iput', '-b', '--purgec', filename], 'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.')
# should not be listed (trimmed)
self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', [" 0 ", filename])
# should be listed once - replica 1
Expand All @@ -390,7 +392,8 @@ def test_iget_with_purgec(self):
# 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
# get file and purge 'cached' replica
self.admin.assert_icommand("iget -f --purgec " + filename, 'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.')
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
Expand All @@ -409,7 +412,9 @@ def test_irepl_with_purgec(self):
# 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(
"irepl -R " + self.testresc + " --purgec " + filename,
'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # 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
Expand Down Expand Up @@ -459,7 +464,9 @@ def test_decoupled_naming_policy(self):
session.assert_icommand("imv %s %s" % (filename, new_filename))

# get and purge cache replica
session.assert_icommand("iget -f --purgec %s" % new_filename) # get file and purge 'cached' replica
session.assert_icommand(
"iget -f --purgec %s" % new_filename,
'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # get file and purge 'cached' replica

# get again now that it is not in cache
session.assert_icommand("iget -f %s" % new_filename) # get file
Expand Down Expand Up @@ -512,7 +519,9 @@ def test_decoupled_naming_policy_issue1855(self):
session.assert_icommand("imv %s %s" % (filename, new_filename))

# get and purge cache replica
session.assert_icommand("iget -f --purgec %s" % new_filename) # get file and purge 'cached' replica
session.assert_icommand(
"iget -f --purgec %s" % new_filename,
'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # get file and purge 'cached' replica

# get again now that it is not in cache
session.assert_icommand("iget -f %s" % new_filename) # get file
Expand Down
8 changes: 5 additions & 3 deletions packaging/resource_suite_s3_nocache.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def test_iget_with_purgec(self):
# assertions
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("iget -f --purgec " + filename) # get file
self.admin.assert_icommand("iget -f --purgec " + filename, 'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # get file
self.admin.assert_icommand("ils -L " + filename, 'STDOUT_SINGLELINE', [" 0 ", filename]) # should be listed once
self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', [" 1 ", filename]) # should be listed only once
self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', [" 2 ", filename]) # should be listed only once
Expand Down Expand Up @@ -732,7 +732,7 @@ def test_iput_with_purgec(self):

# assertions
self.admin.assert_icommand("ils -L " + filename, 'STDERR_SINGLELINE', "does not exist") # should not be listed
self.admin.assert_icommand("iput --purgec " + filename) # put file
self.admin.assert_icommand("iput --purgec " + filename, 'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # put file
self.admin.assert_icommand("ils -L " + filename, 'STDOUT_SINGLELINE', [" 0 ", filename]) # should be listed once
self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', [" 1 ", filename]) # should be listed only once
self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', [" 2 ", filename]) # should be listed only once
Expand Down Expand Up @@ -959,7 +959,9 @@ def test_irepl_with_purgec(self):
# assertions
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("irepl -R " + self.testresc + " --purgec " + filename) # replicate to test resource
self.admin.assert_icommand(
"irepl -R " + self.testresc + " --purgec " + filename,
'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # replicate to test resource
self.admin.assert_icommand_fail("ils -L " + filename, 'STDOUT_SINGLELINE', [" 0 ", filename]) # should be 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 be listed only once
Expand Down
8 changes: 5 additions & 3 deletions packaging/test_irods_resource_plugin_s3_for_cloudian.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def test_iput_with_purgec(self):

# 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("iput --purgec " + filename, 'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # 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
Expand All @@ -309,7 +309,7 @@ def test_iget_with_purgec(self):
# 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("iget -f --purgec " + filename, 'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # 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
Expand All @@ -328,7 +328,9 @@ def test_irepl_with_purgec(self):
# 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(
"irepl -R " + self.testresc + " --purgec " + filename,
'STDOUT', 'Specifying a minimum number of replicas to keep is deprecated.') # 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
Expand Down

0 comments on commit de04e4d

Please sign in to comment.