Skip to content

proxy from environment variable transport tests fail #1968

@xrmx

Description

@xrmx

Describe the bug:

==================================================================================================== FAILURES ===================================================================================================== ______________________________________________________________________________________ test_https_proxy_environment_variable ______________________________________________________________________________________ elasticapm_client = <tests.fixtures.TempStoreClient object at 0x7f7d6cca0810> def test_https_proxy_environment_variable(elasticapm_client): with mock.patch.dict("os.environ", {"HTTPS_PROXY": "https://example.com"}): transport = Transport("http://localhost:9999", client=elasticapm_client) > assert isinstance(transport.http, urllib3.poolmanager.ProxyManager) E AssertionError: assert False E + where False = isinstance(<urllib3.poolmanager.PoolManager object at 0x7f7d6ccb7c90>, <class 'urllib3.poolmanager.ProxyManager'>) E + where <urllib3.poolmanager.PoolManager object at 0x7f7d6ccb7c90> = <elasticapm.transport.http.Transport object at 0x7f7d6ccb6610>.http E + and <class 'urllib3.poolmanager.ProxyManager'> = <module 'urllib3.poolmanager' from '/home/rm/work/elastic/apm-agent-python/venv311/lib/python3.11/site-packages/urllib3/poolmanager.py'>.ProxyManager E + where <module 'urllib3.poolmanager' from '/home/rm/work/elastic/apm-agent-python/venv311/lib/python3.11/site-packages/urllib3/poolmanager.py'> = urllib3.poolmanager tests/transports/test_urllib3.py:126: AssertionError _______________________________________________________________________________ test_https_proxy_environment_variable_is_preferred ________________________________________________________________________________ elasticapm_client = <tests.fixtures.TempStoreClient object at 0x7f7d6ccade10> def test_https_proxy_environment_variable_is_preferred(elasticapm_client): with mock.patch.dict("os.environ", {"https_proxy": "https://example.com", "HTTP_PROXY": "http://example.com"}): transport = Transport("http://localhost:9999", client=elasticapm_client) > assert isinstance(transport.http, urllib3.poolmanager.ProxyManager) E AssertionError: assert False E + where False = isinstance(<urllib3.poolmanager.PoolManager object at 0x7f7d6cc86a90>, <class 'urllib3.poolmanager.ProxyManager'>) E + where <urllib3.poolmanager.PoolManager object at 0x7f7d6cc86a90> = <elasticapm.transport.http.Transport object at 0x7f7d6ccacad0>.http E + and <class 'urllib3.poolmanager.ProxyManager'> = <module 'urllib3.poolmanager' from '/home/rm/work/elastic/apm-agent-python/venv311/lib/python3.11/site-packages/urllib3/poolmanager.py'>.ProxyManager E + where <module 'urllib3.poolmanager' from '/home/rm/work/elastic/apm-agent-python/venv311/lib/python3.11/site-packages/urllib3/poolmanager.py'> = urllib3.poolmanager tests/transports/test_urllib3.py:132: AssertionError ______________________________________________________________________________________ test_http_proxy_environment_variable _______________________________________________________________________________________ elasticapm_client = <tests.fixtures.TempStoreClient object at 0x7f7d6c35fe10> def test_http_proxy_environment_variable(elasticapm_client): with mock.patch.dict("os.environ", {"HTTP_PROXY": "http://example.com"}): transport = Transport("http://localhost:9999", client=elasticapm_client) > assert isinstance(transport.http, urllib3.ProxyManager) E AssertionError: assert False E + where False = isinstance(<urllib3.poolmanager.PoolManager object at 0x7f7d6c3422d0>, <class 'urllib3.poolmanager.ProxyManager'>) E + where <urllib3.poolmanager.PoolManager object at 0x7f7d6c3422d0> = <elasticapm.transport.http.Transport object at 0x7f7d6c36e810>.http E + and <class 'urllib3.poolmanager.ProxyManager'> = urllib3.ProxyManager tests/transports/test_urllib3.py:120: AssertionError 

To Reproduce

  1. pip install -r tests/requirements/reqs-base.txt
  2. pytest

Environment (please complete the following information)

  • OS: [e.g. Linux] Linux
  • Python version: 3.11.8
  • Framework and version [e.g. Django 2.1]: -
  • APM Server version: -
  • Agent version: main

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions