Merge lp:~nataliabidart/ubuntuone-client/quota-exceeded-and-none-stable into lp:ubuntuone-client/stable-1-4

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 741
Merged at revision: 742
Proposed branch: lp:~nataliabidart/ubuntuone-client/quota-exceeded-and-none-stable
Merge into: lp:ubuntuone-client/stable-1-4
Diff against target: 47 lines (+18/-1)
2 files modified
tests/syncdaemon/test_action_queue.py (+17/-0)
ubuntuone/syncdaemon/action_queue.py (+1/-1)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-client/quota-exceeded-and-none-stable
Reviewer Review Type Date Requested Status
Roman Yepishev (community) code Approve
dobey (community) Approve
Review via email: mp+43217@code.launchpad.net

Commit message

If free space is None, SYS_QUOTA_EXCEEDED is not pushed (LP: #671023).

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Roman Yepishev (rye) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_action_queue.py'
2--- tests/syncdaemon/test_action_queue.py 2010-09-27 15:52:41 +0000
3+++ tests/syncdaemon/test_action_queue.py 2010-12-09 14:33:40 +0000
4@@ -23,6 +23,7 @@
5 import base64
6 from functools import wraps
7 import logging
8+import operator
9 import os
10 import shutil
11 import unittest
12@@ -2752,6 +2753,22 @@
13 d.addCallback(check)
14 return d
15
16+ def test_have_sufficient_space_for_upload_if_free_space_is_none(self):
17+ """Check have_sufficient_space_for_upload.
18+
19+ If free_space is None, SYS_QUOTA_EXCEEDED is not pushed.
20+
21+ """
22+ self.patch(self.action_queue.main.vm, 'get_free_space',
23+ lambda share_id: None) # free space is None
24+ volume_id = 'test share'
25+ res = self.action_queue.have_sufficient_space_for_upload(volume_id,
26+ upload_size=1)
27+ self.assertTrue(res, "Must have enough space to upload.")
28+ events = map(operator.itemgetter(0),
29+ self.action_queue.event_queue.events)
30+ self.assertNotIn('SYS_QUOTA_EXCEEDED', events)
31+
32 def test_have_sufficient_space_for_upload_if_no_free_space(self):
33 """Check have_sufficient_space_for_upload pushes SYS_QUOTA_EXCEEDED."""
34 self.patch(self.action_queue.main.vm, 'get_free_space',
35
36=== modified file 'ubuntuone/syncdaemon/action_queue.py'
37--- ubuntuone/syncdaemon/action_queue.py 2010-09-27 15:52:41 +0000
38+++ ubuntuone/syncdaemon/action_queue.py 2010-12-09 14:33:40 +0000
39@@ -654,7 +654,7 @@
40 def have_sufficient_space_for_upload(self, share_id, upload_size):
41 """Returns True if we have sufficient space for the given upload."""
42 free = self.main.vm.get_free_space(share_id)
43- enough = free >= upload_size
44+ enough = free is None or free >= upload_size
45 if not enough:
46 logger.info("Not enough space for upload %s bytes (available: %s)",
47 upload_size, free)

Subscribers

People subscribed via source and target branches