Skip to content

Commit

Permalink
test: add test for mds drop cache command
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/23362
Signed-off-by: Venky Shankar <vshankar@redhat.com>
  • Loading branch information
vshankar committed Aug 30, 2018
1 parent bff0910 commit 8b10e79
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions qa/tasks/cephfs/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,46 @@ def test_dump_inode(self):
info = self.fs.mds_asok(['dump', 'inode', '1'])
assert(info['path'] == "/")

def test_drop_cache_command(self):
"""
Basic test for checking drop cache command. Note that the cache size
post trimming is not checked here.
"""

self.mount_b.umount_wait()
ls_data = self.fs.mds_asok(['session', 'ls'])
self.assert_session_count(1, ls_data)

# create some files
self.mount_a.create_n_files("dc-dir/dc-file", 1000)

# drop cache
drop_res = self.fs.mds_asok(['cache', 'drop', '10'])
self.assertTrue(drop_res['client_recall']['return_code'] == 0)
self.assertTrue(drop_res['flush_journal']['return_code'] == 0)

def test_drop_cache_command_timeout(self):
"""
Check drop cache command with non-responding client. Note that the
cache size post trimming is not checked here.
"""

self.mount_b.umount_wait()
ls_data = self.fs.mds_asok(['session', 'ls'])
self.assert_session_count(1, ls_data)

# create some files
self.mount_a.create_n_files("dc-dir/dc-file-t", 1000)

# simulate client death
self.mount_a.kill()

# drop cache
drop_res = self.fs.mds_asok(['cache', 'drop', '5'])

self.assertTrue(drop_res['client_recall']['return_code'] == errno.ETIMEDOUT)
self.assertTrue(drop_res['flush_journal']['return_code'] == 0)

self.mount_a.kill_cleanup()
self.mount_a.mount()
self.mount_a.wait_until_mounted()

0 comments on commit 8b10e79

Please sign in to comment.