]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | import logging |
7c673cae FG |
2 | from tasks.cephfs.cephfs_test_case import CephFSTestCase |
3 | ||
4 | log = logging.getLogger(__name__) | |
5 | ||
6 | ||
7 | class TestReadahead(CephFSTestCase): | |
8 | def test_flush(self): | |
7c673cae FG |
9 | # Create 32MB file |
10 | self.mount_a.run_shell(["dd", "if=/dev/urandom", "of=foo", "bs=1M", "count=32"]) | |
11 | ||
12 | # Unmount and remount the client to flush cache | |
13 | self.mount_a.umount_wait() | |
e306af50 | 14 | self.mount_a.mount_wait() |
7c673cae | 15 | |
f67539c2 | 16 | initial_op_read = self.mount_a.get_op_read_count() |
7c673cae | 17 | self.mount_a.run_shell(["dd", "if=foo", "of=/dev/null", "bs=128k", "count=32"]) |
f67539c2 | 18 | op_read = self.mount_a.get_op_read_count() |
2a845540 | 19 | self.assertGreaterEqual(op_read, initial_op_read) |
f67539c2 TL |
20 | op_read -= initial_op_read |
21 | log.info("read operations: {0}".format(op_read)) | |
7c673cae FG |
22 | |
23 | # with exponentially increasing readahead, we should see fewer than 10 operations | |
24 | # but this test simply checks if the client is doing a remote read for each local read | |
f67539c2 | 25 | if op_read >= 32: |
7c673cae | 26 | raise RuntimeError("readahead not working") |