[tracker/tracker-1.2] functional-tests: Remove all remaining 'wait for miner to be idle' calls



commit 288c15febefe2b2fad822bd71f38590edcf2ea27
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Aug 2 03:27:12 2014 +0100

    functional-tests: Remove all remaining 'wait for miner to be idle' calls
    
    We are running against a clean data directory when run by 'test-runner.sh', so
    the miner should not have any initial crawling work to do. Therefore the tests
    don't need to wait for it to be idle before starting.
    
    Test cases should use the await_resource_inserted() and
    await_resource_deleted() methods as these are (in theory) reliable. Waiting for
    the miner to go idle and hoping this means that the desired file was crawled
    and extracted is not reliable at all.
    
    This should hopefully make the tests robust enough to be run continuously
    without random failures occuring.
    
    The tracker_miner_fs_wait_for_idle() functions are gone forever!

 tests/functional-tests/300-miner-basic-ops.py    |    3 --
 tests/functional-tests/601-applications-sync.py  |    4 +--
 tests/functional-tests/common/utils/helpers.py   |   39 ----------------------
 tests/functional-tests/common/utils/minertest.py |    1 -
 tests/functional-tests/common/utils/system.py    |    7 ----
 5 files changed, 1 insertions(+), 53 deletions(-)
---
diff --git a/tests/functional-tests/300-miner-basic-ops.py b/tests/functional-tests/300-miner-basic-ops.py
index 31f1699..9725997 100755
--- a/tests/functional-tests/300-miner-basic-ops.py
+++ b/tests/functional-tests/300-miner-basic-ops.py
@@ -295,11 +295,8 @@ class MinerCrawlTest (CommonTrackerMinerTest):
         self.assertIn ( uri ("test-monitored/file1.txt"), unpacked_result)
 
         # Restore the dirs
-        #  Wait after each operation to be sure of the results
         os.makedirs (os.path.join (MINER_TMP_DIR, "test-monitored", "dir1"))
-        self.system.tracker_miner_fs_wait_for_idle ()
         os.makedirs (os.path.join (MINER_TMP_DIR, "test-monitored", "dir1", "dir2"))
-        self.system.tracker_miner_fs_wait_for_idle ()
         for f in ["test-monitored/dir1/file2.txt",
                   "test-monitored/dir1/dir2/file3.txt"]:
             filename = os.path.join (MINER_TMP_DIR, f)
diff --git a/tests/functional-tests/601-applications-sync.py b/tests/functional-tests/601-applications-sync.py
index 2dc753c..26dad95 100755
--- a/tests/functional-tests/601-applications-sync.py
+++ b/tests/functional-tests/601-applications-sync.py
@@ -36,7 +36,6 @@ import unittest2 as ut
 from common.utils.applicationstest import CommonTrackerApplicationTest as CommonTrackerApplicationTest
 from common.utils.helpers import log
 
-MINER_FS_IDLE_TIMEOUT = 30
 
 class TrackerSyncApplicationTests (CommonTrackerApplicationTest):
 
@@ -91,13 +90,12 @@ class TrackerSyncApplicationTests (CommonTrackerApplicationTest):
         # Copy the image to the dest path
         self.slowcopy_file (origin_filepath, dest_filepath)
         assert os.path.exists (dest_filepath)
-        self.system.tracker_miner_fs_wait_for_idle (MINER_FS_IDLE_TIMEOUT)
+        self.tracker.await_resource_inserted ('nmm:MusicPiece', url=dest_fileuri)
         self.assertEquals (self.get_urn_count_by_url (dest_fileuri), 1)
 
         # Clean the new file so the test directory is as before
         log ("Remove and wait")
         os.remove (dest_filepath)
-        self.system.tracker_miner_fs_wait_for_idle (MINER_FS_IDLE_TIMEOUT)
         self.assertEquals (self.get_urn_count_by_url (dest_fileuri), 0)
 
 if __name__ == "__main__":
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 607efdb..8dd9b95 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -579,24 +579,9 @@ class MinerFsHelper (Helper):
 
         return False
 
-    def _minerfs_status_cb (self, status, progress, remaining_time):
-        if (status == "Idle"):
-            self.loop.quit ()
-
     def start (self):
         Helper.start (self)
 
-        self.status_match = self.bus.add_signal_receiver (self._minerfs_status_cb,
-                                                          signal_name="Progress",
-                                                          path=cfg.MINERFS_OBJ_PATH,
-                                                          dbus_interface=cfg.MINER_IFACE)
-
-        # It should step out of this loop after progress changes to "Idle"
-        self.timeout_id = GLib.timeout_add_seconds (REASONABLE_TIMEOUT, self._timeout_on_idle_cb)
-        self.loop.run ()
-        if self.timeout_id is not None:
-            GLib.source_remove (self.timeout_id)
-
         bus_object = self.bus.get_object (cfg.MINERFS_BUSNAME,
                                           cfg.MINERFS_OBJ_PATH)
         self.miner_fs = dbus.Interface (bus_object,
@@ -605,33 +590,9 @@ class MinerFsHelper (Helper):
     def stop (self):
         Helper.stop (self)
 
-        self.bus._clean_up_signal_match (self.status_match)
-
     def ignore (self, filelist):
         self.miner_fs.IgnoreNextUpdate (filelist)
 
-    def wait_for_idle (self, timeout=REASONABLE_TIMEOUT):
-        """
-        Block until the miner has finished crawling and its status becomes "Idle"
-        """
-        status = self.miner_fs.GetStatus()
-        log ('Current miner FS status: %s' % status)
-
-        if status == 'Idle':
-            return
-
-        self.status_match = self.bus.add_signal_receiver (self._minerfs_status_cb,
-                                                          signal_name="Progress",
-                                                          path=cfg.MINERFS_OBJ_PATH,
-                                                          dbus_interface=cfg.MINER_IFACE)
-        self.timeout_id = GLib.timeout_add_seconds (REASONABLE_TIMEOUT, self._timeout_on_idle_cb)
-
-        self.loop.run ()
-
-        if self.timeout_id is not None:
-            GLib.source_remove (self.timeout_id)
-        self.bus._clean_up_signal_match (self.status_match)
-
 
 class ExtractorHelper (Helper):
 
diff --git a/tests/functional-tests/common/utils/minertest.py 
b/tests/functional-tests/common/utils/minertest.py
index 7111d86..82e2b85 100644
--- a/tests/functional-tests/common/utils/minertest.py
+++ b/tests/functional-tests/common/utils/minertest.py
@@ -102,7 +102,6 @@ class CommonTrackerMinerTest (ut.TestCase):
             confdir = os.path.join (cfg.DATADIR, "tracker-tests",
                                     "test-configurations", "miner-basic-ops")
         self.system.tracker_miner_fs_testing_start (CONF_OPTIONS)
-        self.system.tracker_miner_fs_wait_for_idle ()
         self.tracker = self.system.store
         
     @classmethod
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 8759750..16540c7 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -178,13 +178,6 @@ class TrackerSystemAbstraction:
         self.miner_fs = helpers.MinerFsHelper ()
         self.miner_fs.start ()
 
-    def tracker_miner_fs_wait_for_idle (self, timeout=REASONABLE_TIMEOUT):
-        """
-        Copy the files physically in the filesyste and wait for the miner to complete the work
-        """
-        self.miner_fs.wait_for_idle (timeout)
-
-
     def tracker_miner_fs_testing_stop (self):
         """
         Stops the miner-fs and store running and unset all the XDG_*_HOME vars


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]