async def test_working_through_upload(drive: DriveSource, server: SimulationServer, backup_helper: BackupHelper, interceptor: RequestInterceptor): assert not drive.isWorking() # Let a single chunk upload, then wait matcher = interceptor.setWaiter(URL_MATCH_UPLOAD_PROGRESS, attempts=1) from_backup, data = await backup_helper.createFile(size=1024 * 1024 * 10) save_task = asyncio.create_task(drive.save(from_backup, data)) await matcher.waitForCall() assert drive.isWorking() # let it complete matcher.clear() await save_task assert not drive.isWorking()
async def test_working_through_upload(drive: DriveSource, server: SimulationServer, snapshot_helper: SnapshotHelper): assert not drive.isWorking() # Let a single chunk upload, then wait server._upload_chunk_wait.clear() server._upload_chunk_trigger.clear() server.waitOnChunk = 2 from_snapshot, data = await snapshot_helper.createFile(size=1024 * 1024 * 10) save_task = asyncio.create_task(drive.save(from_snapshot, data)) await server._upload_chunk_trigger.wait() assert drive.isWorking() # let it complete server._upload_chunk_wait.set() await save_task assert not drive.isWorking()