Test that rmdir does not delete directory containing file
"""
self.run_cephfs_shell_cmd("mkdir " + self.dir_name)
- self.run_cephfs_shell_cmd("put - test_dir/dumpfile",
- stdin="Valid File")
- self.run_cephfs_shell_cmd("rmdir" + self.dir_name)
++
+ self.run_cephfs_shell_cmd("put - test_dir/dumpfile", stdin="Valid File")
+ # see comment below
+ # with self.assertRaises(CommandFailedError) as cm:
+ with self.assertRaises(CommandFailedError):
+ self.run_cephfs_shell_cmd("rmdir " + self.dir_name)
+ # TODO: we need to check for exit code and error message as well.
+ # skipping it for not since error codes used by cephfs-shell are not
+ # standard and they may change soon.
+ # self.assertEqual(cm.exception.exitcode, 39)
self.mount_a.stat(self.dir_name)
def test_rmdir_existing_file(self):
o = self.get_cephfs_shell_cmd_output("help all")
log.info("output:\n{}".format(o))
+
+ def test_chmod(self):
+ """Test chmod is allowed above o0777 """
+
+ test_file1 = "test_file2.txt"
+ file1_content = 'A' * 102
+ self.run_cephfs_shell_cmd(f"write {test_file1}", stdin=file1_content)
+ self.run_cephfs_shell_cmd(f"chmod 01777 {test_file1}")
+
class TestShellOpts(TestCephFSShell):
"""
Contains tests for shell options from conf file and shell prompt.