Ticket #1384: test-1384.darcs.patch

File test-1384.darcs.patch, 17.3 KB (added by davidsarah, at 2011-07-19T19:54:52Z)

test for: use the filesystem of storage/shares/, rather than storage/, to calculate remaining space. refs #1384

Line 
11 patch for repository davidsarah@dev.allmydata.org:/home/darcs/tahoe/trunk:
2
3Tue Jul 19 19:54:33 BST 2011  david-sarah@jacaranda.org
4  * test for: use the filesystem of storage/shares/, rather than storage/, to calculate remaining space. refs #1384
5
6New patches:
7
8[test for: use the filesystem of storage/shares/, rather than storage/, to calculate remaining space. refs #1384
9david-sarah@jacaranda.org**20110719185433
10 Ignore-this: 971ec4aa3aa931da7330b9a8a78d2b48
11] hunk ./src/allmydata/test/test_storage.py 2548
12         self.failUnlessIn("Space Available to Tahoe: ?", s)
13         self.failUnlessEqual(ss.get_available_space(), 0)
14 
15+    @mock.patch('allmydata.util.fileutil.get_disk_stats')
16+    def test_status_right_disk_stats(self, mock_get_disk_stats):
17+        # fileutil.get_disk_stats must be called with the share directory,
18+        # not any other directory.
19+        basedir = "storage/WebStatus/status_right_disk_stats"
20+        fileutil.make_dirs(basedir)
21+        GB = 1000000000
22+        ss = StorageServer(basedir, "\x00" * 20, reserved_space=1*GB)
23+        expecteddir = ss.sharedir
24+
25+        def call_get_disk_stats(whichdir, reserved_space=0):
26+            if whichdir != expecteddir:
27+                self.fail("fileutil.get_disk_stats called with directory %r, expected %r" % (whichdir, expecteddir))
28+            total            = 5*GB
29+            free_for_root    = 4*GB
30+            free_for_nonroot = 3*GB
31+            used = total - free_for_root
32+            avail = max(free_for_nonroot - reserved_space, 0)
33+            return { 'total': total,
34+                     'free_for_root': free_for_root,
35+                     'free_for_nonroot': free_for_nonroot,
36+                     'used': used,
37+                     'avail': avail,
38+                   }
39+        mock_get_disk_stats.side_effect = call_get_disk_stats
40+
41+        ss.setServiceParent(self.s)
42+        w = StorageStatus(ss)
43+        html = w.renderSynchronously()
44+
45+        self.failUnless(mock_get_disk_stats.called, "fileutil.get_disk_stats was not called")
46+        self.failUnlessIn("<h1>Storage Server Status</h1>", html)
47+        s = remove_tags(html)
48+        self.failUnlessIn("Total disk space: 5.00 GB", s)
49+        self.failUnlessIn("Disk space used: - 1.00 GB", s)
50+        self.failUnlessIn("Disk space free (root): 4.00 GB", s)
51+        self.failUnlessIn("Disk space free (non-root): 3.00 GB", s)
52+        self.failUnlessIn("Reserved space: - 1.00 GB", s)
53+        self.failUnlessIn("Space Available to Tahoe: 2.00 GB", s)
54+        self.failUnlessEqual(ss.get_available_space(), 2*GB)
55+
56     def test_readonly(self):
57         basedir = "storage/WebStatus/readonly"
58         fileutil.make_dirs(basedir)
59
60Context:
61
62[docs/running.rst: use 'tahoe run ~/.tahoe' instead of 'tahoe run' (the default is the current directory, unlike 'tahoe start').
63david-sarah@jacaranda.org**20110718005949
64 Ignore-this: 81837fbce073e93d88a3e7ae3122458c
65]
66[docs/running.rst: say to put the introducer.furl in tahoe.cfg.
67david-sarah@jacaranda.org**20110717194315
68 Ignore-this: 954cc4c08e413e8c62685d58ff3e11f3
69]
70[setup: remove the dependency on foolscap's "secure_connections" extra, add a dependency on pyOpenSSL
71zooko@zooko.com**20110717114226
72 Ignore-this: df222120d41447ce4102616921626c82
73 fixes #1383
74]
75[docs: add missing link in NEWS.rst
76zooko@zooko.com**20110712153307
77 Ignore-this: be7b7eb81c03700b739daa1027d72b35
78]
79[contrib: remove the contributed fuse modules and the entire contrib/ directory, which is now empty
80zooko@zooko.com**20110712153229
81 Ignore-this: 723c4f9e2211027c79d711715d972c5
82 Also remove a couple of vestigial references to figleaf, which is long gone.
83 fixes #1409 (remove contrib/fuse)
84]
85[README.txt: say that quickstart.rst is in the docs directory.
86david-sarah@jacaranda.org**20110717192400
87 Ignore-this: bc6d35a85c496b77dbef7570677ea42a
88]
89[test_sftp.py cleanup: remove a redundant definition of failUnlessReallyEqual.
90david-sarah@jacaranda.org**20110716181813
91 Ignore-this: 50113380b368c573f07ac6fe2eb1e97f
92]
93[add Protovis.js-based download-status timeline visualization
94Brian Warner <warner@lothar.com>**20110629222606
95 Ignore-this: 477ccef5c51b30e246f5b6e04ab4a127
96 
97 provide status overlap info on the webapi t=json output, add decode/decrypt
98 rate tooltips, add zoomin/zoomout buttons
99]
100[add more download-status data, fix tests
101Brian Warner <warner@lothar.com>**20110629222555
102 Ignore-this: e9e0b7e0163f1e95858aa646b9b17b8c
103]
104[prepare for viz: improve DownloadStatus events
105Brian Warner <warner@lothar.com>**20110629222542
106 Ignore-this: 16d0bde6b734bb501aa6f1174b2b57be
107 
108 consolidate IDownloadStatusHandlingConsumer stuff into DownloadNode
109]
110[docs: fix error in crypto specification that was noticed by Taylor R Campbell <campbell+tahoe@mumble.net>
111zooko@zooko.com**20110629185711
112 Ignore-this: b921ed60c1c8ba3c390737fbcbe47a67
113]
114[setup.py: don't make bin/tahoe.pyscript executable. fixes #1347
115david-sarah@jacaranda.org**20110130235809
116 Ignore-this: 3454c8b5d9c2c77ace03de3ef2d9398a
117]
118[Makefile: remove targets relating to 'setup.py check_auto_deps' which no longer exists. fixes #1345
119david-sarah@jacaranda.org**20110626054124
120 Ignore-this: abb864427a1b91bd10d5132b4589fd90
121]
122[Makefile: add 'make check' as an alias for 'make test'. Also remove an unnecessary dependency of 'test' on 'build' and 'src/allmydata/_version.py'. fixes #1344
123david-sarah@jacaranda.org**20110623205528
124 Ignore-this: c63e23146c39195de52fb17c7c49b2da
125]
126[Rename test_package_initialization.py to (much shorter) test_import.py .
127Brian Warner <warner@lothar.com>**20110611190234
128 Ignore-this: 3eb3dbac73600eeff5cfa6b65d65822
129 
130 The former name was making my 'ls' listings hard to read, by forcing them
131 down to just two columns.
132]
133[tests: fix tests to accomodate [20110611153758-92b7f-0ba5e4726fb6318dac28fb762a6512a003f4c430]
134zooko@zooko.com**20110611163741
135 Ignore-this: 64073a5f39e7937e8e5e1314c1a302d1
136 Apparently none of the two authors (stercor, terrell), three reviewers (warner, davidsarah, terrell), or one committer (me) actually ran the tests. This is presumably due to #20.
137 fixes #1412
138]
139[wui: right-align the size column in the WUI
140zooko@zooko.com**20110611153758
141 Ignore-this: 492bdaf4373c96f59f90581c7daf7cd7
142 Thanks to Ted "stercor" Rolle Jr. and Terrell Russell.
143 fixes #1412
144]
145[docs: three minor fixes
146zooko@zooko.com**20110610121656
147 Ignore-this: fec96579eb95aceb2ad5fc01a814c8a2
148 CREDITS for arc for stats tweak
149 fix link to .zip file in quickstart.rst (thanks to ChosenOne for noticing)
150 English usage tweak
151]
152[docs/running.rst: fix stray HTML (not .rst) link noticed by ChosenOne.
153david-sarah@jacaranda.org**20110609223719
154 Ignore-this: fc50ac9c94792dcac6f1067df8ac0d4a
155]
156[server.py:  get_latencies now reports percentiles _only_ if there are sufficient observations for the interpretation of the percentile to be unambiguous.
157wilcoxjg@gmail.com**20110527120135
158 Ignore-this: 2e7029764bffc60e26f471d7c2b6611e
159 interfaces.py:  modified the return type of RIStatsProvider.get_stats to allow for None as a return value
160 NEWS.rst, stats.py: documentation of change to get_latencies
161 stats.rst: now documents percentile modification in get_latencies
162 test_storage.py:  test_latencies now expects None in output categories that contain too few samples for the associated percentile to be unambiguously reported.
163 fixes #1392
164]
165[docs: revert link in relnotes.txt from NEWS.rst to NEWS, since the former did not exist at revision 5000.
166david-sarah@jacaranda.org**20110517011214
167 Ignore-this: 6a5be6e70241e3ec0575641f64343df7
168]
169[docs: convert NEWS to NEWS.rst and change all references to it.
170david-sarah@jacaranda.org**20110517010255
171 Ignore-this: a820b93ea10577c77e9c8206dbfe770d
172]
173[docs: remove out-of-date docs/testgrid/introducer.furl and containing directory. fixes #1404
174david-sarah@jacaranda.org**20110512140559
175 Ignore-this: 784548fc5367fac5450df1c46890876d
176]
177[scripts/common.py: don't assume that the default alias is always 'tahoe' (it is, but the API of get_alias doesn't say so). refs #1342
178david-sarah@jacaranda.org**20110130164923
179 Ignore-this: a271e77ce81d84bb4c43645b891d92eb
180]
181[setup: don't catch all Exception from check_requirement(), but only PackagingError and ImportError
182zooko@zooko.com**20110128142006
183 Ignore-this: 57d4bc9298b711e4bc9dc832c75295de
184 I noticed this because I had accidentally inserted a bug which caused AssertionError to be raised from check_requirement().
185]
186[M-x whitespace-cleanup
187zooko@zooko.com**20110510193653
188 Ignore-this: dea02f831298c0f65ad096960e7df5c7
189]
190[docs: fix typo in running.rst, thanks to arch_o_median
191zooko@zooko.com**20110510193633
192 Ignore-this: ca06de166a46abbc61140513918e79e8
193]
194[relnotes.txt: don't claim to work on Cygwin (which has been untested for some time). refs #1342
195david-sarah@jacaranda.org**20110204204902
196 Ignore-this: 85ef118a48453d93fa4cddc32d65b25b
197]
198[relnotes.txt: forseeable -> foreseeable. refs #1342
199david-sarah@jacaranda.org**20110204204116
200 Ignore-this: 746debc4d82f4031ebf75ab4031b3a9
201]
202[replace remaining .html docs with .rst docs
203zooko@zooko.com**20110510191650
204 Ignore-this: d557d960a986d4ac8216d1677d236399
205 Remove install.html (long since deprecated).
206 Also replace some obsolete references to install.html with references to quickstart.rst.
207 Fix some broken internal references within docs/historical/historical_known_issues.txt.
208 Thanks to Ravi Pinjala and Patrick McDonald.
209 refs #1227
210]
211[docs: FTP-and-SFTP.rst: fix a minor error and update the information about which version of Twisted fixes #1297
212zooko@zooko.com**20110428055232
213 Ignore-this: b63cfb4ebdbe32fb3b5f885255db4d39
214]
215[munin tahoe_files plugin: fix incorrect file count
216francois@ctrlaltdel.ch**20110428055312
217 Ignore-this: 334ba49a0bbd93b4a7b06a25697aba34
218 fixes #1391
219]
220[corrected "k must never be smaller than N" to "k must never be greater than N"
221secorp@allmydata.org**20110425010308
222 Ignore-this: 233129505d6c70860087f22541805eac
223]
224[Fix a test failure in test_package_initialization on Python 2.4.x due to exceptions being stringified differently than in later versions of Python. refs #1389
225david-sarah@jacaranda.org**20110411190738
226 Ignore-this: 7847d26bc117c328c679f08a7baee519
227]
228[tests: add test for including the ImportError message and traceback entry in the summary of errors from importing dependencies. refs #1389
229david-sarah@jacaranda.org**20110410155844
230 Ignore-this: fbecdbeb0d06a0f875fe8d4030aabafa
231]
232[allmydata/__init__.py: preserve the message and last traceback entry (file, line number, function, and source line) of ImportErrors in the package versions string. fixes #1389
233david-sarah@jacaranda.org**20110410155705
234 Ignore-this: 2f87b8b327906cf8bfca9440a0904900
235]
236[remove unused variable detected by pyflakes
237zooko@zooko.com**20110407172231
238 Ignore-this: 7344652d5e0720af822070d91f03daf9
239]
240[allmydata/__init__.py: Nicer reporting of unparseable version numbers in dependencies. fixes #1388
241david-sarah@jacaranda.org**20110401202750
242 Ignore-this: 9c6bd599259d2405e1caadbb3e0d8c7f
243]
244[update FTP-and-SFTP.rst: the necessary patch is included in Twisted-10.1
245Brian Warner <warner@lothar.com>**20110325232511
246 Ignore-this: d5307faa6900f143193bfbe14e0f01a
247]
248[control.py: remove all uses of s.get_serverid()
249warner@lothar.com**20110227011203
250 Ignore-this: f80a787953bd7fa3d40e828bde00e855
251]
252[web: remove some uses of s.get_serverid(), not all
253warner@lothar.com**20110227011159
254 Ignore-this: a9347d9cf6436537a47edc6efde9f8be
255]
256[immutable/downloader/fetcher.py: remove all get_serverid() calls
257warner@lothar.com**20110227011156
258 Ignore-this: fb5ef018ade1749348b546ec24f7f09a
259]
260[immutable/downloader/fetcher.py: fix diversity bug in server-response handling
261warner@lothar.com**20110227011153
262 Ignore-this: bcd62232c9159371ae8a16ff63d22c1b
263 
264 When blocks terminate (either COMPLETE or CORRUPT/DEAD/BADSEGNUM), the
265 _shares_from_server dict was being popped incorrectly (using shnum as the
266 index instead of serverid). I'm still thinking through the consequences of
267 this bug. It was probably benign and really hard to detect. I think it would
268 cause us to incorrectly believe that we're pulling too many shares from a
269 server, and thus prefer a different server rather than asking for a second
270 share from the first server. The diversity code is intended to spread out the
271 number of shares simultaneously being requested from each server, but with
272 this bug, it might be spreading out the total number of shares requested at
273 all, not just simultaneously. (note that SegmentFetcher is scoped to a single
274 segment, so the effect doesn't last very long).
275]
276[immutable/downloader/share.py: reduce get_serverid(), one left, update ext deps
277warner@lothar.com**20110227011150
278 Ignore-this: d8d56dd8e7b280792b40105e13664554
279 
280 test_download.py: create+check MyShare instances better, make sure they share
281 Server objects, now that finder.py cares
282]
283[immutable/downloader/finder.py: reduce use of get_serverid(), one left
284warner@lothar.com**20110227011146
285 Ignore-this: 5785be173b491ae8a78faf5142892020
286]
287[immutable/offloaded.py: reduce use of get_serverid() a bit more
288warner@lothar.com**20110227011142
289 Ignore-this: b48acc1b2ae1b311da7f3ba4ffba38f
290]
291[immutable/upload.py: reduce use of get_serverid()
292warner@lothar.com**20110227011138
293 Ignore-this: ffdd7ff32bca890782119a6e9f1495f6
294]
295[immutable/checker.py: remove some uses of s.get_serverid(), not all
296warner@lothar.com**20110227011134
297 Ignore-this: e480a37efa9e94e8016d826c492f626e
298]
299[add remaining get_* methods to storage_client.Server, NoNetworkServer, and
300warner@lothar.com**20110227011132
301 Ignore-this: 6078279ddf42b179996a4b53bee8c421
302 MockIServer stubs
303]
304[upload.py: rearrange _make_trackers a bit, no behavior changes
305warner@lothar.com**20110227011128
306 Ignore-this: 296d4819e2af452b107177aef6ebb40f
307]
308[happinessutil.py: finally rename merge_peers to merge_servers
309warner@lothar.com**20110227011124
310 Ignore-this: c8cd381fea1dd888899cb71e4f86de6e
311]
312[test_upload.py: factor out FakeServerTracker
313warner@lothar.com**20110227011120
314 Ignore-this: 6c182cba90e908221099472cc159325b
315]
316[test_upload.py: server-vs-tracker cleanup
317warner@lothar.com**20110227011115
318 Ignore-this: 2915133be1a3ba456e8603885437e03
319]
320[happinessutil.py: server-vs-tracker cleanup
321warner@lothar.com**20110227011111
322 Ignore-this: b856c84033562d7d718cae7cb01085a9
323]
324[upload.py: more tracker-vs-server cleanup
325warner@lothar.com**20110227011107
326 Ignore-this: bb75ed2afef55e47c085b35def2de315
327]
328[upload.py: fix var names to avoid confusion between 'trackers' and 'servers'
329warner@lothar.com**20110227011103
330 Ignore-this: 5d5e3415b7d2732d92f42413c25d205d
331]
332[refactor: s/peer/server/ in immutable/upload, happinessutil.py, test_upload
333warner@lothar.com**20110227011100
334 Ignore-this: 7ea858755cbe5896ac212a925840fe68
335 
336 No behavioral changes, just updating variable/method names and log messages.
337 The effects outside these three files should be minimal: some exception
338 messages changed (to say "server" instead of "peer"), and some internal class
339 names were changed. A few things still use "peer" to minimize external
340 changes, like UploadResults.timings["peer_selection"] and
341 happinessutil.merge_peers, which can be changed later.
342]
343[storage_client.py: clean up test_add_server/test_add_descriptor, remove .test_servers
344warner@lothar.com**20110227011056
345 Ignore-this: efad933e78179d3d5fdcd6d1ef2b19cc
346]
347[test_client.py, upload.py:: remove KiB/MiB/etc constants, and other dead code
348warner@lothar.com**20110227011051
349 Ignore-this: dc83c5794c2afc4f81e592f689c0dc2d
350]
351[test: increase timeout on a network test because Francois's ARM machine hit that timeout
352zooko@zooko.com**20110317165909
353 Ignore-this: 380c345cdcbd196268ca5b65664ac85b
354 I'm skeptical that the test was proceeding correctly but ran out of time. It seems more likely that it had gotten hung. But if we raise the timeout to an even more extravagant number then we can be even more certain that the test was never going to finish.
355]
356[docs/configuration.rst: add a "Frontend Configuration" section
357Brian Warner <warner@lothar.com>**20110222014323
358 Ignore-this: 657018aa501fe4f0efef9851628444ca
359 
360 this points to docs/frontends/*.rst, which were previously underlinked
361]
362[web/filenode.py: avoid calling req.finish() on closed HTTP connections. Closes #1366
363"Brian Warner <warner@lothar.com>"**20110221061544
364 Ignore-this: 799d4de19933f2309b3c0c19a63bb888
365]
366[Add unit tests for cross_check_pkg_resources_versus_import, and a regression test for ref #1355. This requires a little refactoring to make it testable.
367david-sarah@jacaranda.org**20110221015817
368 Ignore-this: 51d181698f8c20d3aca58b057e9c475a
369]
370[allmydata/__init__.py: .name was used in place of the correct .__name__ when printing an exception. Also, robustify string formatting by using %r instead of %s in some places. fixes #1355.
371david-sarah@jacaranda.org**20110221020125
372 Ignore-this: b0744ed58f161bf188e037bad077fc48
373]
374[Refactor StorageFarmBroker handling of servers
375Brian Warner <warner@lothar.com>**20110221015804
376 Ignore-this: 842144ed92f5717699b8f580eab32a51
377 
378 Pass around IServer instance instead of (peerid, rref) tuple. Replace
379 "descriptor" with "server". Other replacements:
380 
381  get_all_servers -> get_connected_servers/get_known_servers
382  get_servers_for_index -> get_servers_for_psi (now returns IServers)
383 
384 This change still needs to be pushed further down: lots of code is now
385 getting the IServer and then distributing (peerid, rref) internally.
386 Instead, it ought to distribute the IServer internally and delay
387 extracting a serverid or rref until the last moment.
388 
389 no_network.py was updated to retain parallelism.
390]
391[TAG allmydata-tahoe-1.8.2
392warner@lothar.com**20110131020101]
393Patch bundle hash:
394ad87c77a799c56f08a49cedfb659ff0efa3ebb77