[tahoe-lafs-trac-stream] [tahoe-lafs] #1384: use storage/shares/ instead of storage/ to detect available space
tahoe-lafs
trac at tahoe-lafs.org
Tue Aug 9 11:43:04 PDT 2011
#1384: use storage/shares/ instead of storage/ to detect available space
-------------------------+-------------------------------------------------
Reporter: zooko | Owner: zooko
Type: defect | Status: assigned
Priority: minor | Milestone: 1.9.0
Component: code- | Version: 1.8.2
nodeadmin | Keywords: usability configuration defaults
Resolution: | storage review-needed
Launchpad Bug: |
-------------------------+-------------------------------------------------
Comment (by warner):
I get a test failure in the new {{{test_status_right_disk_stats}}}:
{{{
[ERROR]
Traceback (most recent call last):
File "build/bdist.macosx-10.6-universal/egg/mock.py", line 562, in
patched
File
"/Users/warner2/stuff/tahoe/trunk-1384/src/allmydata/test/test_storage.py",
line 2556, in test_status_right_disk_stats
ss = StorageServer(basedir, "\x00" * 20, reserved_space=1*GB)
File
"/Users/warner2/stuff/tahoe/trunk-1384/src/allmydata/storage/server.py",
line 72, in __init__
if self.get_available_space() is None:
File
"/Users/warner2/stuff/tahoe/trunk-1384/src/allmydata/storage/server.py",
line 207, in get_available_space
return fileutil.get_available_space(self.sharedir,
self.reserved_space)
File
"/Users/warner2/stuff/tahoe/trunk-1384/src/allmydata/util/fileutil.py",
line 415, in get_available_space
return get_disk_stats(whichdir, reserved_space)['avail']
exceptions.TypeError: 'Mock' object is unsubscriptable
allmydata.test.test_storage.WebStatus.test_status_right_disk_stats
}}}
My guess is that the mocked {{{get_disk_stats()}}} isn't ready to be
called (because {{{.side_effect}}} wasn't added) by the time
{{{StorageServer.__init__}}} invokes it.
Maybe it'd be better to make {{{call_get_disk_stats}}} just add
{{{whichdir}}} to a set, then at the end of the test assert that the set
has just one element and that it's equal to {{{expecteddir}}}. Then set
up the mock's {{{.side_effect}}} before constructing the
{{{StorageServer}}} object.
--
Ticket URL: <http://tahoe-lafs.org/trac/tahoe-lafs/ticket/1384#comment:9>
tahoe-lafs <http://tahoe-lafs.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list