tahoe-lafs/integration/test_servers_of_happiness.py
meejah 05f48c3601 Various cleanups, fixes and improvements
Squashed all commits that were meejah's between
30d68fb499f300a393fa0ced5980229f4bb6efda
and
33c268ed3a8c63a809f4403e307ecc13d848b1ab
On the branch meejah:1382.markberger-rewrite-rebase.6 as
per review
2017-06-05 16:31:41 -06:00

54 lines
1.4 KiB
Python

import sys
import time
import shutil
from os import mkdir, unlink, listdir
from os.path import join, exists
from twisted.internet import defer, reactor, task
from twisted.internet.error import ProcessTerminated
import util
import pytest
@pytest.inlineCallbacks
def test_upload_immutable(reactor, temp_dir, introducer_furl, flog_gatherer, storage_nodes, request):
# hmm, for some reason this still gets storage enabled ...
process = yield util._create_node(
reactor, request, temp_dir, introducer_furl, flog_gatherer, "edna",
web_port="tcp:9983:interface=localhost",
storage=False,
needed=3,
happy=10,
total=10,
)
node_dir = join(temp_dir, 'edna')
print("waiting 5 seconds unil we're maybe ready")
yield task.deferLater(reactor, 5, lambda: None)
# upload a file, which should fail because we have don't have 7
# storage servers (but happiness is set to 7)
proto = util._CollectOutputProtocol()
transport = reactor.spawnProcess(
proto,
sys.executable,
[
sys.executable, '-m', 'allmydata.scripts.runner',
'-d', node_dir,
'put', __file__,
]
)
try:
yield proto.done
assert False, "should raise exception"
except Exception as e:
assert isinstance(e, ProcessTerminated)
output = proto.output.getvalue()
assert "shares could be placed on only" in output