From: Patrick Donnelly Date: Tue, 15 Apr 2025 16:18:33 +0000 (-0400) Subject: qa: test charmap changes with dir and snaps X-Git-Tag: v20.3.0~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=05ca22ffd4245158139375746e2dc6cab02e43b5;p=ceph.git qa: test charmap changes with dir and snaps Signed-off-by: Patrick Donnelly --- diff --git a/qa/tasks/cephfs/test_dir_charmap.py b/qa/tasks/cephfs/test_dir_charmap.py index d32b487ceb66..cb19d95f27ee 100644 --- a/qa/tasks/cephfs/test_dir_charmap.py +++ b/qa/tasks/cephfs/test_dir_charmap.py @@ -228,6 +228,57 @@ class TestCharMapVxattr(CephFSTestCase, CharMapMixin): stderr = p.stderr.getvalue() self.fail("command failed:\n%s", stderr) + def test_cs_snaps_set_insensitive(self): + """ + That setting a charmap fails for an empty directory with snaps. + """ + + attrs = { + "ceph.dir.casesensitive": False, + "ceph.dir.normalization": "nfc", + "ceph.dir.encoding": "utf8", + } + + self.mount_a.run_shell_payload("mkdir -p foo/dir; mkdir foo/.snap/one; rmdir foo/dir") + for attr, v in attrs.items(): + try: + self.mount_a.setfattr("foo/", attr, v, helpfulexception=True) + except DirectoryNotEmptyError: + pass + else: + self.fail("should fail") + try: + self.check_cs("foo") + except NoSuchAttributeError: + pass + else: + self.fail("should fail") + + def test_cs_parent_snaps_set_insensitive(self): + """ + That setting a charmap succeeds for an empty directory with parent snaps. + """ + + attrs = { + "ceph.dir.casesensitive": False, + "ceph.dir.normalization": "nfc", + "ceph.dir.encoding": "utf8", + } + + self.mount_a.run_shell_payload("mkdir -p foo/{trash,bar}; mkdir foo/.snap/one; rmdir foo/trash;") + for attr, v in attrs.items(): + try: + self.mount_a.setfattr("foo/bar", attr, v, helpfulexception=True) + except DirectoryNotEmptyError: + pass + else: + self.fail("should fail") + try: + self.check_cs("foo/bar") + except NoSuchAttributeError: + pass + else: + self.fail("should fail") def test_cs_remount(self): """