Ejemplo n.º 1
0
def test_make_context_single_header(trace_context, other_trace_context):
    headers = make_single_header(trace_context)
    context = make_context(headers)
    assert trace_context == context

    headers = make_single_header(other_trace_context)
    context = make_context(headers)
    assert other_trace_context == context

    headers = {'b3': '0'}
    context = make_context(headers)
    assert context is None

    headers = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4'}
    context = make_context(headers)
    assert context is None
Ejemplo n.º 2
0
def test_make_single_header(trace_context, other_trace_context):
    headers = make_single_header(trace_context)
    expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
    headers2 = trace_context.make_single_header()
    assert headers == expected == headers2

    headers = make_single_header(other_trace_context)
    h = '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d-05e3ac9a4f6e3b90'
    headers2 = other_trace_context.make_single_header()
    expected = {'b3': h}
    assert headers == expected == headers2

    new_context = trace_context._replace(debug=True, sampled=None)
    headers = make_single_header(new_context)
    expected = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
    assert headers == expected
Ejemplo n.º 3
0
def test_make_context_single_header(trace_context, other_trace_context):
    headers = make_single_header(trace_context)
    context = make_context(headers)
    assert trace_context == context

    headers = make_single_header(other_trace_context)
    context = make_context(headers)
    assert other_trace_context == context

    headers = {'b3': '0'}
    context = make_context(headers)
    assert context is None

    headers = {'b3': '6f9a20b5092fa5e144fd15cc31141cd4'}
    context = make_context(headers)
    assert context is None
Ejemplo n.º 4
0
def test_make_context_single_header(trace_context: TraceContext,
                                    other_trace_context: TraceContext) -> None:
    headers = make_single_header(trace_context)
    context = make_context(headers)
    assert trace_context == context

    headers = make_single_header(other_trace_context)
    context = make_context(headers)
    assert other_trace_context == context

    headers = {"b3": "0"}
    context = make_context(headers)
    assert context is None

    headers = {"b3": "6f9a20b5092fa5e144fd15cc31141cd4"}
    context = make_context(headers)
    assert context is None
Ejemplo n.º 5
0
def test_make_single_header(trace_context, other_trace_context):
    headers = make_single_header(trace_context)
    expected = {'b3':  '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1'}
    headers2 = trace_context.make_single_header()
    assert headers == expected == headers2

    headers = make_single_header(other_trace_context)
    h = '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d-05e3ac9a4f6e3b90'
    headers2 = other_trace_context.make_single_header()
    expected = {'b3': h}
    assert headers == expected == headers2

    new_context = trace_context._replace(debug=True, sampled=None)
    headers = make_single_header(new_context)
    expected = {'b3':  '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d'}
    assert headers == expected

    new_context = trace_context._replace(debug=False, sampled=None)
    headers = make_single_header(new_context)
    expected = {'b3':  '6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-0'}
    assert headers == expected
Ejemplo n.º 6
0
def test_make_single_header(trace_context: TraceContext,
                            other_trace_context: TraceContext) -> None:
    headers = make_single_header(trace_context)
    expected = {"b3": "6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-1"}
    headers2 = trace_context.make_single_header()
    assert headers == expected == headers2

    headers = make_single_header(other_trace_context)
    h = "6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d-05e3ac9a4f6e3b90"
    headers2 = other_trace_context.make_single_header()
    expected = {"b3": h}
    assert headers == expected == headers2

    new_context = trace_context._replace(debug=True, sampled=None)
    headers = make_single_header(new_context)
    expected = {"b3": "6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-d"}
    assert headers == expected

    new_context = trace_context._replace(debug=False, sampled=None)
    headers = make_single_header(new_context)
    expected = {"b3": "6f9a20b5092fa5e144fd15cc31141cd4-41baf1be2fb9bfc5-0"}
    assert headers == expected