[tracker-miners/sam/functional-tests-intermittent-failures] functional-tests: Fix intermittent test failures



commit c85834a23d6bae84ac6b2e4ba5f09447a5175b98
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Sep 21 16:40:27 2019 +0200

    functional-tests: Fix intermittent test failures
    
    The various intermittent test failures were caused by a race condition,
    where the miner sometimes ignores files created during the initial
    crawl. (https://gitlab.gnome.org/GNOME/tracker-miners/issues/79).
    
    Fixes: https://gitlab.gnome.org/GNOME/tracker-miners/issues/56, 
https://gitlab.gnome.org/GNOME/tracker-miners/issues/57, 
https://gitlab.gnome.org/GNOME/tracker-miners/issues/62

 tests/functional-tests/minertest.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/tests/functional-tests/minertest.py b/tests/functional-tests/minertest.py
index e6143c41f..47485b5d2 100644
--- a/tests/functional-tests/minertest.py
+++ b/tests/functional-tests/minertest.py
@@ -92,16 +92,22 @@ class CommonTrackerMinerTest(ut.TestCase):
                 self.tracker.start_and_wait_for_ready()
                 self.tracker.start_watching_updates()
 
+                # We must create the test data before the miner does its
+                # initial crawl, or it may miss some files due
+                # https://gitlab.gnome.org/GNOME/tracker-miners/issues/79.
+                monitored_files = self.create_test_data()
+
                 self.miner_fs = MinerFsHelper(
                     self.sandbox.get_connection())
                 self.miner_fs.start()
                 self.miner_fs.start_watching_progress()
 
-                self.create_test_data()
-                self.tracker.stop_watching_updates()
+                for tf in monitored_files:
+                    self.tracker.await_resource_inserted(NFO_DOCUMENT, url=self.uri(tf))
 
                 # We reset update-tracking, so that updates for data created in the
                 # fixture can't be mixed up with updates created by the test case.
+                self.tracker.stop_watching_updates()
                 self.tracker.start_watching_updates()
             except Exception:
                 self.sandbox.stop()
@@ -139,8 +145,7 @@ class CommonTrackerMinerTest(ut.TestCase):
             with open(testfile, 'w') as f:
                 f.write(DEFAULT_TEXT)
 
-        for tf in monitored_files:
-            self.tracker.await_resource_inserted(NFO_DOCUMENT, url=self.uri(tf))
+        return monitored_files
 
     def remove_test_data(self):
         try:


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