Skip to content

Commit 6b24da7

Browse files
committed
qa: test 'ceph fs snapshot mirror ls' command
Fixes: https://tracker.ceph.com/issues/67292 Signed-off-by: Jos Collin <[email protected]>
1 parent e60d82a commit 6b24da7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

qa/tasks/cephfs/test_mirroring.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,34 @@ def test_directory_commands(self):
432432
self.disable_mirroring(self.primary_fs_name, self.primary_fs_id)
433433
self.mount_a.run_shell(["rmdir", "d1"])
434434

435+
def test_directory_command_ls(self):
436+
dir1 = 'dls1'
437+
dir2 = 'dls2'
438+
self.mount_a.run_shell(["mkdir", dir1])
439+
self.mount_a.run_shell(["mkdir", dir2])
440+
self.enable_mirroring(self.primary_fs_name, self.primary_fs_id)
441+
try:
442+
self.add_directory(self.primary_fs_name, self.primary_fs_id, f'/{dir1}')
443+
self.add_directory(self.primary_fs_name, self.primary_fs_id, f'/{dir2}')
444+
time.sleep(10)
445+
dirs_list = json.loads(self.get_ceph_cmd_stdout("fs", "snapshot", "mirror", "ls", self.primary_fs_name))
446+
# verify via asok
447+
res = self.mirror_daemon_command(f'mirror status for fs: {self.primary_fs_name}',
448+
'fs', 'mirror', 'status', f'{self.primary_fs_name}@{self.primary_fs_id}')
449+
dir_count = res['snap_dirs']['dir_count']
450+
self.assertTrue(len(dirs_list) == dir_count and f'/{dir1}' in dirs_list and f'/{dir2}' in dirs_list)
451+
except CommandFailedError:
452+
raise RuntimeError('Error listing directories')
453+
except AssertionError:
454+
raise RuntimeError('Wrong number of directories listed')
455+
finally:
456+
self.remove_directory(self.primary_fs_name, self.primary_fs_id, f'/{dir1}')
457+
self.remove_directory(self.primary_fs_name, self.primary_fs_id, f'/{dir2}')
458+
459+
self.disable_mirroring(self.primary_fs_name, self.primary_fs_id)
460+
self.mount_a.run_shell(["rmdir", dir1])
461+
self.mount_a.run_shell(["rmdir", dir2])
462+
435463
def test_add_relative_directory_path(self):
436464
self.enable_mirroring(self.primary_fs_name, self.primary_fs_id)
437465
try:

0 commit comments

Comments
 (0)