From a0dc26ee11ac176575f3c84f540f6ef56e3ca4ee Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 17 Apr 2007 12:57:55 -0700 Subject: [PATCH] test_encode.Roundtrip: cover more combinations of data size relative to segment size and number of block hash tree leaves --- src/allmydata/test/test_encode.py | 34 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/allmydata/test/test_encode.py b/src/allmydata/test/test_encode.py index 2bace227..af6d4c11 100644 --- a/src/allmydata/test/test_encode.py +++ b/src/allmydata/test/test_encode.py @@ -209,17 +209,17 @@ class Encode(unittest.TestCase): return self.do_encode(25, 101, 100, 5, 15, 8) class Roundtrip(unittest.TestCase): - def send_and_recover(self, NUM_SHARES, + def send_and_recover(self, NUM_SHARES=100, AVAILABLE_SHARES=None, - DATA_LENGTH=76, + datalen=76, + max_segment_size=25, bucket_modes={}): if AVAILABLE_SHARES is None: AVAILABLE_SHARES = NUM_SHARES - options = {"max_segment_size": 25} # force use of multiple segments + data = make_data(datalen) + # force use of multiple segments + options = {"max_segment_size": max_segment_size} e = encode.Encoder(options) - data = "happy happy joy joy" * 10 - assert DATA_LENGTH <= len(data) - data = data[:DATA_LENGTH] e.setup(StringIO(data)) assert e.num_shares == NUM_SHARES # else we'll be completely confused @@ -273,8 +273,26 @@ class Roundtrip(unittest.TestCase): def test_one_share_per_peer(self): return self.send_and_recover(100) - def test_multiple_of_segsize(self): - return self.send_and_recover(100, DATA_LENGTH=75) + def test_74(self): + return self.send_and_recover(datalen=74) + def test_75(self): + return self.send_and_recover(datalen=75) + def test_51(self): + return self.send_and_recover(datalen=51) + + def test_99(self): + return self.send_and_recover(datalen=99) + def test_100(self): + return self.send_and_recover(datalen=100) + def test_76(self): + return self.send_and_recover(datalen=76) + + def test_124(self): + return self.send_and_recover(datalen=124) + def test_125(self): + return self.send_and_recover(datalen=125) + def test_101(self): + return self.send_and_recover(datalen=101) def test_bad_blocks(self): # the first 74 servers have bad blocks, which will be caught by the -- 2.45.2