Match Foolscap behavior for slot_readv of unknown storage index.

This commit is contained in:
Itamar Turner-Trauring 2022-05-11 11:11:24 -04:00
parent 6d412a017c
commit 4b62ec082b
2 changed files with 23 additions and 1 deletions

View File

@ -1200,7 +1200,13 @@ class _HTTPStorageServer(object):
# If shares list is empty, that means list all shares, so we need
# to do a query to get that.
if not shares:
shares = yield mutable_client.list_shares(storage_index)
try:
shares = yield mutable_client.list_shares(storage_index)
except ClientException as e:
if e.code == http.NOT_FOUND:
shares = set()
else:
raise
# Start all the queries in parallel:
for share_number in shares:

View File

@ -854,6 +854,22 @@ class IStorageServerMutableAPIsTestsMixin(object):
{0: [b"abcdefg"], 1: [b"0123456"], 2: [b"9876543"]},
)
@inlineCallbacks
def test_slot_readv_unknown_storage_index(self):
"""
With unknown storage index, ``IStorageServer.slot_readv()`` TODO.
"""
storage_index = new_storage_index()
reads = yield self.storage_client.slot_readv(
storage_index,
shares=[],
readv=[(0, 7)],
)
self.assertEqual(
reads,
{},
)
@inlineCallbacks
def create_slot(self):
"""Create a slot with sharenum 0."""