mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
tests: use oneshare=True on more test cases
This saves more time (as measured on my laptop): * test_sftp: 17.7s -> 13s * test_dirnode: 26.5s -> 20s * test_ftp, test_configutil, test_web show negligible speedups As before, some tests care about the number of shares, generally ones which delete or corrupt shares and then expect to see the errors get noticed or fixed. Those tests continue to use k=3/N=10.
This commit is contained in:
parent
22d032ef2e
commit
6dd58ceb2a
@ -11,7 +11,7 @@ class ConfigUtilTests(CLITestMixin, GridTestMixin, unittest.TestCase):
|
||||
|
||||
def test_config_utils(self):
|
||||
self.basedir = "cli/ConfigUtilTests/test-config-utils"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
tahoe_cfg = os.path.join(self.get_clientdir(i=0), "tahoe.cfg")
|
||||
|
||||
# test that at least one option was read correctly
|
||||
|
@ -732,22 +732,22 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_basic(self):
|
||||
self.basedir = "dirnode/Dirnode/test_basic"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_basic_test()
|
||||
|
||||
def test_basic_mdmf(self):
|
||||
self.basedir = "dirnode/Dirnode/test_basic_mdmf"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_basic_test(mdmf=True)
|
||||
|
||||
def test_initial_children(self):
|
||||
self.basedir = "dirnode/Dirnode/test_initial_children"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_initial_children_test()
|
||||
|
||||
def test_immutable(self):
|
||||
self.basedir = "dirnode/Dirnode/test_immutable"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c = self.g.clients[0]
|
||||
nm = c.nodemaker
|
||||
|
||||
@ -941,7 +941,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_directory_representation(self):
|
||||
self.basedir = "dirnode/Dirnode/test_directory_representation"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c = self.g.clients[0]
|
||||
nm = c.nodemaker
|
||||
|
||||
@ -1038,7 +1038,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_check(self):
|
||||
self.basedir = "dirnode/Dirnode/test_check"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c = self.g.clients[0]
|
||||
d = c.create_dirnode()
|
||||
d.addCallback(lambda dn: dn.check(Monitor()))
|
||||
@ -1079,7 +1079,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_deepcheck(self):
|
||||
self.basedir = "dirnode/Dirnode/test_deepcheck"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
d = self._test_deepcheck_create()
|
||||
d.addCallback(lambda rootnode: rootnode.start_deep_check().when_done())
|
||||
def _check_results(r):
|
||||
@ -1099,7 +1099,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_deepcheck_cachemisses(self):
|
||||
self.basedir = "dirnode/Dirnode/test_mdmf_cachemisses"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
d = self._test_deepcheck_create()
|
||||
# Clear the counters and set the rootnode
|
||||
d.addCallback(lambda rootnode:
|
||||
@ -1116,7 +1116,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_deepcheck_mdmf(self):
|
||||
self.basedir = "dirnode/Dirnode/test_deepcheck_mdmf"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
d = self._test_deepcheck_create(MDMF_VERSION)
|
||||
d.addCallback(lambda rootnode: rootnode.start_deep_check().when_done())
|
||||
def _check_results(r):
|
||||
@ -1136,7 +1136,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_deepcheck_and_repair(self):
|
||||
self.basedir = "dirnode/Dirnode/test_deepcheck_and_repair"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
d = self._test_deepcheck_create()
|
||||
d.addCallback(lambda rootnode:
|
||||
rootnode.start_deep_check_and_repair().when_done())
|
||||
@ -1165,7 +1165,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_deepcheck_and_repair_mdmf(self):
|
||||
self.basedir = "dirnode/Dirnode/test_deepcheck_and_repair_mdmf"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
d = self._test_deepcheck_create(version=MDMF_VERSION)
|
||||
d.addCallback(lambda rootnode:
|
||||
rootnode.start_deep_check_and_repair().when_done())
|
||||
@ -1286,12 +1286,12 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_readonly(self):
|
||||
self.basedir = "dirnode/Dirnode/test_readonly"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_readonly_test()
|
||||
|
||||
def test_readonly_mdmf(self):
|
||||
self.basedir = "dirnode/Dirnode/test_readonly_mdmf"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_readonly_test(version=MDMF_VERSION)
|
||||
|
||||
def failUnlessGreaterThan(self, a, b):
|
||||
@ -1302,7 +1302,7 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_create(self):
|
||||
self.basedir = "dirnode/Dirnode/test_create"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_create_test()
|
||||
|
||||
def test_update_metadata(self):
|
||||
@ -1355,22 +1355,22 @@ class Dirnode(GridTestMixin, unittest.TestCase,
|
||||
|
||||
def test_create_subdirectory(self):
|
||||
self.basedir = "dirnode/Dirnode/test_create_subdirectory"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_create_subdirectory_test()
|
||||
|
||||
def test_create_subdirectory_mdmf(self):
|
||||
self.basedir = "dirnode/Dirnode/test_create_subdirectory_mdmf"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_create_subdirectory_test(version=MDMF_VERSION)
|
||||
|
||||
def test_create_mdmf(self):
|
||||
self.basedir = "dirnode/Dirnode/test_mdmf"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_create_test(mdmf=True)
|
||||
|
||||
def test_mdmf_initial_children(self):
|
||||
self.basedir = "dirnode/Dirnode/test_mdmf"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
return self._do_initial_children_test(mdmf=True)
|
||||
|
||||
class MinimalFakeMutableFile:
|
||||
@ -1828,7 +1828,7 @@ class Deleter(GridTestMixin, testutil.ReallyEqualMixin, unittest.TestCase):
|
||||
# succeed.
|
||||
|
||||
self.basedir = self.mktemp()
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c0 = self.g.clients[0]
|
||||
d = c0.create_dirnode()
|
||||
small = upload.Data("Small enough for a LIT", None)
|
||||
@ -1862,7 +1862,7 @@ class Adder(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin):
|
||||
# of dn.add_file, and use a special NodeMaker that creates fake
|
||||
# mutable files.
|
||||
self.basedir = "dirnode/Adder/test_overwrite"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c = self.g.clients[0]
|
||||
fileuri = make_chk_file_uri(1234)
|
||||
filenode = c.nodemaker.create_from_cap(fileuri)
|
||||
|
@ -18,7 +18,8 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
|
||||
|
||||
def _set_up(self, basedir, num_clients=1, num_servers=10):
|
||||
self.basedir = "ftp/" + basedir
|
||||
self.set_up_grid(num_clients=num_clients, num_servers=num_servers)
|
||||
self.set_up_grid(num_clients=num_clients, num_servers=num_servers,
|
||||
oneshare=True)
|
||||
|
||||
self.client = self.g.clients[0]
|
||||
self.username = "alice"
|
||||
|
@ -62,7 +62,8 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
|
||||
def _set_up(self, basedir, num_clients=1, num_servers=10):
|
||||
self.basedir = "sftp/" + basedir
|
||||
self.set_up_grid(num_clients=num_clients, num_servers=num_servers)
|
||||
self.set_up_grid(num_clients=num_clients, num_servers=num_servers,
|
||||
oneshare=True)
|
||||
|
||||
self.client = self.g.clients[0]
|
||||
self.username = "alice"
|
||||
|
@ -4842,7 +4842,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
|
||||
if immutable:
|
||||
self.basedir = "web/Grid/unknown-immutable"
|
||||
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c0 = self.g.clients[0]
|
||||
self.uris = {}
|
||||
self.fileurls = {}
|
||||
@ -4975,7 +4975,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
|
||||
def test_mutant_dirnodes_are_omitted(self):
|
||||
self.basedir = "web/Grid/mutant_dirnodes_are_omitted"
|
||||
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c = self.g.clients[0]
|
||||
nm = c.nodemaker
|
||||
self.uris = {}
|
||||
@ -5395,7 +5395,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
|
||||
|
||||
def test_add_lease(self):
|
||||
self.basedir = "web/Grid/add_lease"
|
||||
self.set_up_grid(num_clients=2)
|
||||
self.set_up_grid(num_clients=2, oneshare=True)
|
||||
c0 = self.g.clients[0]
|
||||
self.uris = {}
|
||||
DATA = "data" * 100
|
||||
@ -5488,7 +5488,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
|
||||
|
||||
def test_deep_add_lease(self):
|
||||
self.basedir = "web/Grid/deep_add_lease"
|
||||
self.set_up_grid(num_clients=2)
|
||||
self.set_up_grid(num_clients=2, oneshare=True)
|
||||
c0 = self.g.clients[0]
|
||||
self.uris = {}
|
||||
self.fileurls = {}
|
||||
@ -5775,7 +5775,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi
|
||||
def test_blacklist(self):
|
||||
# download from a blacklisted URI, get an error
|
||||
self.basedir = "web/Grid/blacklist"
|
||||
self.set_up_grid()
|
||||
self.set_up_grid(oneshare=True)
|
||||
c0 = self.g.clients[0]
|
||||
c0_basedir = c0.basedir
|
||||
fn = os.path.join(c0_basedir, "access.blacklist")
|
||||
|
Loading…
Reference in New Issue
Block a user