1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 from __future__ import absolute_import
6 import arvados_fuse.command
10 from . import run_test_server
14 from .integration_test import workerPool
17 from shlex import quote
19 from pipes import quote
21 def try_exec(mnt, cmd):
23 arvados_fuse.command.Mount(
24 arvados_fuse.command.ArgumentParser().parse_args([
27 '--unmount-timeout=0.1',
29 '--exec'] + cmd)).run()
33 raise AssertionError('should have exited')
36 class ExecMode(unittest.TestCase):
40 run_test_server.run_keep(enforce_permissions=True, num_servers=2)
41 run_test_server.authorize_with('active')
44 def tearDownClass(cls):
45 run_test_server.stop_keep(num_servers=2)
48 self.mnt = tempfile.mkdtemp()
49 _, self.okfile = tempfile.mkstemp()
53 os.unlink(self.okfile)
56 workerPool().apply(try_exec, (self.mnt, [
58 'echo -n foo >{}; cp {} {}'.format(
59 quote(os.path.join(self.mnt, 'zzz', 'foo.txt')),
60 quote(os.path.join(self.mnt, 'zzz', '.arvados#collection')),
61 quote(os.path.join(self.okfile)))]))
62 self.assertRegexpMatches(
63 json.load(open(self.okfile))['manifest_text'],