[tracker/sam/functional-test-fixes: 22/28] 300 further: test 7 doesn't pass yet.



commit 49dbbbb0e7277e8835739bd479f8cbfd0a518194
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Aug 2 02:20:38 2014 +0100

    300 further: test 7 doesn't pass yet.

 tests/functional-tests/300-miner-basic-ops.py |   35 ++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/tests/functional-tests/300-miner-basic-ops.py b/tests/functional-tests/300-miner-basic-ops.py
index 4eeaf1b..201d67d 100755
--- a/tests/functional-tests/300-miner-basic-ops.py
+++ b/tests/functional-tests/300-miner-basic-ops.py
@@ -222,23 +222,44 @@ class MinerCrawlTest (CommonTrackerMinerTest):
     def test_07_move_from_monitored_to_monitored (self):
         """
         Move a file between monitored directories
+
+        FIXME: the following test triggers a bug in the current tracker-miner-fs.
+        From the logs:
+
+            (tracker-miner-fs:31209): Tracker-DEBUG: Received monitor event:7 (G_FILE_MONITOR_EVENT_MOVED) 
for files 
'file:///home/sam/tracker-tests/test-monitored/dir1/file2.txt'->'file:///home/sam/tracker-tests/test-monitored/file2.txt'
+            (tracker-miner-fs:31209): Tracker-DEBUG: Emitting ITEM_MOVED for (FILE) 
'file:///home/sam/tracker-tests/test-monitored/dir1/file2.txt'->'file:///home/sam/tracker-tests/test-monitored/file2.txt'
+            Tracker-INFO: Processing...
+            (tracker-miner-fs:31209): Tracker-DEBUG: Moving item from 
'file:///home/sam/tracker-tests/test-monitored/dir1/file2.txt' to 
'file:///home/sam/tracker-tests/test-monitored/file2.txt'
+            (tracker-miner-fs:31209): Tracker-DEBUG: Flushing SPARQL buffer, reason: Queue handlers NONE
+            (tracker-miner-fs:31209): Tracker-DEBUG: (Sparql buffer) Finished array-update with 1 tasks
+            (tracker-miner-fs:31209): Tracker-CRITICAL **:   (Sparql buffer) Error in task 0 of the 
array-update: Subject `(null)' is not in domain `nfo:FileDataObject' of property `nfo:fileName'
+            (tracker-miner-fs:31209): Tracker-DEBUG:     Affected file: 
file:///home/sam/tracker-tests/test-monitored/file2.txt
+            (tracker-miner-fs:31209): Tracker-DEBUG:     Sparql: DELETE {   ?urn a rdfs:Resource } WHERE {  
?urn nie:url "file:///home/sam/tracker-tests/test-monitored/file2.txt" }DELETE {   <(null)> nfo:fileName ?f ; 
       nie:url ?u ;        nie:isStoredAs ?s ;        nfo:belongsToContainer ?b} WHERE {   <(null)> 
nfo:fileName ?f ;        nie:url ?u ;        nie:isStoredAs ?s ;        nfo:belongsToContainer ?b} INSERT 
INTO <(null)> {  <(null)> nfo:fileName "file2.txt" ;        nie:url 
"file:///home/sam/tracker-tests/test-monitored/file2.txt" ;        nie:isStoredAs <(null)> ;        
nfo:belongsToContainer "urn:uuid:d591817d-eb50-bd26-ae0d-21eb1943241f"}
+
+            (tracker-miner-fs:31209): Tracker-CRITICAL **: Could not execute sparql: Subject `(null)' is not 
in domain `nfo:FileDataObject' of property `nfo:fileName'
+
+        Seems that the item_move() function doesn't expect the source_iri
+        to be NULL, and includes it in the query anyway.
+
+
         """
+
         source = os.path.join("test-monitored", "dir1", "file2.txt")
         dest = os.path.join("test-monitored", "file2.txt")
 
-        source_dir_urn = self.__get_file_urn (os.path.basename(path(source)))
+        resource_id = self.tracker.get_resource_id(url=uri(source))
+
+        source_dir_urn = self.__get_file_urn (os.path.dirname(source))
         parent_before = self.__get_parent_urn (source)
         self.assertEquals (source_dir_urn, parent_before)
 
         shutil.move (path(source), path(dest))
-        # FIXME: resource won't be inserted, just the nie:url field updated.
-        # For now, use wait_for_idle :(
-        self.system.tracker_miner_fs_wait_for_idle ()
+        self.tracker.await_property_changed(resource_id, 'nie:url')
 
         # Checking fix for NB#214413: After a move operation, nfo:belongsToContainer
         # should be changed to the new one
-        dest_dir_urn = self.__get_file_urn (os.path.basename(path(dest)))
-        parent_after = self.__get_parent_urn (path(dest))
+        dest_dir_urn = self.__get_file_urn (os.path.dirname(dest))
+        parent_after = self.__get_parent_urn (dest)
         self.assertNotEquals (parent_before, parent_after)
         self.assertEquals (dest_dir_urn, parent_after)
 
@@ -251,7 +272,7 @@ class MinerCrawlTest (CommonTrackerMinerTest):
 
         # Restore the file
         shutil.move (path(dest), path(source))
-        self.system.store.await_resource_inserted ('nfo:TextDocument', uri(source))
+        self.tracker.await_property_changed(resource_id, 'nie:url')
 
         result = self.__get_text_documents ()
         self.assertEquals (len (result), 3)


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