projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '12125-workbench-project-trash' refs #12125
[arvados.git]
/
services
/
fuse
/
tests
/
mount_test_base.py
diff --git
a/services/fuse/tests/mount_test_base.py
b/services/fuse/tests/mount_test_base.py
index 5e0e4c700ab08468b6b53a29b27d3ecd369ee91a..d476fc771b4c0d5ad890d902cd41810f62f6fe3c 100644
(file)
--- a/
services/fuse/tests/mount_test_base.py
+++ b/
services/fuse/tests/mount_test_base.py
@@
-1,3
+1,7
@@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
import arvados
import arvados_fuse as fuse
import arvados.safeapi
import arvados
import arvados_fuse as fuse
import arvados.safeapi
@@
-17,6
+21,8
@@
import unittest
logger = logging.getLogger('arvados.arv-mount')
logger = logging.getLogger('arvados.arv-mount')
+from .integration_test import workerPool
+
class MountTestBase(unittest.TestCase):
def setUp(self, api=None, local_store=True):
# The underlying C implementation of open() makes a fstat() syscall
class MountTestBase(unittest.TestCase):
def setUp(self, api=None, local_store=True):
# The underlying C implementation of open() makes a fstat() syscall
@@
-26,8
+32,8
@@
class MountTestBase(unittest.TestCase):
# deadlocks. The workaround is to run some of our test code in a
# separate process. Forturnately the multiprocessing module makes this
# relatively easy.
# deadlocks. The workaround is to run some of our test code in a
# separate process. Forturnately the multiprocessing module makes this
# relatively easy.
- self.pool = multiprocessing.Pool(1)
+ self.pool = workerPool()
if local_store:
self.keeptmp = tempfile.mkdtemp()
os.environ['KEEP_LOCAL_STORE'] = self.keeptmp
if local_store:
self.keeptmp = tempfile.mkdtemp()
os.environ['KEEP_LOCAL_STORE'] = self.keeptmp
@@
-66,26
+72,25
@@
class MountTestBase(unittest.TestCase):
def tearDown(self):
if self.llfuse_thread:
def tearDown(self):
if self.llfuse_thread:
+ if self.operations.events:
+ self.operations.events.close(timeout=10)
subprocess.call(["fusermount", "-u", "-z", self.mounttmp])
subprocess.call(["fusermount", "-u", "-z", self.mounttmp])
- self.llfuse_thread.join(timeout=1)
- if self.llfuse_thread.is_alive():
- logger.warning("MountTestBase.tearDown():"
- " llfuse thread still alive 1s after umount"
- " -- waiting another 10s")
- self.llfuse_thread.join(timeout=10)
+ t0 = time.time()
+ self.llfuse_thread.join(timeout=10)
if self.llfuse_thread.is_alive():
logger.warning("MountTestBase.tearDown():"
" llfuse thread still alive 10s after umount"
" -- exiting with SIGKILL")
os.kill(os.getpid(), signal.SIGKILL)
if self.llfuse_thread.is_alive():
logger.warning("MountTestBase.tearDown():"
" llfuse thread still alive 10s after umount"
" -- exiting with SIGKILL")
os.kill(os.getpid(), signal.SIGKILL)
+ waited = time.time() - t0
+ if waited > 0.1:
+ logger.warning("MountTestBase.tearDown(): waited %f s for llfuse thread to end", waited)
os.rmdir(self.mounttmp)
if self.keeptmp:
shutil.rmtree(self.keeptmp)
os.environ.pop('KEEP_LOCAL_STORE')
run_test_server.reset()
os.rmdir(self.mounttmp)
if self.keeptmp:
shutil.rmtree(self.keeptmp)
os.environ.pop('KEEP_LOCAL_STORE')
run_test_server.reset()
- self.pool.close()
- self.pool.join()
def assertDirContents(self, subdir, expect_content):
path = self.mounttmp
def assertDirContents(self, subdir, expect_content):
path = self.mounttmp