From: Rishabh Dave Date: Mon, 6 Apr 2026 07:00:03 +0000 (+0530) Subject: test_cephfs.py: test rmtree on root X-Git-Tag: v21.0.1~255^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=962a0c5b071e112b4f82c9ebf449e835a4494ac7;p=ceph.git test_cephfs.py: test rmtree on root Signed-off-by: Rishabh Dave --- diff --git a/src/test/pybind/test_cephfs.py b/src/test/pybind/test_cephfs.py index 6412a22405b..0d3a906087b 100644 --- a/src/test/pybind/test_cephfs.py +++ b/src/test/pybind/test_cephfs.py @@ -1728,6 +1728,20 @@ class TestRmtree: cephfs.rmtree('dir3', should_cancel, suppress_errors=False) assert_raises(libcephfs.ObjectNotFound, cephfs.stat, 'dir3') + def test_rmtree_on_root(self): + cephfs.mkdir('/dir1', 0o755) + for i in range(1, 6): + fd = cephfs.open(f'/dir1/file{i}', 'w', 0o755) + cephfs.write(fd, b'abcd', 0) + cephfs.close(fd) + + # Errors are not expected from the call to this method. Therefore, set + # suppress_errors to False so that tests abort as soon as any errors + # occur. + cephfs.rmtree('/', suppress_errors=False) + assert_raises(libcephfs.ObjectNotFound, cephfs.stat, 'dir1') + assert_raises(libcephfs.ObjectNotFound, cephfs.stat, '/dir1/file1') + def test_rmtree_with_and_without_should_cancel(self): cephfs.mkdir('dir1', 0o755) for i in range(1, 6):