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

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 766
Merged at revision: 768
Proposed branch: lp:~nataliabidart/ubuntuone-client/quota-exceeded-and-none
Merge into: lp:ubuntuone-client
Diff against target: 70 lines (+20/-3)
3 files modified
tests/syncdaemon/test_action_queue.py (+17/-0)
ubuntuone/platform/linux/dbus_interface.py (+2/-2)
ubuntuone/syncdaemon/action_queue.py (+1/-1)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-client/quota-exceeded-and-none
Reviewer Review Type Date Requested Status
Roman Yepishev (community) code Approve
dobey (community) Approve
Review via email: mp+43210@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) wrote :

Those docstrings puzzled me once too :)

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-12-06 15:01:06 +0000
3+++ tests/syncdaemon/test_action_queue.py 2010-12-09 13:42:51 +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@@ -3120,6 +3121,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/platform/linux/dbus_interface.py'
37--- ubuntuone/platform/linux/dbus_interface.py 2010-12-06 15:01:06 +0000
38+++ ubuntuone/platform/linux/dbus_interface.py 2010-12-09 13:42:51 +0000
39@@ -1461,7 +1461,7 @@
40 @dbus.service.method(DBUS_IFACE_CONFIG_NAME,
41 in_signature='b', out_signature='')
42 def set_files_sync_enabled(self, enabled):
43- """Enable UDF autosubscribe."""
44+ """Enable/disable file sync service."""
45 logger.debug('called set_files_sync_enabled %d', enabled)
46 user_config = config.get_user_config()
47 user_config.set_files_sync_enabled(bool(int(enabled)))
48@@ -1470,8 +1470,8 @@
49 @dbus.service.method(DBUS_IFACE_CONFIG_NAME,
50 in_signature='', out_signature='b')
51 def files_sync_enabled(self):
52+ """Return the files_sync_enabled config value."""
53 logger.debug('called files_sync_enabled')
54- """Return the udf_autosubscribe config value."""
55 return config.get_user_config().get_files_sync_enabled()
56
57
58
59=== modified file 'ubuntuone/syncdaemon/action_queue.py'
60--- ubuntuone/syncdaemon/action_queue.py 2010-12-06 15:01:06 +0000
61+++ ubuntuone/syncdaemon/action_queue.py 2010-12-09 13:42:51 +0000
62@@ -662,7 +662,7 @@
63 def have_sufficient_space_for_upload(self, share_id, upload_size):
64 """Returns True if we have sufficient space for the given upload."""
65 free = self.main.vm.get_free_space(share_id)
66- enough = free >= upload_size
67+ enough = free is None or free >= upload_size
68 if not enough:
69 logger.info("Not enough space for upload %s bytes (available: %s)",
70 upload_size, free)

Subscribers

People subscribed via source and target branches