Skip to content

Flaky test for HTTPLibTestCase.test_httplib_request_and_response_headers #1285

@jd

Description

@jd
=================================== FAILURES ===================================
__________ HTTPLibTestCase.test_httplib_request_and_response_headers ___________

self = <tests.contrib.httplib.test_httplib.HTTPLibTestCase testMethod=test_httplib_request_and_response_headers>

    def test_httplib_request_and_response_headers(self):
    
        # Disabled when not configured
        conn = self.get_http_connection(SOCKET)
        with contextlib.closing(conn):
            conn.request('GET', '/status/200', headers={'my-header': 'my_value'})
            conn.getresponse()
            spans = self.tracer.writer.pop()
            s = spans[0]
            self.assertEqual(s.get_tag('http.request.headers.my_header'), None)
            self.assertEqual(s.get_tag('http.response.headers.access_control_allow_origin'), None)
    
        # Enabled when configured
        with self.override_config('hhtplib', {}):
            from ddtrace.settings import IntegrationConfig
            integration_config = config.httplib  # type: IntegrationConfig
            integration_config.http.trace_headers(['my-header', 'access-control-allow-origin'])
            conn = self.get_http_connection(SOCKET)
            with contextlib.closing(conn):
                conn.request('GET', '/status/200', headers={'my-header': 'my_value'})
                conn.getresponse()
                spans = self.tracer.writer.pop()
        s = spans[0]
        self.assertEqual(s.get_tag('http.request.headers.my-header'), 'my_value')
>       self.assertEqual(s.get_tag('http.response.headers.access-control-allow-origin'), '*')
E       AssertionError: None != '*'

tests/contrib/httplib/test_httplib.py:367: AssertionError

https://app.circleci.com/pipelines/github/DataDog/dd-trace-py/359/workflows/25988bb2-b77b-4f6c-8f0a-4ec9347809da/jobs/211720

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions