mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 19:04:21 +00:00
check-memory: add 'receive' mode, for #97 (consumption during share receive
This commit is contained in:
parent
af4d706b18
commit
bede39a156
6
Makefile
6
Makefile
@ -138,8 +138,8 @@ figleaf-output:
|
||||
# after doing test-figleaf and figleaf-output, point your browser at
|
||||
# coverage-html/index.html
|
||||
|
||||
.PHONY: upload-figleaf .figleaf.el pyflakes count-lines check-memory
|
||||
.PHONY: clean
|
||||
.PHONY: upload-figleaf .figleaf.el pyflakes count-lines
|
||||
.PHONY: check-memory check-memory-once clean
|
||||
|
||||
# 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
|
||||
ifdef UPLOAD_TARGET
|
||||
@ -193,7 +193,7 @@ check-memory: .built
|
||||
check-memory-once: .built
|
||||
rm -rf _test_memory
|
||||
$(PP) \
|
||||
$(PYTHON) src/allmydata/test/check_memory.py $(TYPE)
|
||||
$(PYTHON) src/allmydata/test/check_memory.py $(MODE)
|
||||
|
||||
|
||||
test-darcs-boringfile:
|
||||
|
@ -72,10 +72,7 @@ class SystemFramework(testutil.PollMixin):
|
||||
self.proc = None
|
||||
self.tub = foolscap.Tub()
|
||||
self.tub.setServiceParent(self.sparent)
|
||||
self.discard_shares = True
|
||||
self.mode = mode
|
||||
if mode in ("download", "download-GET", "download-GET-slow"):
|
||||
self.discard_shares = False
|
||||
self.failed = False
|
||||
|
||||
def run(self):
|
||||
@ -167,13 +164,25 @@ class SystemFramework(testutil.PollMixin):
|
||||
f = open(os.path.join(nodedir, "vdrive.furl"), "w")
|
||||
f.write(self.vdrive_furl)
|
||||
f.close()
|
||||
if self.discard_shares:
|
||||
# for this test, we tell the storage servers to throw out all
|
||||
# their stored data, since we're only testing upload and not
|
||||
# download.
|
||||
# the only tests for which we want the internal nodes to actually
|
||||
# retain shares are the ones where somebody's going to download
|
||||
# them.
|
||||
if self.mode in ("download", "download-GET", "download-GET-slow"):
|
||||
# retain shares
|
||||
pass
|
||||
else:
|
||||
# for these tests, we tell the storage servers to pretend to
|
||||
# accept shares, but really just throw them out, since we're
|
||||
# only testing upload and not download.
|
||||
f = open(os.path.join(nodedir, "debug_no_storage"), "w")
|
||||
f.write("no_storage\n")
|
||||
f.close()
|
||||
if self.mode in ("receive",):
|
||||
# for this mode, the client-under-test gets all the shares,
|
||||
# so our internal nodes can refuse requests
|
||||
f = open(os.path.join(nodedir, "sizelimit"), "w")
|
||||
f.write("0\n")
|
||||
f.close()
|
||||
c = self.add_service(client.Client(basedir=nodedir))
|
||||
self.nodes.append(c)
|
||||
# the peers will start running, eventually they will connect to each
|
||||
@ -211,18 +220,22 @@ this file are ignored.
|
||||
f.write("tcp:%d:interface=127.0.0.1\n" % webport)
|
||||
f.close()
|
||||
self.webish_url = "http://localhost:%d" % webport
|
||||
if self.discard_shares:
|
||||
f = open(os.path.join(clientdir, "debug_no_storage"), "w")
|
||||
f.write("no_storage\n")
|
||||
if self.mode in ("upload-self", "receive"):
|
||||
# accept and store shares, to trigger the memory consumption bugs
|
||||
pass
|
||||
else:
|
||||
# don't accept any shares
|
||||
f = open(os.path.join(clientdir, "sizelimit"), "w")
|
||||
f.write("0\n")
|
||||
f.close()
|
||||
## also, if we do receive any shares, throw them away
|
||||
#f = open(os.path.join(clientdir, "debug_no_storage"), "w")
|
||||
#f.write("no_storage\n")
|
||||
#f.close()
|
||||
if self.mode == "upload-self":
|
||||
f = open(os.path.join(clientdir, "push_to_ourselves"), "w")
|
||||
f.write("push_to_ourselves\n")
|
||||
f.close()
|
||||
else:
|
||||
f = open(os.path.join(clientdir, "sizelimit"), "w")
|
||||
f.write("0\n")
|
||||
f.close()
|
||||
self.keepalive_file = os.path.join(clientdir,
|
||||
"suicide_prevention_hotline")
|
||||
# now start updating the mtime.
|
||||
@ -349,6 +362,12 @@ this file are ignored.
|
||||
data = "a" * size
|
||||
url = "/vdrive/global"
|
||||
d = self.POST(url, t="upload", file=("%d.data" % size, data))
|
||||
elif self.mode in ("receive",):
|
||||
# upload the data from a local peer, so that the
|
||||
# client-under-test receives and stores the shares
|
||||
files[name] = self.create_data(name, size)
|
||||
u = self.nodes[0].getServiceNamed("uploader")
|
||||
d = u.upload_filename(files[name])
|
||||
elif self.mode in ("download", "download-GET", "download-GET-slow"):
|
||||
# upload the data from a local peer, then have the
|
||||
# client-under-test download it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user