mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-29 17:28:53 +00:00
Try to rewrite test_get_put.py::test_large_file into system-style test.
This commit is contained in:
parent
8431bbff67
commit
a24e6bd7f9
@ -15,11 +15,15 @@ from past.builtins import chr as byteschr, long
|
||||
from six import ensure_text
|
||||
|
||||
import os, re, sys, time, json
|
||||
from subprocess import check_call
|
||||
from pathlib import Path
|
||||
from tempfile import mkdtemp
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from twisted.trial import unittest
|
||||
from twisted.internet import defer
|
||||
from twisted.internet.threads import deferToThread
|
||||
|
||||
from allmydata import uri
|
||||
from allmydata.storage.mutable import MutableShareFile
|
||||
@ -1830,6 +1834,34 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
|
||||
d.addCallback(_got_lit_filenode)
|
||||
return d
|
||||
|
||||
async def test_immutable_upload_download(self):
|
||||
"""
|
||||
A reproducer for issue 3988: upload a large file and then download it.
|
||||
"""
|
||||
DATA = b"abc123 this is not utf-8 decodable \xff\x00\x33 \x11" * 1_000_000
|
||||
await self.set_up_nodes()
|
||||
|
||||
async def run(*args):
|
||||
await deferToThread(check_call, ["tahoe", "--node-directory", self.getdir("client0")] + list(args))
|
||||
|
||||
for c in self.clients:
|
||||
c.encoding_params['k'] = 2
|
||||
c.encoding_params['happy'] = 3
|
||||
c.encoding_params['n'] = 4
|
||||
|
||||
await run("create-alias", "getput")
|
||||
|
||||
tmp_path = Path(mkdtemp())
|
||||
tempfile = tmp_path / "input"
|
||||
|
||||
with tempfile.open("wb") as f:
|
||||
f.write(DATA)
|
||||
await run("put", str(tempfile), "getput:largefile")
|
||||
|
||||
outfile = tmp_path / "out"
|
||||
await run("get", "getput:largefile", str(outfile))
|
||||
self.assertEqual(outfile.read_bytes(), tempfile.read_bytes())
|
||||
|
||||
|
||||
class Connections(SystemTestMixin, unittest.TestCase):
|
||||
FORCE_FOOLSCAP_FOR_STORAGE = True
|
||||
|
Loading…
Reference in New Issue
Block a user