mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-30 17:56:58 +00:00
52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
"""
|
|
Ported to Python 3.
|
|
"""
|
|
|
|
import sys
|
|
from os.path import join
|
|
from os import environ
|
|
|
|
from twisted.internet.error import ProcessTerminated
|
|
|
|
from . import util
|
|
|
|
import pytest_twisted
|
|
|
|
|
|
@pytest_twisted.inlineCallbacks
|
|
def test_upload_immutable(reactor, temp_dir, introducer_furl, flog_gatherer, storage_nodes, request):
|
|
|
|
edna = yield util._create_node(
|
|
reactor, request, temp_dir, introducer_furl, flog_gatherer, "edna",
|
|
web_port="tcp:9983:interface=localhost",
|
|
storage=False,
|
|
needed=3,
|
|
happy=7,
|
|
total=10,
|
|
)
|
|
yield util.await_client_ready(edna)
|
|
|
|
node_dir = join(temp_dir, 'edna')
|
|
|
|
# upload a file, which should fail because we have don't have 7
|
|
# storage servers (but happiness is set to 7)
|
|
proto = util._CollectOutputProtocol()
|
|
reactor.spawnProcess(
|
|
proto,
|
|
sys.executable,
|
|
[
|
|
sys.executable, '-b', '-m', 'allmydata.scripts.runner',
|
|
'-d', node_dir,
|
|
'put', __file__,
|
|
],
|
|
env=environ,
|
|
)
|
|
try:
|
|
yield proto.done
|
|
assert False, "should raise exception"
|
|
except Exception as e:
|
|
assert isinstance(e, ProcessTerminated)
|
|
|
|
output = proto.output.getvalue()
|
|
assert b"shares could be placed on only" in output
|