2017-02-14 23:36:57 +00:00
|
|
|
import sys
|
2017-07-26 15:29:47 +00:00
|
|
|
from os.path import join
|
2017-02-14 23:36:57 +00:00
|
|
|
|
2017-07-26 15:29:47 +00:00
|
|
|
from twisted.internet import task
|
2017-02-14 23:36:57 +00:00
|
|
|
from twisted.internet.error import ProcessTerminated
|
|
|
|
|
|
|
|
import util
|
|
|
|
|
2019-02-05 16:03:35 +00:00
|
|
|
import pytest_twisted
|
2017-02-14 23:36:57 +00:00
|
|
|
|
|
|
|
|
2019-02-05 16:03:35 +00:00
|
|
|
@pytest_twisted.inlineCallbacks
|
2017-02-14 23:36:57 +00:00
|
|
|
def test_upload_immutable(reactor, temp_dir, introducer_furl, flog_gatherer, storage_nodes, request):
|
|
|
|
|
2019-08-09 03:39:53 +00:00
|
|
|
edna = yield util._create_node(
|
2017-02-14 23:36:57 +00:00
|
|
|
reactor, request, temp_dir, introducer_furl, flog_gatherer, "edna",
|
|
|
|
web_port="tcp:9983:interface=localhost",
|
|
|
|
storage=False,
|
|
|
|
needed=3,
|
2017-07-26 15:30:02 +00:00
|
|
|
happy=7,
|
2017-02-14 23:36:57 +00:00
|
|
|
total=10,
|
|
|
|
)
|
2019-08-09 03:39:53 +00:00
|
|
|
util.await_client_ready(edna)
|
2017-02-14 23:36:57 +00:00
|
|
|
|
|
|
|
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()
|
2017-07-26 15:29:47 +00:00
|
|
|
reactor.spawnProcess(
|
2017-02-14 23:36:57 +00:00
|
|
|
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
|