From: Rishabh Dave Date: Sat, 30 Apr 2022 09:14:19 +0000 (+0530) Subject: qa/cephfs: make file data unique in caps_helper.py X-Git-Tag: v18.0.0~162^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2601831ff72f75983efc3e160f3c84f92b832a0e;p=ceph.git qa/cephfs: make file data unique in caps_helper.py Let's change the file data to include the file path, the CephFS name and the host FS and CephFS mountpoint so that the bugs where, let's say, "cephfs2" is mounted instead of "cephfs1" (where obviously both the CephFSs lie on the same Ceph cluster) is caught by the tests due to uniqueness of every test file's content. Signed-off-by: Rishabh Dave --- diff --git a/qa/tasks/cephfs/caps_helper.py b/qa/tasks/cephfs/caps_helper.py index ac1bc24d091f..69e78b2dffed 100644 --- a/qa/tasks/cephfs/caps_helper.py +++ b/qa/tasks/cephfs/caps_helper.py @@ -33,7 +33,7 @@ class CapTester(CephFSTestCase): at the path passed in testpath for the given list of mounts. If testpath is empty, the file is created at the root of the CephFS. """ - dirname, filename, filedata = 'testdir', 'testfile', 'testdata' + dirname, filename = 'testdir', 'testfile' self.test_set = [] # XXX: The reason behind testpath[1:] below is that the testpath is # supposed to contain a path inside CephFS (which might be passed as @@ -51,6 +51,15 @@ class CapTester(CephFSTestCase): dirpath = os_path_join(mount_x.hostfs_mntpt, testpath, dirname) mount_x.run_shell(f'mkdir {dirpath}') filepath = os_path_join(dirpath, filename) + # XXX: the reason behind adding filepathm, cephfs_name and both + # mntpts is to avoid a test bug where we mount cephfs1 but what + # ends up being mounted cephfs2. since filepath and filedata are + # identical, how would tests figure otherwise that they are + # accessing the right filename but on wrong CephFS. + filedata = (f'filepath = {filepath}\n' + f'cephfs_name = {mount_x.cephfs_name}\n' + f'cephfs_mntpt = {mount_x.cephfs_mntpt}\n' + f'hostfs_mntpt = {mount_x.hostfs_mntpt}') mount_x.write_file(filepath, filedata) self.test_set.append((mount_x, filepath, filedata))