From: Peter Amstutz Date: Mon, 4 Dec 2023 19:37:31 +0000 (-0500) Subject: 21223: Add a few more --file-cache RLIMIT_NOFILE tests X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/refs/heads/21223-arv-mount-nofile 21223: Add a few more --file-cache RLIMIT_NOFILE tests Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/services/fuse/tests/test_command_args.py b/services/fuse/tests/test_command_args.py index 9f4aa53bdb..b08ab19335 100644 --- a/services/fuse/tests/test_command_args.py +++ b/services/fuse/tests/test_command_args.py @@ -265,18 +265,36 @@ class MountArgsTest(unittest.TestCase): @noexit @mock.patch('resource.setrlimit') @mock.patch('resource.getrlimit') - def test_file_cache(self, getrlimit, setrlimit): + def test_default_file_cache(self, getrlimit, setrlimit): args = arvados_fuse.command.ArgumentParser().parse_args([ - '--foreground', '--file-cache=256000000000', self.mntdir]) + '--foreground', self.mntdir]) self.assertEqual(args.mode, None) - getrlimit.return_value = (1024, 1048576) + self.mnt = arvados_fuse.command.Mount(args) + setrlimit.assert_called_with(resource.RLIMIT_NOFILE, (10240, 1048576)) + @noexit + @mock.patch('resource.setrlimit') + @mock.patch('resource.getrlimit') + def test_small_file_cache(self, getrlimit, setrlimit): + args = arvados_fuse.command.ArgumentParser().parse_args([ + '--foreground', '--file-cache=256000000', self.mntdir]) + self.assertEqual(args.mode, None) + getrlimit.return_value = (1024, 1048576) self.mnt = arvados_fuse.command.Mount(args) + setrlimit.assert_not_called() + @noexit + @mock.patch('resource.setrlimit') + @mock.patch('resource.getrlimit') + def test_large_file_cache(self, getrlimit, setrlimit): + args = arvados_fuse.command.ArgumentParser().parse_args([ + '--foreground', '--file-cache=256000000000', self.mntdir]) + self.assertEqual(args.mode, None) + getrlimit.return_value = (1024, 1048576) + self.mnt = arvados_fuse.command.Mount(args) setrlimit.assert_called_with(resource.RLIMIT_NOFILE, (30517, 1048576)) - @noexit @mock.patch('resource.setrlimit') @mock.patch('resource.getrlimit') @@ -284,11 +302,8 @@ class MountArgsTest(unittest.TestCase): args = arvados_fuse.command.ArgumentParser().parse_args([ '--foreground', '--file-cache=256000000000', self.mntdir]) self.assertEqual(args.mode, None) - getrlimit.return_value = (1024, 2048) - self.mnt = arvados_fuse.command.Mount(args) - setrlimit.assert_called_with(resource.RLIMIT_NOFILE, (2048, 2048)) class MountErrorTest(unittest.TestCase):