diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2014-07-20 14:56:58 +0100 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2014-12-26 23:18:40 +0000 |
commit | d9bee0e3da28316364c4965f1c436e41811ae26a (patch) | |
tree | 629c736de9e32e5673985b551fff8c3f2999af02 | |
parent | 547a5a17bd45350913bb987d53535c125f58f9c6 (diff) | |
download | tracker-d9bee0e3da28316364c4965f1c436e41811ae26a.tar.gz |
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.
-rwxr-xr-x | tests/functional-tests/601-applications-sync.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/functional-tests/601-applications-sync.py b/tests/functional-tests/601-applications-sync.py index 26dad9558..c3747c62d 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,15 +101,19 @@ 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) 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.tracker.await_resource_deleted (resource_id) self.assertEquals (self.get_urn_count_by_url (dest_fileuri), 0) if __name__ == "__main__": |