From fb685b0120d4a98eb69badcd66188567701a4441 Mon Sep 17 00:00:00 2001 From: Ran Nozik Date: Fri, 4 Feb 2022 14:16:02 +0200 Subject: [PATCH] fix failed tests --- .../tests/test_httpx_integration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py b/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py index 2fd16c2167..cc82c8d38a 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py +++ b/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py @@ -617,6 +617,15 @@ async def _perform_request(): return _async_call(_perform_request()) + def test_basic_multiple(self): + # We need to create separate clients because in httpx >= 0.19, + # closing the client after "with" means the second http call fails + self.perform_request(self.URL, + client=self.create_client(self.transport)) + self.perform_request(self.URL, + client=self.create_client(self.transport)) + self.assert_span(num_spans=2) + class TestSyncInstrumentationIntegration(BaseTestCases.BaseInstrumentorTest): def create_client( @@ -664,3 +673,10 @@ async def _perform_request(): return await _client.request(method, url, headers=headers) return _async_call(_perform_request()) + + def test_basic_multiple(self): + # We need to create separate clients because in httpx >= 0.19, + # closing the client after "with" means the second http call fails + self.perform_request(self.URL, client=self.create_client()) + self.perform_request(self.URL, client=self.create_client()) + self.assert_span(num_spans=2)