コード例 #1
0
def test_should_retry_on_error(retry_flag, error_code, result):
    request = Request(
        headers={'re': retry_flag},
    )

    error = TChannelError.from_code(error_code, description="retry")
    assert request.should_retry_on_error(error) == result
コード例 #2
0
def test_should_retry_on_error(retry_flag, error_code, result):
    request = Request(
        headers={'re': retry_flag},
    )

    error = TChannelError.from_code(error_code, description="retry")
    assert request.should_retry_on_error(error) == result
コード例 #3
0
ファイル: test_retry.py プロジェクト: jonasrosland/tchannel
def test_should_retry_on_error(retry_flag, error_code, result):
    request = Request(
        headers={'re': retry_flag},
    )

    error = ProtocolError(code=error_code, description="retry")
    assert request.should_retry_on_error(error) == result
コード例 #4
0
def test_build_raw_request_message():
    message_factory = MessageFactory()
    req = Request(
        ttl=32,
        service="test",
        headers={},
        id=1111,
    )
    req.state = StreamState.init
    message = message_factory.build_raw_request_message(req, None, True)
    assert message.ttl / 1000.0 == req.ttl
    assert message.flags == req.flags
    assert message.id == req.id
    assert message.service == req.service
    assert message.headers == req.headers
コード例 #5
0
def test_zipkin_trace_zero_sampling():
    run_times = 100000
    hook = ZipkinTraceHook(sample_rate=0)

    request = Request()
    request.tracing.traceflags = True
    for _ in range(run_times):
        hook.before_send_request(request)

    assert not request.tracing.annotations
コード例 #6
0
def req():
    return Request(
        endpoint="endpoint1",
        service="test",
    )
コード例 #7
0
def test_should_retry_on_error(retry_flag, error_code, result):
    request = Request(headers={'re': retry_flag}, )

    error = ProtocolError(code=error_code, description="retry")
    assert request.should_retry_on_error(error) == result