Merge branch '18947-githttpd'
[arvados.git] / services / fuse / tests / performance / test_collection_performance.py
index c4eadca0f8dc3d418f700733432dc8f6e0c1796e..98bc98abd4cb2a9686f0e21d0bf514683bcde74a 100644 (file)
@@ -1,3 +1,11 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+from __future__ import absolute_import
+from future.utils import viewitems
+from builtins import str
+from builtins import range
 import arvados
 import arvados_fuse as fuse
 import llfuse
@@ -7,10 +15,11 @@ import sys
 import unittest
 from .. import run_test_server
 from ..mount_test_base import MountTestBase
+from ..slow_test import slow_test
 
 logger = logging.getLogger('arvados.arv-mount')
 
-from performance_profiler import profiled
+from .performance_profiler import profiled
 
 def fuse_createCollectionWithMultipleBlocks(mounttmp, streams=1, files_per_stream=1, data='x'):
     class Test(unittest.TestCase):
@@ -80,6 +89,7 @@ class CreateCollectionWithMultipleBlocksAndMoveAndDeleteFile(MountTestBase):
     def setUp(self):
         super(CreateCollectionWithMultipleBlocksAndMoveAndDeleteFile, self).setUp()
 
+    @slow_test
     def test_CreateCollectionWithManyBlocksAndMoveAndDeleteFile(self):
         collection = arvados.collection.Collection(api_client=self.api)
         collection.save_new()
@@ -215,6 +225,7 @@ class CreateCollectionWithManyFilesAndMoveAndDeleteFile(MountTestBase):
     def setUp(self):
         super(CreateCollectionWithManyFilesAndMoveAndDeleteFile, self).setUp()
 
+    @slow_test
     def test_CreateCollectionWithManyFilesAndMoveAndDeleteFile(self):
         collection = arvados.collection.Collection(api_client=self.api)
         collection.save_new()
@@ -323,10 +334,11 @@ class UsingMagicDir_CreateCollectionWithManyFilesAndMoveAndDeleteFile(MountTestB
         for j in range(0, files_per_stream):
             files[os.path.join(self.mounttmp, collection, 'file'+str(j)+'.txt')] = data
 
-        for k, v in files.items():
+        for k, v in viewItems(files):
             with open(os.path.join(self.mounttmp, collection, k)) as f:
                 self.assertEqual(v, f.read())
 
+    @slow_test
     def test_UsingMagicDirCreateCollectionWithManyFilesAndMoveAndDeleteFile(self):
         streams = 2
         files_per_stream = 200
@@ -382,6 +394,7 @@ class UsingMagicDir_CreateCollectionWithManyFilesAndMoveAllFilesIntoAnother(Moun
         collection.save_new()
         return collection
 
+    @slow_test
     def test_UsingMagicDirCreateCollectionWithManyFilesAndMoveAllFilesIntoAnother(self):
         streams = 2
         files_per_stream = 200
@@ -428,6 +441,7 @@ class UsingMagicDir_CreateCollectionWithManyFilesAndMoveEachFileIntoAnother(Moun
             self.pool.apply(magicDirTest_MoveFileFromCollection, (self.mounttmp, from_collection.manifest_locator(),
                   to_collection.manifest_locator(), 'stream0', 'file'+str(j)+'.txt',))
 
+    @slow_test
     def test_UsingMagicDirCreateCollectionWithManyFilesAndMoveEachFileIntoAnother(self):
         streams = 2
         files_per_stream = 200
@@ -458,10 +472,9 @@ class FuseListLargeProjectContents(MountTestBase):
         project_contents = llfuse.listdir(self.mounttmp)
         self.assertEqual(201, len(project_contents))
         self.assertIn('Collection_1', project_contents)
-        return project_contents
 
     @profiled
-    def listContentsInProjectWithManyCollections(self, project_contents):
+    def listContentsInProjectWithManyCollections(self):
         project_contents = llfuse.listdir(self.mounttmp)
         self.assertEqual(201, len(project_contents))
         self.assertIn('Collection_1', project_contents)
@@ -470,8 +483,9 @@ class FuseListLargeProjectContents(MountTestBase):
             collection_contents = llfuse.listdir(os.path.join(self.mounttmp, collection_name))
             self.assertIn('baz', collection_contents)
 
+    @slow_test
     def test_listLargeProjectContents(self):
         self.make_mount(fuse.ProjectDirectory,
                         project_object=run_test_server.fixture('groups')['project_with_201_collections'])
-        project_contents = self.getProjectWithManyCollections()
-        self.listContentsInProjectWithManyCollections(project_contents)
+        self.getProjectWithManyCollections()
+        self.listContentsInProjectWithManyCollections()