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
16 from .integration_test import workerPool
18 def try_exec(mnt, cmd):
20 os.environ['KEEP_LOCAL_STORE'] = tempfile.mkdtemp()
21 arvados_fuse.command.Mount(
22 arvados_fuse.command.ArgumentParser().parse_args([
25 '--unmount-timeout=0.1',
27 '--exec'] + cmd)).run()
31 raise AssertionError('should have exited')
34 class ExecMode(unittest.TestCase):
38 run_test_server.run_keep(blob_signing=True, num_servers=2)
39 run_test_server.authorize_with('active')
42 def tearDownClass(cls):
43 run_test_server.stop_keep(num_servers=2)
46 self.mnt = tempfile.mkdtemp()
47 _, self.okfile = tempfile.mkstemp()
51 os.unlink(self.okfile)
54 workerPool().apply(try_exec, (self.mnt, [
55 'sh', '-c', 'echo -n foo >{}; cp {} {}'.format(
56 shlex.quote(os.path.join(self.mnt, 'zzz', 'foo.txt')),
57 shlex.quote(os.path.join(self.mnt, 'zzz', '.arvados#collection')),
58 shlex.quote(os.path.join(self.okfile)),
60 with open(self.okfile) as f:
63 json.load(f)['manifest_text'],