[tracker/sam/functional-test-fixes: 26/30] functional-tests: Fix and improve 601-applications-sync



commit f0508498e94fff80e0a088783b1c8640dcd240b0
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Jul 20 14:56:58 2014 +0100

    functional-tests: Fix and improve 601-applications-sync
    
    This test adds data that would normally be added by the FS miner.
    In order for the resource to be correctly deleted when the file is
    removed, it must set nie:isStoredAs correctly.
    
    Replaced a tracker_miner_fs_wait_for_idle() call with await_resource_deleted()
    too, and added a note about the error tracker-miner-fs logs during this test.

 tests/functional-tests/601-applications-sync.py |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/tests/functional-tests/601-applications-sync.py b/tests/functional-tests/601-applications-sync.py
index 5655b57..4ed69e2 100755
--- a/tests/functional-tests/601-applications-sync.py
+++ b/tests/functional-tests/601-applications-sync.py
@@ -47,6 +47,19 @@ class TrackerSyncApplicationTests (CommonTrackerApplicationTest):
         2. Write the file
         3. Wait for miner-fs to index it
         4. Ensure no duplicates are found
+
+        During stage 3 you should see the following error from the FS miner, if
+        viewing its logs:
+
+            (tracker-miner-fs:16008): Tracker-CRITICAL **:   (Sparql buffer)
+                Error in task 0 of the array-update: UNIQUE constraint failed:
+                nie:DataObject.nie:url (strerror of errno ...)
+
+            (tracker-miner-fs:16008): Tracker-CRITICAL **: Could not execute
+                sparql: UNIQUE constraint failed: nie:DataObject.nie:url
+                (strerror of errno ...)
+
+        This is because the test already inserted the resource in the store.
         """
 
         origin_filepath = os.path.join (self.get_data_dir (), self.get_test_music ())
@@ -73,7 +86,8 @@ class TrackerSyncApplicationTests (CommonTrackerApplicationTest):
                      nfo:averageAudioBitrate '32000' ;
                      nfo:genre               'Pop' ;
                      nfo:isContentEncrypted  'false' ;
-                     nie:title               'Simply Juvenile'
+                     nie:title               'Simply Juvenile' ;
+                     nie:isStoredAs          _:x
         }
 
         INSERT { <urn:album:SinCos> a              nmm:MusicAlbum;
@@ -87,6 +101,8 @@ class TrackerSyncApplicationTests (CommonTrackerApplicationTest):
         self.tracker.update (insert)
         self.assertEquals (self.get_urn_count_by_url (dest_fileuri), 1)
 
+        resource_id = self.tracker.get_resource_id(dest_fileuri)
+
         # Copy the image to the dest path
         self.slowcopy_file (origin_filepath, dest_filepath)
         assert os.path.exists (dest_filepath)
@@ -96,7 +112,7 @@ class TrackerSyncApplicationTests (CommonTrackerApplicationTest):
         # 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.tracker.await_resource_deleted (resource_id)
         self.assertEquals (self.get_urn_count_by_url (dest_fileuri), 0)
 
 if __name__ == "__main__":


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