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
=== modified file 'tests/syncdaemon/test_action_queue.py'
--- tests/syncdaemon/test_action_queue.py 2010-09-27 15:52:41 +0000
+++ tests/syncdaemon/test_action_queue.py 2010-12-09 14:33:40 +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
@@ -2752,6 +2753,22 @@
2752 d.addCallback(check)2753 d.addCallback(check)
2753 return d2754 return d
27542755
2756 def test_have_sufficient_space_for_upload_if_free_space_is_none(self):
2757 """Check have_sufficient_space_for_upload.
2758
2759 If free_space is None, SYS_QUOTA_EXCEEDED is not pushed.
2760
2761 """
2762 self.patch(self.action_queue.main.vm, 'get_free_space',
2763 lambda share_id: None) # free space is None
2764 volume_id = 'test share'
2765 res = self.action_queue.have_sufficient_space_for_upload(volume_id,
2766 upload_size=1)
2767 self.assertTrue(res, "Must have enough space to upload.")
2768 events = map(operator.itemgetter(0),
2769 self.action_queue.event_queue.events)
2770 self.assertNotIn('SYS_QUOTA_EXCEEDED', events)
2771
2755 def test_have_sufficient_space_for_upload_if_no_free_space(self):2772 def test_have_sufficient_space_for_upload_if_no_free_space(self):
2756 """Check have_sufficient_space_for_upload pushes SYS_QUOTA_EXCEEDED."""2773 """Check have_sufficient_space_for_upload pushes SYS_QUOTA_EXCEEDED."""
2757 self.patch(self.action_queue.main.vm, 'get_free_space',2774 self.patch(self.action_queue.main.vm, 'get_free_space',
27582775
=== modified file 'ubuntuone/syncdaemon/action_queue.py'
--- ubuntuone/syncdaemon/action_queue.py 2010-09-27 15:52:41 +0000
+++ ubuntuone/syncdaemon/action_queue.py 2010-12-09 14:33:40 +0000
@@ -654,7 +654,7 @@
654 def have_sufficient_space_for_upload(self, share_id, upload_size):654 def have_sufficient_space_for_upload(self, share_id, upload_size):
655 """Returns True if we have sufficient space for the given upload."""655 """Returns True if we have sufficient space for the given upload."""
656 free = self.main.vm.get_free_space(share_id)656 free = self.main.vm.get_free_space(share_id)
657 enough = free >= upload_size657 enough = free is None or free >= upload_size
658 if not enough:658 if not enough:
659 logger.info("Not enough space for upload %s bytes (available: %s)",659 logger.info("Not enough space for upload %s bytes (available: %s)",
660 upload_size, free)660 upload_size, free)

Subscribers

People subscribed via source and target branches