def METHOD_NAME(
    test_db,  # noqa: F811
    mock_storage,  # noqa: F811
    mock_api_client,
    mock_load_log_lines,
    allow_any_run_state_transition,  # noqa: F811
):
    run = make_run(future_state=FutureState.RESOLVED)
    job = make_job(run_id=run.id)
    save_job(job)
    resolution = make_resolution(root_id=run.id, status=ResolutionStatus.COMPLETE)
    save_run(run)
    save_resolution(resolution)
    runner = CliRunner()
    mock_api_client.get_run = lambda x: run
    mock_api_client.get_pipeline_run = lambda x: resolution
    early_lines = ["out a", "out b", "out c"]
    late_lines = ["out d", "out e"]
    live_log_returns = [
        LogLineResult(
            can_continue_forward=True,
            can_continue_backward=True,
            lines=early_lines,
            line_ids=[i for i in range(len(early_lines))],
            forward_cursor_token="abc",
            reverse_cursor_token="zyx",
            log_info_message=None,
        ),
        LogLineResult(
            can_continue_forward=True,
            can_continue_backward=True,
            lines=[],  # simulate situation where more WILL be produced but isn't yet
            line_ids=[],
            forward_cursor_token="abc",
            reverse_cursor_token="zyx",
            log_info_message=None,
        ),
        LogLineResult(
            can_continue_forward=False,
            can_continue_backward=True,
            lines=late_lines,
            line_ids=[i + 10000 for i in range(len(late_lines))],
            forward_cursor_token=None,
            reverse_cursor_token="zyx",
            log_info_message=None,
        ),
    ]
    mock_returns = []
    def fake_return_logs(*args, **kwargs):
        result = mock_returns[0]
        mock_returns.remove(result)
        return result
    mock_load_log_lines.side_effect = fake_return_logs
    mock_returns.extend(live_log_returns)
    result = runner.invoke(logs, [run.id])
    assert result.exit_code == 0
    # As soon as it got to the end of the lines that had been produced
    # "so far" it should have stopped looking for more.
    assert list(result.output.split("\n"))[:-1] == early_lines
    mock_returns.clear()
    mock_returns.extend(live_log_returns)
    result = runner.invoke(logs, [run.id, "-f"])
    assert result.exit_code == 0
    assert list(result.output.split("\n"))[:-1] == early_lines + late_lines
    mock_returns.clear()
    mock_returns.extend(live_log_returns)
    result = runner.invoke(logs, [run.id, "--follow"])
    assert result.exit_code == 0
    assert list(result.output.split("\n"))[:-1] == early_lines + late_lines