From 6e2226ded1f6fb6a72824203edb9dfde35c4455b Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Wed, 3 Sep 2025 14:30:52 +0530 Subject: [PATCH] test_cephfs.py: add test to create and rm 2000 level of subdirs that... mimicks rmtree() as closely as possible. Signed-off-by: Rishabh Dave --- src/test/pybind/test_cephfs.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/test/pybind/test_cephfs.py b/src/test/pybind/test_cephfs.py index 14814c1c53f..18aa94d4941 100644 --- a/src/test/pybind/test_cephfs.py +++ b/src/test/pybind/test_cephfs.py @@ -158,6 +158,29 @@ def test_xattr(testdir): assert_equal(9, ret_val) assert_equal("user.big\x00", ret_buff.decode('utf-8')) +def test_create_and_rm_2000_subdir_levels_close(testdir): + LEVELS = 2000 + + for i in range(1, LEVELS + 1): + dirname = f'dir{i}' + cephfs.mkdir(dirname, 0o755) + cephfs.chdir(dirname) + cephfs.chdir('/') + + dirpath = 'dir1/' + i = 1 + stack = collections.deque([dirpath,]) + while stack: + dirpath = stack[-1] + try: + cephfs.rmdir(dirpath) + stack.pop() + except libcephfs.ObjectNotEmpty: + i += 1 + dirpath += f'dir{i}/' + stack.append(dirpath) + continue + def test_ceph_mirror_xattr(testdir): def gen_mirror_xattr(): cluster_id = str(uuid.uuid4()) -- 2.39.5