1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 import arvados_fuse.command
13 from .integration_test import workerPool
16 from shlex import quote
18 from pipes import quote
20 def try_exec(mnt, cmd):
22 arvados_fuse.command.Mount(
23 arvados_fuse.command.ArgumentParser().parse_args([
26 '--unmount-timeout=0.1',
28 '--exec'] + cmd)).run()
32 raise AssertionError('should have exited')
35 class ExecMode(unittest.TestCase):
39 run_test_server.run_keep(enforce_permissions=True, num_servers=2)
40 run_test_server.authorize_with('active')
43 def tearDownClass(cls):
44 run_test_server.stop_keep(num_servers=2)
47 self.mnt = tempfile.mkdtemp()
48 _, self.okfile = tempfile.mkstemp()
52 os.unlink(self.okfile)
55 workerPool().apply(try_exec, (self.mnt, [
57 'echo -n foo >{}; cp {} {}'.format(
58 quote(os.path.join(self.mnt, 'zzz', 'foo.txt')),
59 quote(os.path.join(self.mnt, 'zzz', '.arvados#collection')),
60 quote(os.path.join(self.okfile)))]))
61 self.assertRegexpMatches(
62 json.load(open(self.okfile))['manifest_text'],