Skip to content

Commit

Permalink
[#306] Ensure replicas are trimmed before replication in more tests
Browse files Browse the repository at this point in the history
See 45e1a8b.
  • Loading branch information
alanking committed Feb 5, 2025
1 parent 2a30bd2 commit 5ad3155
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions packaging/test_plugin_unified_storage_tiering.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ def test_put_and_get(self):
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:
lib.create_local_testfile(filename)
Expand All @@ -692,16 +693,25 @@ def test_put_and_get(self):
# test stage to tier 1
time.sleep(5)
invoke_storage_tiering_rule()
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', 'rnd1')
# Wait until the object migrates to the next tier.
lib.delayAssert(lambda: lib.replica_exists(admin_session, logical_path, 0) == False)
lib.replica_exists(admin_session, logical_path, 1)
admin_session.assert_icommand(["ils", "-L", filename], "STDOUT", "rnd1")

# test stage to tier 2
time.sleep(15)
invoke_storage_tiering_rule()
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', 'rnd2')
# Wait until the object migrates to the next tier.
lib.delayAssert(lambda: lib.replica_exists(admin_session, logical_path, 1) == False)
lib.replica_exists(admin_session, logical_path, 2)
admin_session.assert_icommand(["ils", "-L", filename], "STDOUT", "rnd2")

# test restage to tier 0
admin_session.assert_icommand('iget ' + filename + ' - ', 'STDOUT_SINGLELINE', 'TESTFILE')
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', 'rnd0')
# Wait until the object migrates to the next tier.
lib.delayAssert(lambda: lib.replica_exists(admin_session, logical_path, 2) == False)
lib.replica_exists(admin_session, logical_path, 3)
admin_session.assert_icommand(["ils", "-L", filename], "STDOUT", "rnd0")

finally:
admin_session.assert_icommand('irm -f ' + filename)
Expand Down Expand Up @@ -1294,8 +1304,8 @@ def test_restaging_with_existing_replica_in_lower_tier__issue_235(self):
admin_session.assert_icommand('iqstat', 'STDOUT', 'irods_policy_storage_tiering')

# Ensure that the replica was tiered out to ufs1 and not preserved on ufs0.
delay_assert_icommand(admin_session, 'ils -L ' + filename, 'STDOUT_SINGLELINE', 'ufs1')
self.assertFalse(lib.replica_exists_on_resource(admin_session, logical_path, 'ufs0'))
lib.delayAssert(lambda: lib.replica_exists_on_resource(admin_session, logical_path, 'ufs0') == False)
self.assertTrue(lib.replica_exists_on_resource(admin_session, logical_path, 'ufs1'))
self.assertFalse(lib.replica_exists_on_resource(admin_session, logical_path, 'ufs2'))

# Ensure that the "tracked" replica updates to replica 1, which is the tiered-out replica on ufs1.
Expand Down Expand Up @@ -1632,7 +1642,9 @@ def test_directory_registration(self):
# test stage to tier 1
time.sleep(5)
invoke_storage_tiering_rule()
delay_assert_icommand(admin_session, 'ils -L ' + dest_path, 'STDOUT_SINGLELINE', 'ufs1')
# Wait until the object migrates to the next tier.
lib.delayAssert(lambda: lib.replica_exists_on_resource(admin_session, dest_path, "ufs0") == False)
lib.replica_exists_on_resource(admin_session, dest_path, "ufs1")

finally:
delay_assert_icommand(admin_session, 'iqdel -a')
Expand Down Expand Up @@ -1830,12 +1842,16 @@ def test_put_and_get(self):

try:
filename = 'test_put_file'
logical_path = "/".join([admin_session.home_collection, filename])
filepath = lib.create_local_testfile(filename)
admin_session.assert_icommand('iput -R ufs0 ' + filename)
admin_session.assert_icommand('ils -L ', 'STDOUT_SINGLELINE', 'rods')
time.sleep(5)
invoke_storage_tiering_rule()
delay_assert_icommand(admin_session, ['ils', '-l', filename], 'STDOUT_SINGLELINE', 'ufs2')
# Wait until the object migrates to the next tier.
lib.delayAssert(
lambda: lib.replica_exists_on_resource(admin_session, logical_path, "ufs0") == False)
lib.replica_exists_on_resource(admin_session, logical_path, "ufs2")
admin_session.assert_icommand('imeta ls -d '+filename, 'STDOUT_SINGLELINE', '--')

# test restage to tier 0
Expand Down

0 comments on commit 5ad3155

Please sign in to comment.