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
This commit is contained in:
Pete Zaitcev 2018-10-26 00:24:55 -05:00
parent 6bb8229b75
commit 1663782459
1 changed files with 3 additions and 1 deletions

View File

@ -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