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
=== modified file 'tests/syncdaemon/test_action_queue.py'
--- tests/syncdaemon/test_action_queue.py 2010-12-06 15:01:06 +0000
+++ tests/syncdaemon/test_action_queue.py 2010-12-09 13:42:51 +0000
@@ -23,6 +23,7 @@
23import base6423import base64
24from functools import wraps24from functools import wraps
25import logging25import logging
26import operator
26import os27import os
27import shutil28import shutil
28import unittest29import unittest
@@ -3120,6 +3121,22 @@
3120 d.addCallback(check)3121 d.addCallback(check)
3121 return d3122 return d
31223123
3124 def test_have_sufficient_space_for_upload_if_free_space_is_none(self):
3125 """Check have_sufficient_space_for_upload.
3126
3127 If free_space is None, SYS_QUOTA_EXCEEDED is not pushed.
3128
3129 """
3130 self.patch(self.action_queue.main.vm, 'get_free_space',
3131 lambda share_id: None) # free space is None
3132 volume_id = 'test share'
3133 res = self.action_queue.have_sufficient_space_for_upload(volume_id,
3134 upload_size=1)
3135 self.assertTrue(res, "Must have enough space to upload.")
3136 events = map(operator.itemgetter(0),
3137 self.action_queue.event_queue.events)
3138 self.assertNotIn('SYS_QUOTA_EXCEEDED', events)
3139
3123 def test_have_sufficient_space_for_upload_if_no_free_space(self):3140 def test_have_sufficient_space_for_upload_if_no_free_space(self):
3124 """Check have_sufficient_space_for_upload pushes SYS_QUOTA_EXCEEDED."""3141 """Check have_sufficient_space_for_upload pushes SYS_QUOTA_EXCEEDED."""
3125 self.patch(self.action_queue.main.vm, 'get_free_space',3142 self.patch(self.action_queue.main.vm, 'get_free_space',
31263143
=== modified file 'ubuntuone/platform/linux/dbus_interface.py'
--- ubuntuone/platform/linux/dbus_interface.py 2010-12-06 15:01:06 +0000
+++ ubuntuone/platform/linux/dbus_interface.py 2010-12-09 13:42:51 +0000
@@ -1461,7 +1461,7 @@
1461 @dbus.service.method(DBUS_IFACE_CONFIG_NAME,1461 @dbus.service.method(DBUS_IFACE_CONFIG_NAME,
1462 in_signature='b', out_signature='')1462 in_signature='b', out_signature='')
1463 def set_files_sync_enabled(self, enabled):1463 def set_files_sync_enabled(self, enabled):
1464 """Enable UDF autosubscribe."""1464 """Enable/disable file sync service."""
1465 logger.debug('called set_files_sync_enabled %d', enabled)1465 logger.debug('called set_files_sync_enabled %d', enabled)
1466 user_config = config.get_user_config()1466 user_config = config.get_user_config()
1467 user_config.set_files_sync_enabled(bool(int(enabled)))1467 user_config.set_files_sync_enabled(bool(int(enabled)))
@@ -1470,8 +1470,8 @@
1470 @dbus.service.method(DBUS_IFACE_CONFIG_NAME,1470 @dbus.service.method(DBUS_IFACE_CONFIG_NAME,
1471 in_signature='', out_signature='b')1471 in_signature='', out_signature='b')
1472 def files_sync_enabled(self):1472 def files_sync_enabled(self):
1473 """Return the files_sync_enabled config value."""
1473 logger.debug('called files_sync_enabled')1474 logger.debug('called files_sync_enabled')
1474 """Return the udf_autosubscribe config value."""
1475 return config.get_user_config().get_files_sync_enabled()1475 return config.get_user_config().get_files_sync_enabled()
14761476
14771477
14781478
=== modified file 'ubuntuone/syncdaemon/action_queue.py'
--- ubuntuone/syncdaemon/action_queue.py 2010-12-06 15:01:06 +0000
+++ ubuntuone/syncdaemon/action_queue.py 2010-12-09 13:42:51 +0000
@@ -662,7 +662,7 @@
662 def have_sufficient_space_for_upload(self, share_id, upload_size):662 def have_sufficient_space_for_upload(self, share_id, upload_size):
663 """Returns True if we have sufficient space for the given upload."""663 """Returns True if we have sufficient space for the given upload."""
664 free = self.main.vm.get_free_space(share_id)664 free = self.main.vm.get_free_space(share_id)
665 enough = free >= upload_size665 enough = free is None or free >= upload_size
666 if not enough:666 if not enough:
667 logger.info("Not enough space for upload %s bytes (available: %s)",667 logger.info("Not enough space for upload %s bytes (available: %s)",
668 upload_size, free)668 upload_size, free)

Subscribers

People subscribed via source and target branches