Merge lp:~lucio.torre/ubuntuone-client/add-upload-cancel into lp:ubuntuone-client

Proposed by Lucio Torre
Status: Merged
Approved by: Lucio Torre
Approved revision: 819
Merged at revision: 818
Proposed branch: lp:~lucio.torre/ubuntuone-client/add-upload-cancel
Merge into: lp:ubuntuone-client
Diff against target: 40 lines (+18/-0)
2 files modified
tests/syncdaemon/test_sync.py (+15/-0)
ubuntuone/syncdaemon/sync.py (+3/-0)
To merge this branch: bzr merge lp:~lucio.torre/ubuntuone-client/add-upload-cancel
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+47435@code.launchpad.net

Commit message

Adds cancel-upload before all uploads

Description of the change

Adds cancel-upload before one upload, so as to avoid the previous upload being removed from the queue but not cancelled.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
819. By Lucio Torre

removed blank line

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Code looks good and all test passes. Approving with the promise of proper test suites as per bug #707586 :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_sync.py'
2--- tests/syncdaemon/test_sync.py 2011-01-20 21:27:24 +0000
3+++ tests/syncdaemon/test_sync.py 2011-01-25 18:32:13 +0000
4@@ -340,7 +340,22 @@
5 mdobj = self.fsm.get_by_mdid(mdid)
6 self.sync._handle_SV_HASH_NEW(mdobj.share_id, mdobj.node_id, '')
7 self.assertTrue(self.called)
8+
9+ def test_SV_HASH_NEW_with_file_uploadinterrupted_coverage(self):
10+ """A SV_HASH_NEW is received after upload interrupted."""
11+ self.called = False
12+
13+ # create a file and put it in local, without server_hash, as
14+ # if the upload was cut in the middle after the make file
15+ somepath = os.path.join(self.root, 'somepath')
16+ mdid = self.fsm.create(somepath, '', node_id='node_id')
17+ self.fsm.set_by_mdid(mdid, local_hash='somehash', crc32='crc32',
18+ stat='stat', size='size')
19
20+ # send the event with no content and check
21+ mdobj = self.fsm.get_by_mdid(mdid)
22+ self.sync._handle_SV_HASH_NEW(mdobj.share_id, mdobj.node_id, '')
23+
24 def test_AQ_FILE_NEW_OK_with_md_in_none(self):
25 """Created the file, and MD says it's in NONE."""
26 # fake method
27
28=== modified file 'ubuntuone/syncdaemon/sync.py'
29--- ubuntuone/syncdaemon/sync.py 2011-01-14 14:58:19 +0000
30+++ ubuntuone/syncdaemon/sync.py 2011-01-25 18:32:13 +0000
31@@ -572,6 +572,9 @@
32
33 def reput_file_from_local(self, event, params, hash):
34 """Re put the file from its local state."""
35+ self.m.action_q.cancel_upload(share_id=self.key['share_id'],
36+ node_id=self.key['node_id'])
37+
38 local_hash = self.key['local_hash']
39 previous_hash = self.key['server_hash']
40 crc32 = self.key['crc32']

Subscribers

People subscribed via source and target branches