1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 from __future__ import absolute_import
6 from six import assertRegex
7 import arvados_fuse.command
11 from . import run_test_server
15 from .integration_test import workerPool
18 from shlex import quote
20 from pipes import quote
22 def try_exec(mnt, cmd):
24 os.environ['KEEP_LOCAL_STORE'] = tempfile.mkdtemp()
25 arvados_fuse.command.Mount(
26 arvados_fuse.command.ArgumentParser().parse_args([
29 '--unmount-timeout=0.1',
31 '--exec'] + cmd)).run()
35 raise AssertionError('should have exited')
38 class ExecMode(unittest.TestCase):
42 run_test_server.run_keep(blob_signing=True, num_servers=2)
43 run_test_server.authorize_with('active')
46 def tearDownClass(cls):
47 run_test_server.stop_keep(num_servers=2)
50 self.mnt = tempfile.mkdtemp()
51 _, self.okfile = tempfile.mkstemp()
55 os.unlink(self.okfile)
58 workerPool().apply(try_exec, (self.mnt, [
60 'echo -n foo >{}; cp {} {}'.format(
61 quote(os.path.join(self.mnt, 'zzz', 'foo.txt')),
62 quote(os.path.join(self.mnt, 'zzz', '.arvados#collection')),
63 quote(os.path.join(self.okfile)))]))
64 with open(self.okfile) as f:
67 json.load(f)['manifest_text'],