From 4ef03bb1f4ae2c550ca0f877ae6f429943bd47d9 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Thu, 16 Jun 2022 16:53:09 -0400 Subject: [PATCH] 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(). --- tests/integration/datanetwork/test_streaming.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/integration/datanetwork/test_streaming.py b/tests/integration/datanetwork/test_streaming.py index fa9a7466b..4f60e8909 100644 --- a/tests/integration/datanetwork/test_streaming.py +++ b/tests/integration/datanetwork/test_streaming.py @@ -4,6 +4,7 @@ import aiohttp import aiohttp.web import asyncio +from lbry.file.source import ManagedDownloadSource from lbry.utils import aiohttp_request from lbry.blob.blob_file import MAX_BLOB_SIZE from lbry.testcase import CommandTestCase @@ -354,10 +355,15 @@ class RangeRequests(CommandTestCase): if wait_for_start_writing: await stream.started_writing.wait() 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] self.assertIsNotNone(stream.full_path) - self.assertFalse(os.path.isfile(path)) + self.assertEqual(stream.full_path, path) if wait_for_start_writing: await stream.started_writing.wait() self.assertTrue(os.path.isfile(path))