More passing IStorageServer tests.

This commit is contained in:
Itamar Turner-Trauring 2022-02-02 12:55:41 -05:00
parent bceed6e199
commit 39fe48b174
2 changed files with 6 additions and 7 deletions

View File

@ -1094,15 +1094,18 @@ class _HTTPBucketReader(object):
class _HTTPStorageServer(object): class _HTTPStorageServer(object):
""" """
Talk to remote storage server over HTTP. Talk to remote storage server over HTTP.
The same upload key is used for all communication.
""" """
_http_client = attr.ib(type=StorageClient) _http_client = attr.ib(type=StorageClient)
_upload_secret = attr.ib(type=bytes)
@staticmethod @staticmethod
def from_http_client(http_client): # type: (StorageClient) -> _HTTPStorageServer def from_http_client(http_client): # type: (StorageClient) -> _HTTPStorageServer
""" """
Create an ``IStorageServer`` from a HTTP ``StorageClient``. Create an ``IStorageServer`` from a HTTP ``StorageClient``.
""" """
return _HTTPStorageServer(http_client=http_client) return _HTTPStorageServer(http_client=http_client, upload_secret=urandom(20))
def get_version(self): def get_version(self):
return self._http_client.get_version() return self._http_client.get_version()
@ -1117,10 +1120,9 @@ class _HTTPStorageServer(object):
allocated_size, allocated_size,
canary, canary,
): ):
upload_secret = urandom(20)
immutable_client = StorageClientImmutables(self._http_client) immutable_client = StorageClientImmutables(self._http_client)
result = immutable_client.create( result = immutable_client.create(
storage_index, sharenums, allocated_size, upload_secret, renew_secret, storage_index, sharenums, allocated_size, self._upload_secret, renew_secret,
cancel_secret cancel_secret
) )
result = yield result result = yield result
@ -1130,7 +1132,7 @@ class _HTTPStorageServer(object):
client=immutable_client, client=immutable_client,
storage_index=storage_index, storage_index=storage_index,
share_number=share_num, share_number=share_num,
upload_secret=upload_secret upload_secret=self._upload_secret
)) ))
for share_num in result.allocated for share_num in result.allocated
}) })

View File

@ -1148,13 +1148,10 @@ class HTTPImmutableAPIsTests(
"test_add_lease_renewal", "test_add_lease_renewal",
"test_add_new_lease", "test_add_new_lease",
"test_advise_corrupt_share", "test_advise_corrupt_share",
"test_allocate_buckets_repeat",
"test_bucket_advise_corrupt_share", "test_bucket_advise_corrupt_share",
"test_disconnection", "test_disconnection",
"test_get_buckets_skips_unfinished_buckets",
"test_matching_overlapping_writes", "test_matching_overlapping_writes",
"test_non_matching_overlapping_writes", "test_non_matching_overlapping_writes",
"test_written_shares_are_allocated",
} }