Commit Graph

46 Commits

Author SHA1 Message Date
heartsucker
df9243a3f4
updated test code to use print function over print statement 2019-03-22 17:32:36 +01:00
David Stainton
19c5bbb43b Fix test test_lost_servers
Remove old hypothesis tests

Fix allmydata.test.cli.test_cli.Errors.test_get

this was broken due to differing share placements
whereas we need to allow this.

Fix test_5_overdue_immutable

This change makes the test not depend on the value
of PYTHONHASHSEED.

Revert "Fix test_5_overdue_immutable"

This reverts commit 5f3696d9a53e7df8781a2c463c7112282397cd69.

fix test to actually hang the first 5 *servers*

sort keys for stable output

use file-context-managers

remove probably-unneeded assert (that fails sometimes)

another non-deterministic test?
2017-06-05 16:26:46 -06:00
Mark Berger
17cff7a176 Implements 'Servers of Happiness' algorithm for upload
This is Mark Berger's original commits, from ticket #1382
2017-06-05 16:26:46 -06:00
Daira Hopwood
77767e9e12 Remove ugly shadowing of Client.DEFAULT_ENCODING_PARAMETERS. fixes #1847
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2014-04-21 22:41:23 +01:00
Zooko O'Whielacronx
73d5a059bd tests: add more diagnostics when code-under-test fails
This prints out which things are different when two sets are expected to be the
same. This was useful to me when debugging the code under test. Hm, this
pattern might be more generally useful...
2012-11-29 14:11:47 -07:00
Brian Warner
da9ac55294 CheckResults.get_servers_responding() now returns IServers
Remove temporary get_new_servers_responding().
2012-06-02 11:39:12 -07:00
Brian Warner
8daacbcf69 CheckResults: replace get_data() with as_dict(), use getters in web status 2012-06-02 11:39:10 -07:00
Brian Warner
4867dca3f0 use the new CheckResult getters almost everywhere
The remaining get_data() calls are either in
web.check_results.json_check_results(), or functioning as repr()s in
various unit test failure cases.
2012-06-02 11:39:10 -07:00
Brian Warner
e313cf6406 CheckResults: start hiding .data, first step to clean it up
The goal is to make CheckResults more strongly typed, and remove the
ambiguous ".data" field in favor of a bunch of specific counters and
sharelists, so I can changes .sharemap and .servermap to use IServer
instances instead of string serverids. By cleaning this up first, I hope
to get that task done with less debugging.
2012-06-02 11:39:09 -07:00
Brian Warner
3d771132a8 switch UploadResults to use get_uri(), hide internal ._uri
Complete the getter-based transformation, by hiding ".uri" and updating
callers to use get_uri(). Also don't set a dummy self._uri, leave it
undefined until someone calls set_uri().
2012-05-21 21:14:44 -07:00
Brian Warner
9acf5beebd immutable repairer: populate servers-responding properly
If a server did not respond to the pre-repair filecheck, but did respond
to the repair, that server was not correctly added to the
RepairResults.data["servers-responding"] list. (This resulted from a
buggy usage of DictOfSets.union() in filenode.py).

In addition, servers to which filecheck queries were sent, but did not
respond, were incorrectly added to the servers-responding list
anyawys. (This resulted from code in the checker.py not paying attention
to the 'responded' flag).

The first bug was neatly masked by the second: it's pretty rare to have
a server suddenly start responding in the one-second window between a
filecheck and a subsequent repair, and if the server was around for the
filecheck, you'd never notice the problem. I only spotted the smelly
code while I was changing it for IServer cleanup purposes.

I added coverage to test_repairer.py for this. Trying to get that test
to fail before fixing the first bug is what led me to discover the
second bug. I also had to update test_corrupt_file_verno, since it was
incorrectly asserting that 10 servers responded, when in fact one of
them throws an error (but the second bug was causing it to be reported
anyways).
2012-05-16 16:55:09 -07:00
david-sarah
9f8d34e63a test_repairer: add a deterministic test of share data corruption that always flips the bits of the last byte of the share data. refs #1395 2011-08-02 10:58:41 -07:00
david-sarah
a817163cc6 docs: convert NEWS to NEWS.rst and change all references to it. 2011-05-16 18:02:55 -07:00
Brian Warner
c18953c169 fix #1223, crash+inefficiency during repair due to read overrun
* repairer (really the uploader) reads beyond end of input file (Uploadable)
* new-downloader does not tolerate overreads
* uploader does lots of tiny reads (inefficient)

