From 1663782459f06ccd6c0fbfe2914ed3c8f80b0ba5 Mon Sep 17 00:00:00 2001 From: Pete Zaitcev Date: Fri, 26 Oct 2018 00:24:55 -0500 Subject: [PATCH] Fix up the test for .ismount We kept hitting a floating error in the test, where fist ismount in the test succeeds, while it should fail. As it turned out, the return of gettempdir was the plain /tmp. So, a previous test created /tmp/.ismount and the subsequent runs failed on it. Re-generating the root filesystem (e.g. by a container) fixes the problem, but still, there's no need to do this. This change tightens the test up by placing the .ismount into a subdirectory of the test directory instead of the global /tmp. Change-Id: I006ba1f69982ef7513db3508d691723656f576c9 --- test/unit/common/test_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py index 9362b30e5a..e639842386 100644 --- a/test/unit/common/test_utils.py +++ b/test/unit/common/test_utils.py @@ -3162,7 +3162,9 @@ cluster_dfw1 = http://dfw1.host/v1/ tmpdir = mkdtemp() try: link = os.path.join(tmpdir, "tmp") - os.symlink(tempfile.gettempdir(), link) + rdir = os.path.join(tmpdir, "realtmp") + os.mkdir(rdir) + os.symlink(rdir, link) self.assertFalse(utils.ismount(link)) # Can add a stubfile to make it pass