示例#1
0
async def test_stream_processor_retrying_after_read_error(run_engine, redis):
    response = mock.Mock()
    response.json.return_value = {"message": "boom"}
    response.status_code = 503
    run_engine.side_effect = httpx.ReadError(
        "Server disconnected while attempting read",
        request=mock.Mock(),
    )

    p = worker.StreamProcessor(redis)

    with pytest.raises(worker.StreamRetry):
        await p._run_engine_and_translate_exception_to_retries(
            "stream-owner", "owner", "repo", 1234, [])
示例#2
0
async def test_stream_processor_retrying_after_read_error(
        run_engine, _, redis_stream, redis_cache):
    response = mock.Mock()
    response.json.return_value = {"message": "boom"}
    response.status_code = 503
    run_engine.side_effect = httpx.ReadError(
        "Server disconnected while attempting read",
        request=mock.Mock(),
    )

    p = worker.StreamProcessor(redis_stream, redis_cache)

    installation = context.Installation(123, "owner", {}, None, None)
    with pytest.raises(worker.StreamRetry):
        async with p._translate_exception_to_retries(installation.stream_name):
            await worker.run_engine(installation, "repo", 1234, [])