mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 07:06:41 +00:00
Another end-to-end test passing (albeit with ugly implementation).
This commit is contained in:
parent
852162ba06
commit
06029d2878
@ -706,6 +706,12 @@ class StorageClientMutables:
|
|||||||
if response.code == http.OK:
|
if response.code == http.OK:
|
||||||
result = await _decode_cbor(response, _SCHEMAS["mutable_read_test_write"])
|
result = await _decode_cbor(response, _SCHEMAS["mutable_read_test_write"])
|
||||||
return ReadTestWriteResult(success=result["success"], reads=result["data"])
|
return ReadTestWriteResult(success=result["success"], reads=result["data"])
|
||||||
|
elif response.code == http.UNAUTHORIZED:
|
||||||
|
# TODO mabye we can fix this to be nicer at some point? Custom
|
||||||
|
# exception?
|
||||||
|
from foolscap.api import RemoteException
|
||||||
|
|
||||||
|
raise RemoteException("Authorization failed")
|
||||||
else:
|
else:
|
||||||
raise ClientException(response.code, (await response.content()))
|
raise ClientException(response.code, (await response.content()))
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ from .common import si_a2b
|
|||||||
from .immutable import BucketWriter, ConflictingWriteError
|
from .immutable import BucketWriter, ConflictingWriteError
|
||||||
from ..util.hashutil import timing_safe_compare
|
from ..util.hashutil import timing_safe_compare
|
||||||
from ..util.base32 import rfc3548_alphabet
|
from ..util.base32 import rfc3548_alphabet
|
||||||
|
from allmydata.interfaces import BadWriteEnablerError
|
||||||
|
|
||||||
|
|
||||||
class ClientSecretsException(Exception):
|
class ClientSecretsException(Exception):
|
||||||
@ -587,19 +588,25 @@ class HTTPServer(object):
|
|||||||
authorization[Secrets.LEASE_RENEW],
|
authorization[Secrets.LEASE_RENEW],
|
||||||
authorization[Secrets.LEASE_CANCEL],
|
authorization[Secrets.LEASE_CANCEL],
|
||||||
)
|
)
|
||||||
success, read_data = self._storage_server.slot_testv_and_readv_and_writev(
|
try:
|
||||||
storage_index,
|
success, read_data = self._storage_server.slot_testv_and_readv_and_writev(
|
||||||
secrets,
|
storage_index,
|
||||||
{
|
secrets,
|
||||||
k: (
|
{
|
||||||
[(d["offset"], d["size"], b"eq", d["specimen"]) for d in v["test"]],
|
k: (
|
||||||
[(d["offset"], d["data"]) for d in v["write"]],
|
[
|
||||||
v["new-length"],
|
(d["offset"], d["size"], b"eq", d["specimen"])
|
||||||
)
|
for d in v["test"]
|
||||||
for (k, v) in rtw_request["test-write-vectors"].items()
|
],
|
||||||
},
|
[(d["offset"], d["data"]) for d in v["write"]],
|
||||||
[(d["offset"], d["size"]) for d in rtw_request["read-vector"]],
|
v["new-length"],
|
||||||
)
|
)
|
||||||
|
for (k, v) in rtw_request["test-write-vectors"].items()
|
||||||
|
},
|
||||||
|
[(d["offset"], d["size"]) for d in rtw_request["read-vector"]],
|
||||||
|
)
|
||||||
|
except BadWriteEnablerError:
|
||||||
|
raise _HTTPError(http.UNAUTHORIZED)
|
||||||
return self._send_encoded(request, {"success": success, "data": read_data})
|
return self._send_encoded(request, {"success": success, "data": read_data})
|
||||||
|
|
||||||
@_authorized_route(
|
@_authorized_route(
|
||||||
|
@ -1150,7 +1150,6 @@ class HTTPMutableAPIsTests(
|
|||||||
|
|
||||||
# TODO will be implemented in later tickets
|
# TODO will be implemented in later tickets
|
||||||
SKIP_TESTS = {
|
SKIP_TESTS = {
|
||||||
"test_STARAW_write_enabler_must_match",
|
|
||||||
"test_add_lease_renewal",
|
"test_add_lease_renewal",
|
||||||
"test_add_new_lease",
|
"test_add_new_lease",
|
||||||
"test_advise_corrupt_share",
|
"test_advise_corrupt_share",
|
||||||
|
Loading…
Reference in New Issue
Block a user