From aad0d91babf7d2b713645a7242d1a3a1e598dd4e Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 5 Apr 2016 18:49:18 +0100 Subject: [PATCH] tasks/cephfs: add TestVolumeClient.test_purge For reproducing error handling paths during purge, such as #15266 (ASCII exception) Fixes: http://tracker.ceph.com/issues/15266 Signed-off-by: John Spray (cherry picked from commit 798c50e9bcd6c62b7e1687c85db718bca6883b3e) --- tasks/cephfs/test_volume_client.py | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tasks/cephfs/test_volume_client.py b/tasks/cephfs/test_volume_client.py index f738db88ae78f..616f5841d97b9 100644 --- a/tasks/cephfs/test_volume_client.py +++ b/tasks/cephfs/test_volume_client.py @@ -446,3 +446,54 @@ vc.disconnect() # We must hard-umount the one that we evicted self.mounts[2].umount_wait(force=True) + + def test_purge(self): + """ + Reproducer for #15266, exception trying to purge volumes that + contain non-ascii filenames. + + Additionally test any other purge corner cases here. + """ + # I'm going to leave mount_b unmounted and just use it as a handle for + # driving volumeclient. It's a little hacky but we don't have a more + # general concept for librados/libcephfs clients as opposed to full + # blown mounting clients. + self.mount_b.umount_wait() + self._configure_vc_auth(self.mount_b, "manila") + + group_id = "grpid" + # Use a unicode volume ID (like Manila), to reproduce #15266 + volume_id = u"volid" + + # Create + mount_path = self._volume_client_python(self.mount_b, dedent(""" + vp = VolumePath("{group_id}", u"{volume_id}") + create_result = vc.create_volume(vp, 10) + print create_result['mount_path'] + """.format( + group_id=group_id, + volume_id=volume_id + ))) + + # Strip leading "/" + mount_path = mount_path[1:] + + # A file with non-ascii characters + self.mount_a.run_shell(["touch", os.path.join(mount_path, u"b\u00F6b")]) + + # A file with no permissions to do anything + self.mount_a.run_shell(["touch", os.path.join(mount_path, "noperms")]) + self.mount_a.run_shell(["chmod", "0000", os.path.join(mount_path, "noperms")]) + + self._volume_client_python(self.mount_b, dedent(""" + vp = VolumePath("{group_id}", u"{volume_id}") + vc.delete_volume(vp) + vc.purge_volume(vp) + """.format( + group_id=group_id, + volume_id=volume_id + ))) + + # Check it's really gone + self.assertEqual(self.mount_a.ls("volumes/_deleting"), []) + self.assertEqual(self.mount_a.ls("volumes/"), ["_deleting", group_id]) -- 2.39.5