]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test_cephfs.py: add test to create and rm 2000 level of subdirs that...
authorRishabh Dave <ridave@redhat.com>
Wed, 3 Sep 2025 09:00:52 +0000 (14:30 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 1 Oct 2025 19:01:46 +0000 (00:31 +0530)
mimicks rmtree() as closely as possible.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/test/pybind/test_cephfs.py

index 14814c1c53f42dd98b41400ee82d9ace7889906b..18aa94d494138628bd635fd7e9f1be594c11f670 100644 (file)
@@ -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())