This fixes the last two. The uploader still does a single overread at the end
of the input file, but now that's ok so we can leave it in place. The
uploader now expects the Uploadable to behave like a normal disk
file (reading beyond EOF will return less data than was asked for), and now
the new-downloadable behaves that way.
2010-10-29 01:20:36 -07:00
Kevan Carstensen
ec4f87a98c immutable/repairer.py: don't use the default happiness setting when repairing 2010-09-27 13:01:02 -07:00
Brian Warner
63b61ce7bd Rewrite immutable downloader (#798). This patch adds and updates unit tests. 2010-08-04 00:27:10 -07:00
Zooko O'Whielacronx
1dbfcf753d immutable: extend the tests to check that the shares that got uploaded really do make a sufficiently Happy distribution
This patch also renames some instances of "find_shares()" to "find_all_shares()" and other instances to "find_uri_shares()" as appropriate -- the conflation between those names confused me at first when writing these tests.
2010-07-18 21:50:47 -07:00
david-sarah
e76092e16c Change relative imports to absolute 2010-02-26 01:14:33 -07:00
david-sarah
973f0afdd3 Change direct accesses to an_uri.storage_index to calls to .get_storage_index() (fixes #948) 2010-02-21 18:45:04 -08:00
Brian Warner
1ed5bbdcb6 test_repairer: add (commented-out) test_each_byte, to see exactly what the
Verifier misses

The results (described in #819) match our expectations: it misses corruption
in unused share fields and in most container fields (which are only visible
to the storage server, not the client). 1265 bytes of a 2753 byte
share (hosting a 56-byte file with an artifically small segment size) are
unused, mostly in the unused tail of the overallocated UEB space (765 bytes),
and the allocated-but-unwritten plaintext_hash_tree (480 bytes).
2010-01-10 12:35:52 -08:00
Zooko O'Whielacronx
e7a9c000bf repairer: fix some wrong offsets in the randomized verifier tests, debugged by Brian
fixes #819
2010-01-10 12:37:21 -08:00
Brian Warner
1ff49a15bb test_repairer: fix colliding basedir names, which caused test inconsistencies 2010-01-10 00:46:19 -08:00
Zooko O'Whielacronx
876c4a153b repairer: add deterministic test for #819, mark as TODO 2010-01-09 17:36:19 -08:00
Brian Warner
96834da0a2 Simplify immutable download API: use just filenode.read(consumer, offset, size)
* remove Downloader.download_to_data/download_to_filename/download_to_filehandle
* remove download.Data/FileName/FileHandle targets
* remove filenode.download/download_to_data/download_to_filename methods
* leave Downloader.download (the whole Downloader will go away eventually)
* add util.consumer.MemoryConsumer/download_to_data, for convenience
  (this is mostly used by unit tests, but it gets used by enough non-test
   code to warrant putting it in allmydata.util)
* update tests
* removes about 180 lines of code. Yay negative code days!

Overall plan is to rewrite immutable/download.py and leave filenode.read() as
the sole read-side API.
2009-12-01 17:53:30 -05:00
Zooko O'Whielacronx
1be4d45779 tests: bump up the timeout on test_repairer to see if 120 seconds was too short for François's ARM box to do the test even when it was doing it right. 2009-10-27 13:48:00 -08:00
Brian Warner
f4aa418086 Verifier: check the full cryptext-hash tree on each share. Removed .todos
from the last few test_repairer tests that were waiting on this.
2009-10-05 15:18:49 -07:00
Brian Warner
504c767d03 Verifier: check the full block-hash-tree on each share
Removed the .todo from two test_repairer tests that check this. The only
remaining .todos are on the three crypttext-hash-tree tests.
2009-10-05 14:48:44 -07:00
Brian Warner
e8f56af5a7 Verifier: check the full share-hash chain on each share
Removed the .todo from two test_repairer tests that check this.
2009-10-05 14:34:43 -07:00
Brian Warner
bbd00de495 test_repairer: rename Verifier test cases to be more precise and less verbose 2009-10-05 13:11:15 -07:00
Brian Warner
7cfbb9c832 test_repairer: change to use faster no_network.GridTestMixin, split Verifier tests into separate cases, refactor judgement funcs into shared methods 2009-02-23 22:15:06 -07:00
Brian Warner
2be729b1e4 test_repairer: change Repairer to use much-faster no_network.GridTestMixin. As a side-effect, fix what I think was a bug: some of the assert-minimal-effort-expended checks were mixing write counts and allocate counts 2009-02-23 17:42:27 -07:00
Brian Warner
812f23585d test_repairer: hush pyflakes 2009-02-15 16:23:10 -07:00
Zooko O'Whielacronx
2d45d192d1 immutable repairer: add tests of how it handles short reads 2009-02-12 16:48:53 -07:00
Zooko O'Whielacronx
76d7cc4404 immutable repairer: errback any pending readers of DownUpConnectorwhen it runs out of bytes, and test that fact 2009-02-11 20:11:29 -07:00
Brian Warner
5f288842d5 test_repairer: disable repair-from-corruption tests until other things are improved well enough to make it useful 2009-02-11 15:01:59 -07:00
Zooko O'Whielacronx
ef1bfdd2bf immutable: repairer: add a simple test to exercise the "leftover" code path, fix the bug (and rename the variable "leftover" to "extra") 2009-02-10 12:12:45 -07:00
Zooko O'Whielacronx
75e4e67ed7 immutable: tighten preconditions -- you can write empty strings or read zero bytes, and add the first simple unit test of DownUpConnector 2009-02-10 00:56:47 -07:00
Zooko O'Whielacronx
d436c6235d immutable: tests: the real WRITE_LEEWAY is 35 (it was a mistake to move it from 10 to 35 earlier -- I had seen a failure in which it took 35 times as many writes as I thought were optimal, but I misread and thought it took only 20 times as many) 2009-02-09 23:53:48 -07:00
Zooko O'Whielacronx
65c12b24b8 immutable: tests: sigh, raise, again the limit of how many extra writes you can do and still pass this test
Obviously requiring the code under test to perform within some limit isn't very meaningful if we raise the limit whenever the test goes outside of it.
But I still don't want to remove the test code which measures how many writes (and, elsewhere, how many reads) a client does in order to fulfill these duties.
Let this number -- now 20 -- stand as an approximation of the inefficiency of our code divided by my mental model of how many operations are actually optimal for these duties.
2009-02-09 20:09:31 -07:00
Zooko O'Whielacronx
5738d94ccd immutable: tests: assert that verifier gives a clean bill of health after corruption and repair (the previous patch mistakenly did this only after deletion and repair), and also test whether deleting seven other shares and then downloading works. Also count the number of shares stored in the local filesystem. 2009-02-09 20:08:41 -07:00
Zooko O'Whielacronx
bbf48f4a88 immutable: test: add a test after attempting to repair from corruption: does a full verify run give the file a clean bill of health? If not, the you haven't successfully repaired it.
This will make the repairer tests more consistent -- less accidentally passing due to getting lucky.
2009-02-09 19:01:49 -07:00
Zooko O'Whielacronx
4091f73f34 immutable: tests: put shares back to their pristine condition in between each test of corrupting-and-repairing them
This is important, because if the repairer doesn't completely repair all kinds of corruption (as the current one doesn't), then the successive tests get messed up by assuming that the shares were uncorrupted when the test first set about to corrupt them.
2009-02-09 18:29:56 -07:00
Brian Warner
213ef3d64b test_repairer: wrap comments to 80cols, my laptop does not have a wide screen. No functional changes. 2009-02-07 14:06:26 -07:00
Brian Warner
8f2ec16b2c test_repairer.py: hush pyflakes: remove duplicate/shadowed function name, by using the earlier definition (which is identical) 2009-01-12 15:45:09 -07:00
Brian Warner
fe362c0021 hush pyflakes by removing unused imports 2009-01-12 15:41:20 -07:00
Zooko O'Whielacronx
25063688b4 immutable repairer
This implements an immutable repairer by marrying a CiphertextDownloader to a CHKUploader.  It extends the IDownloadTarget interface so that the downloader can provide some metadata that the uploader requires.
The processing is incremental -- it uploads the first segments before it finishes downloading the whole file.  This is necessary so that you can repair large files without running out of RAM or using a temporary file on the repairer.
It requires only a verifycap, not a readcap.  That is: it doesn't need or use the decryption key, only the integrity check codes.
There are several tests marked TODO and several instances of XXX in the source code.  I intend to open tickets to document further improvements to functionality and testing, but the current version is probably good enough for Tahoe-1.3.0.
2009-01-12 11:00:22 -07:00