1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 from builtins import range
7 import arvados.collection
9 import arvados_fuse.command
16 from .integration_test import IntegrationTest
17 from .mount_test_base import MountTestBase
19 class CacheTest(IntegrationTest):
20 mnt_args = ["--by-id", "--directory-cache=0"]
22 @IntegrationTest.mount(argv=mnt_args)
23 def test_cache_spill(self):
26 cw = arvados.collection.Collection()
27 f = cw.open("blurg%i" % i, "w")
28 f.write("bloop%i" % i)
30 cw.mkdirs("dir%i" % i)
31 f = cw.open("dir%i/blurg" % i, "w")
32 f.write("dirbloop%i" % i)
35 pdh.append(cw.portable_data_hash())
36 self.pool_test(self.mnt, pdh)
39 def _test_cache_spill(self, mnt, pdh):
40 for i,v in enumerate(pdh):
41 j = os.path.join(mnt, "by_id", v, "blurg%i" % i)
42 self.assertTrue(os.path.exists(j))
43 j = os.path.join(mnt, "by_id", v, "dir%i/blurg" % i)
44 self.assertTrue(os.path.exists(j))
46 for i,v in enumerate(pdh):
47 j = os.path.join(mnt, "by_id", v, "blurg%i" % i)
48 self.assertTrue(os.path.exists(j))
49 j = os.path.join(mnt, "by_id", v, "dir%i/blurg" % i)
50 self.assertTrue(os.path.exists(j))