2018-08-02 20:34:02 +02:00
|
|
|
import os
|
2018-08-10 05:49:17 +02:00
|
|
|
from binascii import hexlify
|
|
|
|
|
2018-08-02 20:34:02 +02:00
|
|
|
from twisted.internet import defer, error
|
2016-08-10 15:29:44 +02:00
|
|
|
from twisted.trial import unittest
|
2018-11-04 20:06:29 +01:00
|
|
|
from lbrynet.p2p.StreamDescriptor import get_sd_info
|
2018-11-09 20:02:03 +01:00
|
|
|
from lbrynet.extras.reflector.server.server import ReflectorServerFactory
|
|
|
|
from lbrynet.extras.reflector.client.client import EncryptedFileReflectorClientFactory
|
|
|
|
from lbrynet.extras.reflector.client.blob import BlobReflectorClientFactory
|
2018-11-07 21:15:05 +01:00
|
|
|
from lbrynet.extras.daemon.PeerManager import PeerManager
|
|
|
|
from lbrynet.p2p import BlobManager
|
2018-11-04 20:06:29 +01:00
|
|
|
from lbrynet.p2p import StreamDescriptor
|
2018-11-04 20:55:01 +01:00
|
|
|
from lbrynet.blob import EncryptedFileCreator
|
|
|
|
from lbrynet.blob.EncryptedFileManager import EncryptedFileManager
|
2018-11-04 20:06:29 +01:00
|
|
|
from lbrynet.p2p.RateLimiter import DummyRateLimiter
|
2018-11-04 20:00:57 +01:00
|
|
|
from lbrynet.extras.daemon.storage import SQLiteStorage
|
2018-11-04 20:06:29 +01:00
|
|
|
from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager
|
2018-07-07 00:34:33 +02:00
|
|
|
from tests import mocks
|
2018-11-07 21:15:05 +01:00
|
|
|
from tests.test_utils import mk_db_and_blob_dir, rm_db_and_blob_dir
|
2016-08-10 15:29:44 +02:00
|
|
|
|
2017-10-10 19:31:07 +02:00
|
|
|
|
2016-08-10 15:29:44 +02:00
|
|
|
class TestReflector(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
|
|
self.reflector_port = None
|
2017-02-06 19:35:53 +01:00
|
|
|
self.port = None
|
2018-08-02 20:34:02 +02:00
|
|
|
mocks.mock_conf_settings(self)
|
|
|
|
self.server_db_dir, self.server_blob_dir = mk_db_and_blob_dir()
|
|
|
|
self.client_db_dir, self.client_blob_dir = mk_db_and_blob_dir()
|
|
|
|
prm = OnlyFreePaymentsManager()
|
2016-08-10 15:29:44 +02:00
|
|
|
wallet = mocks.Wallet()
|
2018-11-07 22:12:11 +01:00
|
|
|
peer_manager = PeerManager()
|
2016-08-10 15:29:44 +02:00
|
|
|
peer_finder = mocks.PeerFinder(5553, peer_manager, 2)
|
2018-08-02 20:34:02 +02:00
|
|
|
self.server_storage = SQLiteStorage(self.server_db_dir)
|
|
|
|
self.server_blob_manager = BlobManager.DiskBlobManager(self.server_blob_dir, self.server_storage)
|
|
|
|
self.client_storage = SQLiteStorage(self.client_db_dir)
|
|
|
|
self.client_blob_manager = BlobManager.DiskBlobManager(self.client_blob_dir, self.client_storage)
|
2018-08-03 15:36:03 +02:00
|
|
|
self.server_lbry_file_manager = EncryptedFileManager(
|
|
|
|
peer_finder, DummyRateLimiter(), self.server_blob_manager, wallet, prm, self.server_storage,
|
|
|
|
StreamDescriptor.StreamDescriptorIdentifier()
|
|
|
|
)
|
|
|
|
self.client_lbry_file_manager = EncryptedFileManager(
|
|
|
|
peer_finder, DummyRateLimiter(), self.client_blob_manager, wallet, prm, self.client_storage,
|
|
|
|
StreamDescriptor.StreamDescriptorIdentifier()
|
|
|
|
)
|
2016-08-10 15:29:44 +02:00
|
|
|
|
|
|
|
self.expected_blobs = [
|
|
|
|
(
|
|
|
|
'dc4708f76a5e7af0f1cae0ee96b824e2ed9250c9346c093b'
|
|
|
|
'441f0a20d3607c17948b6fcfb4bc62020fe5286693d08586',
|
|
|
|
2097152
|
|
|
|
),
|
|
|
|
(
|
|
|
|
'f4067522c1b49432a2a679512e3917144317caa1abba0c04'
|
|
|
|
'1e0cd2cf9f635d4cf127ce1824fa04189b63916174951f70',
|
|
|
|
2097152
|
|
|
|
),
|
|
|
|
(
|
|
|
|
'305486c434260484fcb2968ce0e963b72f81ba56c11b08b1'
|
|
|
|
'af0789b55b44d78422600f9a38e3cf4f2e9569897e5646a9',
|
|
|
|
1015056
|
|
|
|
),
|
|
|
|
]
|
2018-08-02 20:34:02 +02:00
|
|
|
|
|
|
|
d = self.server_storage.setup()
|
2016-08-10 15:29:44 +02:00
|
|
|
d.addCallback(lambda _: self.server_blob_manager.setup())
|
2017-11-15 15:24:12 +01:00
|
|
|
d.addCallback(lambda _: self.server_lbry_file_manager.setup())
|
2018-08-02 20:34:02 +02:00
|
|
|
d.addCallback(lambda _: self.client_storage.setup())
|
|
|
|
d.addCallback(lambda _: self.client_blob_manager.setup())
|
|
|
|
d.addCallback(lambda _: self.client_lbry_file_manager.setup())
|
2016-08-10 15:29:44 +02:00
|
|
|
|
2018-02-12 20:19:39 +01:00
|
|
|
@defer.inlineCallbacks
|
|
|
|
def verify_equal(sd_info, stream_hash):
|
|
|
|
self.assertDictEqual(mocks.create_stream_sd_file, sd_info)
|
2018-08-02 20:34:02 +02:00
|
|
|
sd_hash = yield self.client_storage.get_sd_blob_hash_for_stream(stream_hash)
|
2018-02-12 20:19:39 +01:00
|
|
|
defer.returnValue(sd_hash)
|
2016-08-10 15:29:44 +02:00
|
|
|
|
|
|
|
def save_sd_blob_hash(sd_hash):
|
2017-08-22 18:46:12 +02:00
|
|
|
self.sd_hash = sd_hash
|
2016-08-10 15:29:44 +02:00
|
|
|
self.expected_blobs.append((sd_hash, 923))
|
|
|
|
|
|
|
|
def verify_stream_descriptor_file(stream_hash):
|
2017-02-06 19:35:53 +01:00
|
|
|
self.stream_hash = stream_hash
|
2018-08-02 20:34:02 +02:00
|
|
|
d = get_sd_info(self.client_storage, stream_hash, True)
|
2018-02-12 20:19:39 +01:00
|
|
|
d.addCallback(verify_equal, stream_hash)
|
2016-08-10 15:29:44 +02:00
|
|
|
d.addCallback(save_sd_blob_hash)
|
|
|
|
return d
|
|
|
|
|
|
|
|
def create_stream():
|
2018-08-10 06:55:28 +02:00
|
|
|
test_file = mocks.GenFile(5209343, bytes((i + 3) for i in range(0, 64, 6)))
|
2016-09-27 21:08:32 +02:00
|
|
|
d = EncryptedFileCreator.create_lbry_file(
|
2018-08-02 20:34:02 +02:00
|
|
|
self.client_blob_manager, self.client_storage, prm, self.client_lbry_file_manager,
|
2016-08-10 15:29:44 +02:00
|
|
|
"test_file",
|
|
|
|
test_file,
|
2018-08-10 05:49:17 +02:00
|
|
|
key=b"0123456701234567",
|
2016-08-10 15:29:44 +02:00
|
|
|
iv_generator=iv_generator()
|
|
|
|
)
|
2018-02-12 20:19:39 +01:00
|
|
|
d.addCallback(lambda lbry_file: lbry_file.stream_hash)
|
2016-08-10 15:29:44 +02:00
|
|
|
return d
|
|
|
|
|
|
|
|
def start_server():
|
2018-11-09 20:02:03 +01:00
|
|
|
server_factory = ReflectorServerFactory(peer_manager, self.server_blob_manager,
|
2018-08-02 20:34:02 +02:00
|
|
|
self.server_lbry_file_manager)
|
2016-08-10 15:29:44 +02:00
|
|
|
from twisted.internet import reactor
|
|
|
|
port = 8943
|
|
|
|
while self.reflector_port is None:
|
|
|
|
try:
|
|
|
|
self.reflector_port = reactor.listenTCP(port, server_factory)
|
2017-02-06 19:35:53 +01:00
|
|
|
self.port = port
|
2016-08-10 15:29:44 +02:00
|
|
|
except error.CannotListenError:
|
|
|
|
port += 1
|
|
|
|
|
2017-02-06 19:35:53 +01:00
|
|
|
d.addCallback(lambda _: create_stream())
|
|
|
|
d.addCallback(verify_stream_descriptor_file)
|
|
|
|
d.addCallback(lambda _: start_server())
|
|
|
|
return d
|
|
|
|
|
2018-08-02 20:34:02 +02:00
|
|
|
@defer.inlineCallbacks
|
|
|
|
def tearDown(self):
|
|
|
|
lbry_files = self.client_lbry_file_manager.lbry_files
|
|
|
|
for lbry_file in lbry_files:
|
|
|
|
yield self.client_lbry_file_manager.delete_lbry_file(lbry_file)
|
|
|
|
yield self.client_lbry_file_manager.stop()
|
|
|
|
yield self.client_blob_manager.stop()
|
|
|
|
yield self.client_storage.stop()
|
|
|
|
self.reflector_port.stopListening()
|
|
|
|
lbry_files = self.server_lbry_file_manager.lbry_files
|
|
|
|
for lbry_file in lbry_files:
|
|
|
|
yield self.server_lbry_file_manager.delete_lbry_file(lbry_file)
|
|
|
|
yield self.server_lbry_file_manager.stop()
|
|
|
|
yield self.server_blob_manager.stop()
|
|
|
|
yield self.server_storage.stop()
|
|
|
|
try:
|
|
|
|
rm_db_and_blob_dir(self.client_db_dir, self.client_blob_dir)
|
|
|
|
except Exception as err:
|
|
|
|
raise unittest.SkipTest("TODO: fix this for windows")
|
|
|
|
try:
|
|
|
|
rm_db_and_blob_dir(self.server_db_dir, self.server_blob_dir)
|
|
|
|
except Exception as err:
|
|
|
|
raise unittest.SkipTest("TODO: fix this for windows")
|
|
|
|
if os.path.exists("test_file"):
|
|
|
|
os.remove("test_file")
|
2017-02-06 19:35:53 +01:00
|
|
|
|
|
|
|
def test_stream_reflector(self):
|
2017-08-22 18:46:12 +02:00
|
|
|
def verify_blob_on_reflector():
|
2017-02-06 19:35:53 +01:00
|
|
|
check_blob_ds = []
|
|
|
|
for blob_hash, blob_size in self.expected_blobs:
|
|
|
|
check_blob_ds.append(verify_have_blob(blob_hash, blob_size))
|
|
|
|
return defer.DeferredList(check_blob_ds)
|
|
|
|
|
2017-08-22 18:46:12 +02:00
|
|
|
@defer.inlineCallbacks
|
|
|
|
def verify_stream_on_reflector():
|
|
|
|
# check stream_info_manager has all the right information
|
2018-08-02 20:34:02 +02:00
|
|
|
streams = yield self.server_storage.get_all_streams()
|
2017-08-22 18:46:12 +02:00
|
|
|
self.assertEqual(1, len(streams))
|
|
|
|
self.assertEqual(self.stream_hash, streams[0])
|
|
|
|
|
2018-08-02 20:34:02 +02:00
|
|
|
blobs = yield self.server_storage.get_blobs_for_stream(self.stream_hash)
|
2018-02-12 20:19:39 +01:00
|
|
|
blob_hashes = [b.blob_hash for b in blobs if b.blob_hash is not None]
|
2017-08-22 18:46:12 +02:00
|
|
|
expected_blob_hashes = [b[0] for b in self.expected_blobs[:-1] if b[0] is not None]
|
|
|
|
self.assertEqual(expected_blob_hashes, blob_hashes)
|
2018-08-02 20:34:02 +02:00
|
|
|
sd_hash = yield self.server_storage.get_sd_blob_hash_for_stream(streams[0])
|
2018-02-12 20:19:39 +01:00
|
|
|
self.assertEqual(self.sd_hash, sd_hash)
|
2017-08-22 18:46:12 +02:00
|
|
|
|
2017-11-15 15:24:12 +01:00
|
|
|
# check lbry file manager has the file
|
|
|
|
files = yield self.server_lbry_file_manager.lbry_files
|
|
|
|
|
2018-02-12 20:19:39 +01:00
|
|
|
self.assertEqual(0, len(files))
|
|
|
|
|
2018-08-02 20:34:02 +02:00
|
|
|
streams = yield self.server_storage.get_all_streams()
|
2018-02-12 20:19:39 +01:00
|
|
|
self.assertEqual(1, len(streams))
|
2018-08-02 20:34:02 +02:00
|
|
|
stream_info = yield self.server_storage.get_stream_info(self.stream_hash)
|
2018-02-12 20:19:39 +01:00
|
|
|
self.assertEqual(self.sd_hash, stream_info[3])
|
2018-08-10 05:49:17 +02:00
|
|
|
self.assertEqual(hexlify(b'test_file').decode(), stream_info[0])
|
2017-12-05 19:12:29 +01:00
|
|
|
|
2017-08-22 18:46:12 +02:00
|
|
|
# check should_announce blobs on blob_manager
|
2018-08-02 20:34:02 +02:00
|
|
|
blob_hashes = yield self.server_storage.get_all_should_announce_blobs()
|
2018-02-12 20:19:39 +01:00
|
|
|
self.assertSetEqual({self.sd_hash, expected_blob_hashes[0]}, set(blob_hashes))
|
2017-08-22 18:46:12 +02:00
|
|
|
|
2017-02-06 19:35:53 +01:00
|
|
|
def verify_have_blob(blob_hash, blob_size):
|
2017-02-14 20:18:42 +01:00
|
|
|
d = self.server_blob_manager.get_blob(blob_hash)
|
2017-02-06 19:35:53 +01:00
|
|
|
d.addCallback(lambda blob: verify_blob_completed(blob, blob_size))
|
|
|
|
return d
|
|
|
|
|
|
|
|
def send_to_server():
|
2018-11-09 20:02:03 +01:00
|
|
|
factory = EncryptedFileReflectorClientFactory(self.client_blob_manager, self.stream_hash, self.sd_hash)
|
2016-08-10 15:29:44 +02:00
|
|
|
|
|
|
|
from twisted.internet import reactor
|
2017-02-06 19:35:53 +01:00
|
|
|
reactor.connectTCP('localhost', self.port, factory)
|
2016-08-10 15:29:44 +02:00
|
|
|
return factory.finished_deferred
|
|
|
|
|
|
|
|
def verify_blob_completed(blob, blob_size):
|
2017-09-20 20:02:34 +02:00
|
|
|
self.assertTrue(blob.get_is_verified())
|
2016-08-10 15:29:44 +02:00
|
|
|
self.assertEqual(blob_size, blob.length)
|
2017-02-06 19:35:53 +01:00
|
|
|
return
|
|
|
|
|
|
|
|
d = send_to_server()
|
2017-08-22 18:46:12 +02:00
|
|
|
d.addCallback(lambda _: verify_blob_on_reflector())
|
|
|
|
d.addCallback(lambda _: verify_stream_on_reflector())
|
2017-02-06 19:35:53 +01:00
|
|
|
return d
|
|
|
|
|
|
|
|
def test_blob_reflector(self):
|
|
|
|
def verify_data_on_reflector():
|
|
|
|
check_blob_ds = []
|
|
|
|
for blob_hash, blob_size in self.expected_blobs:
|
|
|
|
check_blob_ds.append(verify_have_blob(blob_hash, blob_size))
|
|
|
|
return defer.DeferredList(check_blob_ds)
|
2016-08-10 15:29:44 +02:00
|
|
|
|
|
|
|
def verify_have_blob(blob_hash, blob_size):
|
2017-02-14 20:18:42 +01:00
|
|
|
d = self.server_blob_manager.get_blob(blob_hash)
|
2016-08-10 15:29:44 +02:00
|
|
|
d.addCallback(lambda blob: verify_blob_completed(blob, blob_size))
|
|
|
|
return d
|
|
|
|
|
2017-02-06 19:35:53 +01:00
|
|
|
def send_to_server(blob_hashes_to_send):
|
2018-11-09 20:02:03 +01:00
|
|
|
factory = BlobReflectorClientFactory(
|
2018-08-02 20:34:02 +02:00
|
|
|
self.client_blob_manager,
|
2017-02-06 19:35:53 +01:00
|
|
|
blob_hashes_to_send
|
|
|
|
)
|
|
|
|
|
|
|
|
from twisted.internet import reactor
|
|
|
|
reactor.connectTCP('localhost', self.port, factory)
|
|
|
|
return factory.finished_deferred
|
|
|
|
|
|
|
|
def verify_blob_completed(blob, blob_size):
|
2017-09-20 20:02:34 +02:00
|
|
|
self.assertTrue(blob.get_is_verified())
|
2017-02-06 19:35:53 +01:00
|
|
|
self.assertEqual(blob_size, blob.length)
|
|
|
|
|
|
|
|
d = send_to_server([x[0] for x in self.expected_blobs])
|
|
|
|
d.addCallback(lambda _: verify_data_on_reflector())
|
|
|
|
return d
|
|
|
|
|
|
|
|
def test_blob_reflector_v1(self):
|
2017-09-20 21:50:54 +02:00
|
|
|
@defer.inlineCallbacks
|
|
|
|
def verify_stream_on_reflector():
|
|
|
|
# this protocol should not have any impact on stream info manager
|
2018-08-02 20:34:02 +02:00
|
|
|
streams = yield self.server_storage.get_all_streams()
|
2017-09-20 21:50:54 +02:00
|
|
|
self.assertEqual(0, len(streams))
|
|
|
|
# there should be no should announce blobs here
|
2018-08-02 20:34:02 +02:00
|
|
|
blob_hashes = yield self.server_storage.get_all_should_announce_blobs()
|
2017-09-20 21:50:54 +02:00
|
|
|
self.assertEqual(0, len(blob_hashes))
|
|
|
|
|
2016-08-10 15:29:44 +02:00
|
|
|
def verify_data_on_reflector():
|
|
|
|
check_blob_ds = []
|
|
|
|
for blob_hash, blob_size in self.expected_blobs:
|
|
|
|
check_blob_ds.append(verify_have_blob(blob_hash, blob_size))
|
|
|
|
return defer.DeferredList(check_blob_ds)
|
|
|
|
|
2017-02-06 19:35:53 +01:00
|
|
|
def verify_have_blob(blob_hash, blob_size):
|
2017-02-14 20:18:42 +01:00
|
|
|
d = self.server_blob_manager.get_blob(blob_hash)
|
2017-02-06 19:35:53 +01:00
|
|
|
d.addCallback(lambda blob: verify_blob_completed(blob, blob_size))
|
2016-08-10 15:29:44 +02:00
|
|
|
return d
|
|
|
|
|
2017-02-06 19:35:53 +01:00
|
|
|
def send_to_server(blob_hashes_to_send):
|
2018-11-09 20:02:03 +01:00
|
|
|
factory = BlobReflectorClientFactory(
|
2018-08-02 20:34:02 +02:00
|
|
|
self.client_blob_manager,
|
2017-02-06 19:35:53 +01:00
|
|
|
blob_hashes_to_send
|
|
|
|
)
|
|
|
|
factory.protocol_version = 0
|
|
|
|
|
|
|
|
from twisted.internet import reactor
|
|
|
|
reactor.connectTCP('localhost', self.port, factory)
|
|
|
|
return factory.finished_deferred
|
|
|
|
|
|
|
|
def verify_blob_completed(blob, blob_size):
|
2017-09-20 20:02:34 +02:00
|
|
|
self.assertTrue(blob.get_is_verified())
|
2017-02-06 19:35:53 +01:00
|
|
|
self.assertEqual(blob_size, blob.length)
|
|
|
|
|
|
|
|
d = send_to_server([x[0] for x in self.expected_blobs])
|
|
|
|
d.addCallback(lambda _: verify_data_on_reflector())
|
2016-08-10 15:29:44 +02:00
|
|
|
return d
|
2016-08-11 02:04:03 +02:00
|
|
|
|
2017-09-21 04:57:47 +02:00
|
|
|
# test case when we reflect blob, and than that same blob
|
|
|
|
# is reflected as stream
|
|
|
|
def test_blob_reflect_and_stream(self):
|
|
|
|
|
|
|
|
def verify_blob_on_reflector():
|
|
|
|
check_blob_ds = []
|
|
|
|
for blob_hash, blob_size in self.expected_blobs:
|
|
|
|
check_blob_ds.append(verify_have_blob(blob_hash, blob_size))
|
|
|
|
return defer.DeferredList(check_blob_ds)
|
|
|
|
|
|
|
|
@defer.inlineCallbacks
|
|
|
|
def verify_stream_on_reflector():
|
|
|
|
# check stream_info_manager has all the right information
|
|
|
|
|
2018-08-02 20:34:02 +02:00
|
|
|
streams = yield self.server_storage.get_all_streams()
|
2017-09-21 04:57:47 +02:00
|
|
|
self.assertEqual(1, len(streams))
|
|
|
|
self.assertEqual(self.stream_hash, streams[0])
|
|
|
|
|
2018-08-02 20:34:02 +02:00
|
|
|
blobs = yield self.server_storage.get_blobs_for_stream(self.stream_hash)
|
2018-02-12 20:19:39 +01:00
|
|
|
blob_hashes = [b.blob_hash for b in blobs if b.blob_hash is not None]
|
2017-09-21 04:57:47 +02:00
|
|
|
expected_blob_hashes = [b[0] for b in self.expected_blobs[:-1] if b[0] is not None]
|
|
|
|
self.assertEqual(expected_blob_hashes, blob_hashes)
|
2018-08-02 20:34:02 +02:00
|
|
|
sd_hash = yield self.server_storage.get_sd_blob_hash_for_stream(
|
2017-09-29 12:44:22 +02:00
|
|
|
self.stream_hash)
|
2018-02-12 20:19:39 +01:00
|
|
|
self.assertEqual(self.sd_hash, sd_hash)
|
2017-09-21 04:57:47 +02:00
|
|
|
|
|
|
|
# check should_announce blobs on blob_manager
|
2018-08-02 20:34:02 +02:00
|
|
|
to_announce = yield self.server_storage.get_all_should_announce_blobs()
|
2018-02-12 20:19:39 +01:00
|
|
|
self.assertSetEqual(set(to_announce), {self.sd_hash, expected_blob_hashes[0]})
|
2017-09-21 04:57:47 +02:00
|
|
|
|
|
|
|
def verify_have_blob(blob_hash, blob_size):
|
|
|
|
d = self.server_blob_manager.get_blob(blob_hash)
|
|
|
|
d.addCallback(lambda blob: verify_blob_completed(blob, blob_size))
|
|
|
|
return d
|
|
|
|
|
|
|
|
def send_to_server_as_blobs(blob_hashes_to_send):
|
2018-11-09 20:02:03 +01:00
|
|
|
factory = BlobReflectorClientFactory(
|
2018-08-02 20:34:02 +02:00
|
|
|
self.client_blob_manager,
|
2017-09-21 04:57:47 +02:00
|
|
|
blob_hashes_to_send
|
|
|
|
)
|
|
|
|
factory.protocol_version = 0
|
|
|
|
|
|
|
|
from twisted.internet import reactor
|
|
|
|
reactor.connectTCP('localhost', self.port, factory)
|
|
|
|
return factory.finished_deferred
|
|
|
|
|
|
|
|
def send_to_server_as_stream(result):
|
2018-11-09 20:02:03 +01:00
|
|
|
factory = EncryptedFileReflectorClientFactory(self.client_blob_manager, self.stream_hash, self.sd_hash)
|
2017-09-21 04:57:47 +02:00
|
|
|
|
|
|
|
from twisted.internet import reactor
|
|
|
|
reactor.connectTCP('localhost', self.port, factory)
|
|
|
|
return factory.finished_deferred
|
|
|
|
|
|
|
|
def verify_blob_completed(blob, blob_size):
|
|
|
|
self.assertTrue(blob.get_is_verified())
|
|
|
|
self.assertEqual(blob_size, blob.length)
|
|
|
|
|
|
|
|
# Modify this to change which blobs to send
|
|
|
|
blobs_to_send = self.expected_blobs
|
|
|
|
|
|
|
|
d = send_to_server_as_blobs([x[0] for x in self.expected_blobs])
|
|
|
|
d.addCallback(send_to_server_as_stream)
|
|
|
|
d.addCallback(lambda _: verify_blob_on_reflector())
|
|
|
|
d.addCallback(lambda _: verify_stream_on_reflector())
|
|
|
|
return d
|
2016-08-11 02:04:03 +02:00
|
|
|
|
2018-02-20 19:46:46 +01:00
|
|
|
|
2016-08-11 02:04:03 +02:00
|
|
|
def iv_generator():
|
|
|
|
iv = 0
|
|
|
|
while True:
|
|
|
|
iv += 1
|
2018-08-10 05:49:17 +02:00
|
|
|
yield b"%016d" % iv
|