Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / tasks / cephfs / test_config_commands.py
1
2 from unittest import case
3 from tasks.cephfs.cephfs_test_case import CephFSTestCase
4 from tasks.cephfs.fuse_mount import FuseMount
5
6
7 class TestConfigCommands(CephFSTestCase):
8     """
9     Test that daemons and clients respond to the otherwise rarely-used
10     runtime config modification operations.
11     """
12
13     CLIENTS_REQUIRED = 1
14     MDSS_REQUIRED = 1
15
16     def test_client_config(self):
17         """
18         That I can successfully issue asok "config set" commands
19
20         :return:
21         """
22
23         if not isinstance(self.mount_a, FuseMount):
24             raise case.SkipTest("Test only applies to FUSE clients")
25
26         test_key = "client_cache_size"
27         test_val = "123"
28         self.mount_a.admin_socket(['config', 'set', test_key, test_val])
29         out = self.mount_a.admin_socket(['config', 'get', test_key])
30         self.assertEqual(out[test_key], test_val)
31
32         self.mount_a.write_n_mb("file.bin", 1);
33
34         # Implicitly asserting that things don't have lockdep error in shutdown
35         self.mount_a.umount_wait(require_clean=True)
36         self.fs.mds_stop()
37
38     def test_mds_config_asok(self):
39         test_key = "mds_max_purge_ops"
40         test_val = "123"
41         self.fs.mds_asok(['config', 'set', test_key, test_val])
42         out = self.fs.mds_asok(['config', 'get', test_key])
43         self.assertEqual(out[test_key], test_val)
44
45         # Implicitly asserting that things don't have lockdep error in shutdown
46         self.mount_a.umount_wait(require_clean=True)
47         self.fs.mds_stop()
48
49     def test_mds_config_tell(self):
50         test_key = "mds_max_purge_ops"
51         test_val = "123"
52
53         mds_id = self.fs.get_lone_mds_id()
54         self.fs.mon_manager.raw_cluster_cmd("tell", "mds.{0}".format(mds_id), "injectargs",
55                                             "--{0}={1}".format(test_key, test_val))
56
57         # Read it back with asok because there is no `tell` equivalent
58         out = self.fs.mds_asok(['config', 'get', test_key])
59         self.assertEqual(out[test_key], test_val)
60
61         # Implicitly asserting that things don't have lockdep error in shutdown
62         self.mount_a.umount_wait(require_clean=True)
63         self.fs.mds_stop()