Skip to content

Commit

Permalink
[#232] Update restage test to restage to lower tier
Browse files Browse the repository at this point in the history
  • Loading branch information
alanking committed Dec 20, 2023
1 parent 446c072 commit a2310c7
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions packaging/test_plugin_unified_storage_tiering.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,42 +792,54 @@ def test_preserve_replicas_works_with_restage_when_replicas_exist_in_multiple_ti
IrodsController().restart(test_mode=True)
with session.make_session_for_existing_admin() as admin_session:
filename = 'test_put_file'
logical_path = '/'.join([admin_session.home_collection, filename])

try:
# make sure replicas stored on tier 2 are preserved
# Replicas should be preserved on ufs1 and ufs2. ufs1 should not be the minimum restage tier to
# ensure that a restage to a lower tier can occur.
admin_session.assert_icommand('imeta rm -R ufs1 irods::storage_tiering::minimum_restage_tier true')
admin_session.assert_icommand('imeta rm -R ufs0 irods::storage_tiering::preserve_replicas true')
admin_session.assert_icommand('imeta add -R ufs1 irods::storage_tiering::preserve_replicas true')
admin_session.assert_icommand('imeta add -R ufs2 irods::storage_tiering::preserve_replicas true')

# create test file and upload it
# Create test file and upload it.
lib.create_local_testfile(filename)
admin_session.assert_icommand('iput -R ufs0 ' + filename)
admin_session.assert_icommand('ils -L ', 'STDOUT_SINGLELINE', 'rods')

# stage to tier 1, look for both replicas
# Stage to tier 1 and ensure that the replica on ufs0 was trimmed.
sleep(6)
invoke_storage_tiering_rule()
admin_session.assert_icommand('iqstat', 'STDOUT_SINGLELINE', 'irods_policy_storage_tiering')

delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '0 ufs0')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '1 ufs1')
self.assertFalse(lib.replica_exists_on_resource(admin_session, logical_path, 'ufs0'))

# Stage to tier 2, look for replica in tier 1 and tier 2.
sleep(15)
# stage to tier 2, look for replica in tier 0 and tier 2
invoke_storage_tiering_rule()
admin_session.assert_icommand('iqstat', 'STDOUT_SINGLELINE', 'irods_policy_storage_tiering')

delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '0 ufs0')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '1 ufs1')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '2 ufs2')

# test restage to tier 1 using replica from tier 0, look for replica in all tiers afterwards
admin_session.assert_icommand('iget -R ufs0 ' + filename + ' - ', 'STDOUT_SINGLELINE', 'TESTFILE')
# Test restage to tier 0 using replica from tier 1 to ensure that a replica that is not the
# "tracked" replica (the tracked replica is in ufs2) gets restaged. Look for replica in all tiers
# afterwards.
admin_session.assert_icommand('iget -R ufs1 ' + filename + ' - ', 'STDOUT_SINGLELINE', 'TESTFILE')

sleep(15)
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '0 ufs0')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '3 ufs1')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '3 ufs0')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '1 ufs1')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', '2 ufs2')


finally:
admin_session.assert_icommand('imeta rm -R ufs1 irods::storage_tiering::preserve_replicas true')
admin_session.assert_icommand('imeta rm -R ufs2 irods::storage_tiering::preserve_replicas true')
admin_session.assert_icommand('imeta add -R ufs0 irods::storage_tiering::preserve_replicas true')
admin_session.assert_icommand('imeta add -R ufs1 irods::storage_tiering::minimum_restage_tier true')

admin_session.assert_icommand('irm -f ' + filename)

def test_preserve_replicas_works_with_restage_when_replica_only_exists_in_last_tier__issue_233(self):
Expand Down

0 comments on commit a2310c7

Please sign in to comment.