Alter various unit tests to work with the new happy behavior
This commit is contained in:
parent
953c9555ca
commit
d360ee0d2e
|
@ -938,6 +938,9 @@ class ShareManglingMixin(SystemTestMixin):
|
||||||
# We need multiple segments to test crypttext hash trees that are
|
# We need multiple segments to test crypttext hash trees that are
|
||||||
# non-trivial (i.e. they have more than just one hash in them).
|
# non-trivial (i.e. they have more than just one hash in them).
|
||||||
cl0.DEFAULT_ENCODING_PARAMETERS['max_segment_size'] = 12
|
cl0.DEFAULT_ENCODING_PARAMETERS['max_segment_size'] = 12
|
||||||
|
# Tests that need to test servers of happiness using this should
|
||||||
|
# set their own value for happy -- the default (7) breaks stuff.
|
||||||
|
cl0.DEFAULT_ENCODING_PARAMETERS['happy'] = 1
|
||||||
d2 = cl0.upload(immutable.upload.Data(TEST_DATA, convergence=""))
|
d2 = cl0.upload(immutable.upload.Data(TEST_DATA, convergence=""))
|
||||||
def _after_upload(u):
|
def _after_upload(u):
|
||||||
filecap = u.uri
|
filecap = u.uri
|
||||||
|
|
|
@ -280,6 +280,7 @@ class AddLease(GridTestMixin, unittest.TestCase):
|
||||||
self.basedir = "checker/AddLease/875"
|
self.basedir = "checker/AddLease/875"
|
||||||
self.set_up_grid(num_servers=1)
|
self.set_up_grid(num_servers=1)
|
||||||
c0 = self.g.clients[0]
|
c0 = self.g.clients[0]
|
||||||
|
c0.DEFAULT_ENCODING_PARAMETERS['happy'] = 1
|
||||||
self.uris = {}
|
self.uris = {}
|
||||||
DATA = "data" * 100
|
DATA = "data" * 100
|
||||||
d = c0.upload(Data(DATA, convergence=""))
|
d = c0.upload(Data(DATA, convergence=""))
|
||||||
|
|
|
@ -90,6 +90,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
|
||||||
d = self.set_up_nodes()
|
d = self.set_up_nodes()
|
||||||
def _check_connections(res):
|
def _check_connections(res):
|
||||||
for c in self.clients:
|
for c in self.clients:
|
||||||
|
c.DEFAULT_ENCODING_PARAMETERS['happy'] = 5
|
||||||
all_peerids = c.get_storage_broker().get_all_serverids()
|
all_peerids = c.get_storage_broker().get_all_serverids()
|
||||||
self.failUnlessEqual(len(all_peerids), self.numclients)
|
self.failUnlessEqual(len(all_peerids), self.numclients)
|
||||||
sb = c.storage_broker
|
sb = c.storage_broker
|
||||||
|
@ -201,6 +202,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
|
||||||
add_to_sparent=True))
|
add_to_sparent=True))
|
||||||
def _added(extra_node):
|
def _added(extra_node):
|
||||||
self.extra_node = extra_node
|
self.extra_node = extra_node
|
||||||
|
self.extra_node.DEFAULT_ENCODING_PARAMETERS['happy'] = 5
|
||||||
d.addCallback(_added)
|
d.addCallback(_added)
|
||||||
|
|
||||||
HELPER_DATA = "Data that needs help to upload" * 1000
|
HELPER_DATA = "Data that needs help to upload" * 1000
|
||||||
|
@ -700,6 +702,10 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
|
||||||
self.basedir = "system/SystemTest/test_filesystem"
|
self.basedir = "system/SystemTest/test_filesystem"
|
||||||
self.data = LARGE_DATA
|
self.data = LARGE_DATA
|
||||||
d = self.set_up_nodes(use_stats_gatherer=True)
|
d = self.set_up_nodes(use_stats_gatherer=True)
|
||||||
|
def _new_happy_semantics(ign):
|
||||||
|
for c in self.clients:
|
||||||
|
c.DEFAULT_ENCODING_PARAMETERS['happy'] = 1
|
||||||
|
d.addCallback(_new_happy_semantics)
|
||||||
d.addCallback(self._test_introweb)
|
d.addCallback(self._test_introweb)
|
||||||
d.addCallback(self.log, "starting publish")
|
d.addCallback(self.log, "starting publish")
|
||||||
d.addCallback(self._do_publish1)
|
d.addCallback(self._do_publish1)
|
||||||
|
@ -1120,6 +1126,11 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
|
||||||
d.addCallback(self.failUnlessEqual, "new.txt contents")
|
d.addCallback(self.failUnlessEqual, "new.txt contents")
|
||||||
# and again with something large enough to use multiple segments,
|
# and again with something large enough to use multiple segments,
|
||||||
# and hopefully trigger pauseProducing too
|
# and hopefully trigger pauseProducing too
|
||||||
|
def _new_happy_semantics(ign):
|
||||||
|
for c in self.clients:
|
||||||
|
# these get reset somewhere? Whatever.
|
||||||
|
c.DEFAULT_ENCODING_PARAMETERS['happy'] = 1
|
||||||
|
d.addCallback(_new_happy_semantics)
|
||||||
d.addCallback(lambda res: self.PUT(public + "/subdir3/big.txt",
|
d.addCallback(lambda res: self.PUT(public + "/subdir3/big.txt",
|
||||||
"big" * 500000)) # 1.5MB
|
"big" * 500000)) # 1.5MB
|
||||||
d.addCallback(lambda res: self.GET(public + "/subdir3/big.txt"))
|
d.addCallback(lambda res: self.GET(public + "/subdir3/big.txt"))
|
||||||
|
|
|
@ -175,7 +175,7 @@ class FakeBucketWriter:
|
||||||
|
|
||||||
class FakeClient:
|
class FakeClient:
|
||||||
DEFAULT_ENCODING_PARAMETERS = {"k":25,
|
DEFAULT_ENCODING_PARAMETERS = {"k":25,
|
||||||
"happy": 75,
|
"happy": 25,
|
||||||
"n": 100,
|
"n": 100,
|
||||||
"max_segment_size": 1*MiB,
|
"max_segment_size": 1*MiB,
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ class GoodServer(unittest.TestCase, ShouldFailMixin, SetDEPMixin):
|
||||||
data = self.get_data(SIZE_LARGE)
|
data = self.get_data(SIZE_LARGE)
|
||||||
segsize = int(SIZE_LARGE / 2.5)
|
segsize = int(SIZE_LARGE / 2.5)
|
||||||
# we want 3 segments, since that's not a power of two
|
# we want 3 segments, since that's not a power of two
|
||||||
self.set_encoding_parameters(25, 75, 100, segsize)
|
self.set_encoding_parameters(25, 25, 100, segsize)
|
||||||
d = upload_data(self.u, data)
|
d = upload_data(self.u, data)
|
||||||
d.addCallback(extract_uri)
|
d.addCallback(extract_uri)
|
||||||
d.addCallback(self._check_large, SIZE_LARGE)
|
d.addCallback(self._check_large, SIZE_LARGE)
|
||||||
|
@ -392,6 +392,7 @@ class ServerErrors(unittest.TestCase, ShouldFailMixin, SetDEPMixin):
|
||||||
def test_first_error(self):
|
def test_first_error(self):
|
||||||
mode = dict([(0,"good")] + [(i,"first-fail") for i in range(1,10)])
|
mode = dict([(0,"good")] + [(i,"first-fail") for i in range(1,10)])
|
||||||
self.make_node(mode)
|
self.make_node(mode)
|
||||||
|
self.set_encoding_parameters(k=25, happy=1, n=50)
|
||||||
d = upload_data(self.u, DATA)
|
d = upload_data(self.u, DATA)
|
||||||
d.addCallback(extract_uri)
|
d.addCallback(extract_uri)
|
||||||
d.addCallback(self._check_large, SIZE_LARGE)
|
d.addCallback(self._check_large, SIZE_LARGE)
|
||||||
|
@ -509,7 +510,8 @@ class PeerSelection(unittest.TestCase):
|
||||||
|
|
||||||
self.make_client()
|
self.make_client()
|
||||||
data = self.get_data(SIZE_LARGE)
|
data = self.get_data(SIZE_LARGE)
|
||||||
self.set_encoding_parameters(50, 75, 100)
|
# if there are 50 peers, then happy needs to be <= 50
|
||||||
|
self.set_encoding_parameters(50, 50, 100)
|
||||||
d = upload_data(self.u, data)
|
d = upload_data(self.u, data)
|
||||||
d.addCallback(extract_uri)
|
d.addCallback(extract_uri)
|
||||||
d.addCallback(self._check_large, SIZE_LARGE)
|
d.addCallback(self._check_large, SIZE_LARGE)
|
||||||
|
@ -555,7 +557,9 @@ class PeerSelection(unittest.TestCase):
|
||||||
|
|
||||||
self.make_client()
|
self.make_client()
|
||||||
data = self.get_data(SIZE_LARGE)
|
data = self.get_data(SIZE_LARGE)
|
||||||
self.set_encoding_parameters(100, 150, 200)
|
# if there are 50 peers, then happy should be no more than 50 if
|
||||||
|
# we want this to work.
|
||||||
|
self.set_encoding_parameters(100, 50, 200)
|
||||||
d = upload_data(self.u, data)
|
d = upload_data(self.u, data)
|
||||||
d.addCallback(extract_uri)
|
d.addCallback(extract_uri)
|
||||||
d.addCallback(self._check_large, SIZE_LARGE)
|
d.addCallback(self._check_large, SIZE_LARGE)
|
||||||
|
@ -573,7 +577,7 @@ class PeerSelection(unittest.TestCase):
|
||||||
|
|
||||||
self.make_client(3)
|
self.make_client(3)
|
||||||
data = self.get_data(SIZE_LARGE)
|
data = self.get_data(SIZE_LARGE)
|
||||||
self.set_encoding_parameters(3, 5, 10)
|
self.set_encoding_parameters(3, 3, 10)
|
||||||
d = upload_data(self.u, data)
|
d = upload_data(self.u, data)
|
||||||
d.addCallback(extract_uri)
|
d.addCallback(extract_uri)
|
||||||
d.addCallback(self._check_large, SIZE_LARGE)
|
d.addCallback(self._check_large, SIZE_LARGE)
|
||||||
|
|
|
@ -4074,6 +4074,7 @@ class Grid(GridTestMixin, WebErrorMixin, unittest.TestCase, ShouldFailMixin):
|
||||||
self.basedir = "web/Grid/exceptions"
|
self.basedir = "web/Grid/exceptions"
|
||||||
self.set_up_grid(num_clients=1, num_servers=2)
|
self.set_up_grid(num_clients=1, num_servers=2)
|
||||||
c0 = self.g.clients[0]
|
c0 = self.g.clients[0]
|
||||||
|
c0.DEFAULT_ENCODING_PARAMETERS['happy'] = 2
|
||||||
self.fileurls = {}
|
self.fileurls = {}
|
||||||
DATA = "data" * 100
|
DATA = "data" * 100
|
||||||
d = c0.create_dirnode()
|
d = c0.create_dirnode()
|
||||||
|
|
Loading…
Reference in New Issue