forked from LBRYCommunity/lbry-sdk
Try separate file_manager.stop() and start() calls to better
control order of events in test. While file_manager is stopped, we get no response to file_list().
This commit is contained in:
parent
4bd4bcdc27
commit
4ef03bb1f4
1 changed files with 8 additions and 2 deletions
|
@ -4,6 +4,7 @@ import aiohttp
|
||||||
import aiohttp.web
|
import aiohttp.web
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
from lbry.file.source import ManagedDownloadSource
|
||||||
from lbry.utils import aiohttp_request
|
from lbry.utils import aiohttp_request
|
||||||
from lbry.blob.blob_file import MAX_BLOB_SIZE
|
from lbry.blob.blob_file import MAX_BLOB_SIZE
|
||||||
from lbry.testcase import CommandTestCase
|
from lbry.testcase import CommandTestCase
|
||||||
|
@ -354,10 +355,15 @@ class RangeRequests(CommandTestCase):
|
||||||
if wait_for_start_writing:
|
if wait_for_start_writing:
|
||||||
await stream.started_writing.wait()
|
await stream.started_writing.wait()
|
||||||
self.assertTrue(os.path.isfile(path))
|
self.assertTrue(os.path.isfile(path))
|
||||||
await self._restart_stream_manager()
|
await self.daemon.file_manager.stop()
|
||||||
|
# while stopped, we get no response to query and no file is present
|
||||||
|
self.assertEqual((await self.daemon.jsonrpc_file_list())['items'], [])
|
||||||
|
self.assertEqual(os.path.isfile(path), stream.status == ManagedDownloadSource.STATUS_FINISHED)
|
||||||
|
await self.daemon.file_manager.start()
|
||||||
|
# after restart, we get a response to query and same file path
|
||||||
stream = (await self.daemon.jsonrpc_file_list())['items'][0]
|
stream = (await self.daemon.jsonrpc_file_list())['items'][0]
|
||||||
self.assertIsNotNone(stream.full_path)
|
self.assertIsNotNone(stream.full_path)
|
||||||
self.assertFalse(os.path.isfile(path))
|
self.assertEqual(stream.full_path, path)
|
||||||
if wait_for_start_writing:
|
if wait_for_start_writing:
|
||||||
await stream.started_writing.wait()
|
await stream.started_writing.wait()
|
||||||
self.assertTrue(os.path.isfile(path))
|
self.assertTrue(os.path.isfile(path))
|
||||||
|
|
Loading…
Reference in a new issue