From f997afa8bc1e6b1864983e69daaa5a5813a7e391 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Thu, 16 Nov 2023 17:03:05 +0100 Subject: [PATCH 01/26] Handling asgi body in the right way. For real --- sentry_sdk/integrations/django/__init__.py | 18 ++- sentry_sdk/integrations/django/asgi.py | 13 +- sentry_sdk/integrations/django/views.py | 6 +- tests/integrations/django/asgi/image.png | Bin 0 -> 308 bytes tests/integrations/django/asgi/test_asgi.py | 125 ++++++++++++++++++-- tests/integrations/django/myapp/views.py | 6 +- 6 files changed, 147 insertions(+), 21 deletions(-) create mode 100644 tests/integrations/django/asgi/image.png diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index 95f18d00ab..21e3330dd1 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -547,7 +547,23 @@ def cookies(self): def raw_data(self): # type: () -> bytes - return self.request.body + """Read the request body. we are extra careful here to not break the users code""" + if hasattr(self.request, "_sentry_body"): + data = self.request._sentry_body.read() + self.request._sentry_body.seek(0) + # del self.request._sentry_body + return data + + elif hasattr(self.request, "_body"): + # Try if we can the cached _body from Django + return self.request._body + + else: + # Try to read the request body directly + try: + return self.request.body + except OSError: + return b"" def form(self): # type: () -> QueryDict diff --git a/sentry_sdk/integrations/django/asgi.py b/sentry_sdk/integrations/django/asgi.py index bd785a23c2..0ee4e3f4e1 100644 --- a/sentry_sdk/integrations/django/asgi.py +++ b/sentry_sdk/integrations/django/asgi.py @@ -7,6 +7,7 @@ """ import asyncio +from copy import copy from django.core.handlers.wsgi import WSGIRequest @@ -95,10 +96,14 @@ def sentry_patched_create_request(self, *args, **kwargs): with hub.configure_scope() as scope: request, error_response = old_create_request(self, *args, **kwargs) - # read the body once, to signal Django to cache the body stream - # so we can read the body in our event processor - # (otherwise Django closes the body stream and makes it impossible to read it again) - _ = request.body + try: + # Make a copy of the body, so we can read it leater + # (Django since 4.1 closes the body stream after reading it) + request._sentry_body = copy(request._stream._file) + except TypeError: + # The body is a file, so we do not need it + # because we never collect uploaded files anyway + pass scope.add_event_processor(_make_asgi_request_event_processor(request)) diff --git a/sentry_sdk/integrations/django/views.py b/sentry_sdk/integrations/django/views.py index c1034d0d85..d918afad66 100644 --- a/sentry_sdk/integrations/django/views.py +++ b/sentry_sdk/integrations/django/views.py @@ -47,13 +47,13 @@ def sentry_patched_make_view_atomic(self, *args, **kwargs): hub = Hub.current integration = hub.get_integration(DjangoIntegration) - if integration is not None and integration.middleware_spans: - if ( + is_async_view = ( iscoroutinefunction is not None and wrap_async_view is not None and iscoroutinefunction(callback) - ): + ) + if is_async_view: sentry_wrapped_callback = wrap_async_view(hub, callback) else: sentry_wrapped_callback = _wrap_sync_view(hub, callback) diff --git a/tests/integrations/django/asgi/image.png b/tests/integrations/django/asgi/image.png new file mode 100644 index 0000000000000000000000000000000000000000..8db277a9fc653b30dd5f1598b353653b55454d6e GIT binary patch literal 308 zcmV-40n7f0P)@bR~YD@IZ1@1DmneO@gCFE1BE zW>PbR&BqN^3|IIJXwvg%uNnG*R@b#;GTgfP0Bm|{RtQ2NND;^cBU4R=$QUmMkUP64 z7BQ6O_W?C!Fh~KN0X7jN0kRI{u3I-AGN@_DgH1Cs)nZt&WIIq(F$3ex>ks}*N{KKu z)y`l@%?tsX1~R3oW(LEI`Lzs', + "", + ), + ( + True, + "POST", + [ + (b"content-type", b"multipart/form-data; boundary=fd721ef49ea403a6"), + (b"content-length", BODY_FORM_CONTENT_LENGTH), + ], + TEST_BODY_PATH, + BODY_FORM, + None, + ), + ( + False, + "POST", + [(b"content-type", b"text/plain")], + TEST_BODY_PATH, + b"", + None, + ), + ( + False, + "POST", + [(b"content-type", b"text/plain")], + TEST_BODY_PATH, + b"some raw text body", + "", + ), + ( + False, + "POST", + [(b"content-type", b"application/json")], + TEST_BODY_PATH, + b'{"username":"xyz","password":"xyz"}', + {"username": "xyz", "password": "[Filtered]"}, + ), + ( + False, + "POST", + [(b"content-type", b"application/xml")], + TEST_BODY_PATH, + b'', + "", + ), + ( + False, + "POST", + [ + (b"content-type", b"multipart/form-data; boundary=fd721ef49ea403a6"), + (b"content-length", BODY_FORM_CONTENT_LENGTH), + ], + TEST_BODY_PATH, + BODY_FORM, + None, + ), ], ) +@pytest.mark.parametrize("application", APPS) @pytest.mark.asyncio @pytest.mark.forked @pytest.mark.skipif( django.VERSION < (3, 1), reason="async views have been introduced in Django 3.1" ) async def test_asgi_request_body( - sentry_init, capture_envelopes, application, body, expected_return_data + sentry_init, + capture_envelopes, + application, + send_default_pii, + method, + headers, + path, + body, + expected_data, ): - sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) + sentry_init( + send_default_pii=send_default_pii, + integrations=[ + DjangoIntegration(), + ], + ) envelopes = capture_envelopes() comm = HttpCommunicator( application, - method="POST", + method=method, + headers=headers, path=reverse("post_echo_async"), body=body, - headers=[(b"content-type", b"application/json")], ) response = await comm.get_response() @@ -409,7 +514,7 @@ async def test_asgi_request_body( (envelope,) = envelopes event = envelope.get_event() - if expected_return_data is not None: - assert event["request"]["data"] == expected_return_data + if expected_data is not None: + assert event["request"]["data"] == expected_data else: assert "data" not in event["request"] diff --git a/tests/integrations/django/myapp/views.py b/tests/integrations/django/myapp/views.py index 6362adc121..08262b4e8a 100644 --- a/tests/integrations/django/myapp/views.py +++ b/tests/integrations/django/myapp/views.py @@ -237,10 +237,10 @@ def thread_ids_sync(*args, **kwargs): ) exec( - """@csrf_exempt -def post_echo_async(request): + """async def post_echo_async(request): sentry_sdk.capture_message("hi") - return HttpResponse(request.body)""" + return HttpResponse(request.body) +post_echo_async.csrf_exempt = True""" ) else: async_message = None From b5168629cd288c068acfa094bd16bde5eb931c86 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 08:48:38 +0100 Subject: [PATCH 02/26] Better url handling --- tests/integrations/django/asgi/test_asgi.py | 27 ++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 9bd1f8abf7..0bf7e55f81 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -372,7 +372,6 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e assert error_event["contexts"]["trace"]["trace_id"] == trace_id -TEST_BODY_PATH = reverse("post_echo_async") PICTURE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "image.png") BODY_FORM = """--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="username"\r\n\r\nJane\r\n--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="password"\r\n\r\nhello123\r\n--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="photo"; filename="photo.jpg"\r\nContent-Type: image/jpg\r\nContent-Transfer-Encoding: base64\r\n\r\n{{image_data}}\r\n--fd721ef49ea403a6--\r\n""".replace( "{{image_data}}", str(base64.b64encode(open(PICTURE, "rb").read())) @@ -383,13 +382,13 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e @pytest.mark.parametrize( - "send_default_pii,method,headers,path,body,expected_data", + "send_default_pii,method,headers,url_name,body,expected_data", [ ( True, "POST", [(b"content-type", b"text/plain")], - TEST_BODY_PATH, + "post_echo_async", b"", None, ), @@ -397,7 +396,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e True, "POST", [(b"content-type", b"text/plain")], - TEST_BODY_PATH, + "post_echo_async", b"some raw text body", "", ), @@ -405,7 +404,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e True, "POST", [(b"content-type", b"application/json")], - TEST_BODY_PATH, + "post_echo_async", b'{"username":"xyz","password":"xyz"}', {"username": "xyz", "password": "xyz"}, ), @@ -413,7 +412,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e True, "POST", [(b"content-type", b"application/xml")], - TEST_BODY_PATH, + "post_echo_async", b'', "", ), @@ -424,7 +423,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e (b"content-type", b"multipart/form-data; boundary=fd721ef49ea403a6"), (b"content-length", BODY_FORM_CONTENT_LENGTH), ], - TEST_BODY_PATH, + "post_echo_async", BODY_FORM, None, ), @@ -432,7 +431,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e False, "POST", [(b"content-type", b"text/plain")], - TEST_BODY_PATH, + "post_echo_async", b"", None, ), @@ -440,7 +439,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e False, "POST", [(b"content-type", b"text/plain")], - TEST_BODY_PATH, + "post_echo_async", b"some raw text body", "", ), @@ -448,7 +447,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e False, "POST", [(b"content-type", b"application/json")], - TEST_BODY_PATH, + "post_echo_async", b'{"username":"xyz","password":"xyz"}', {"username": "xyz", "password": "[Filtered]"}, ), @@ -456,7 +455,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e False, "POST", [(b"content-type", b"application/xml")], - TEST_BODY_PATH, + "post_echo_async", b'', "", ), @@ -467,7 +466,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e (b"content-type", b"multipart/form-data; boundary=fd721ef49ea403a6"), (b"content-length", BODY_FORM_CONTENT_LENGTH), ], - TEST_BODY_PATH, + "post_echo_async", BODY_FORM, None, ), @@ -486,7 +485,7 @@ async def test_asgi_request_body( send_default_pii, method, headers, - path, + url_name, body, expected_data, ): @@ -503,7 +502,7 @@ async def test_asgi_request_body( application, method=method, headers=headers, - path=reverse("post_echo_async"), + path=reverse(url_name), body=body, ) response = await comm.get_response() From aa47870fda94fafb21c59ad84d517fd99b124c0b Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 10:23:49 +0100 Subject: [PATCH 03/26] Better handling of body read --- sentry_sdk/integrations/_wsgi_common.py | 8 +++++++- sentry_sdk/integrations/django/__init__.py | 17 +---------------- sentry_sdk/integrations/django/asgi.py | 11 ----------- tests/integrations/django/asgi/test_asgi.py | 8 ++++---- 4 files changed, 12 insertions(+), 32 deletions(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index 585abe25de..ab10bb7b32 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -67,10 +67,16 @@ def extract_into_event(self, event): if not request_body_within_bounds(client, content_length): data = AnnotatedValue.removed_because_over_size_limit() else: + # First read the raw body data + # It is important to check this first because if it is Django + # it will cache the body and then we can read it + # over and over again in parsed_body() (or json() or wherever) below. + raw_data = self.raw_data() + parsed_body = self.parsed_body() if parsed_body is not None: data = parsed_body - elif self.raw_data(): + elif raw_data is not None: data = AnnotatedValue.removed_because_raw_data() else: data = None diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index 21e3330dd1..3f3c181b54 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -548,22 +548,7 @@ def cookies(self): def raw_data(self): # type: () -> bytes """Read the request body. we are extra careful here to not break the users code""" - if hasattr(self.request, "_sentry_body"): - data = self.request._sentry_body.read() - self.request._sentry_body.seek(0) - # del self.request._sentry_body - return data - - elif hasattr(self.request, "_body"): - # Try if we can the cached _body from Django - return self.request._body - - else: - # Try to read the request body directly - try: - return self.request.body - except OSError: - return b"" + return self.request.body def form(self): # type: () -> QueryDict diff --git a/sentry_sdk/integrations/django/asgi.py b/sentry_sdk/integrations/django/asgi.py index 0ee4e3f4e1..18f6a58811 100644 --- a/sentry_sdk/integrations/django/asgi.py +++ b/sentry_sdk/integrations/django/asgi.py @@ -7,7 +7,6 @@ """ import asyncio -from copy import copy from django.core.handlers.wsgi import WSGIRequest @@ -95,16 +94,6 @@ def sentry_patched_create_request(self, *args, **kwargs): with hub.configure_scope() as scope: request, error_response = old_create_request(self, *args, **kwargs) - - try: - # Make a copy of the body, so we can read it leater - # (Django since 4.1 closes the body stream after reading it) - request._sentry_body = copy(request._stream._file) - except TypeError: - # The body is a file, so we do not need it - # because we never collect uploaded files anyway - pass - scope.add_event_processor(_make_asgi_request_event_processor(request)) return request, error_response diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 0bf7e55f81..c989305e27 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -390,7 +390,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e [(b"content-type", b"text/plain")], "post_echo_async", b"", - None, + "", ), ( True, @@ -425,7 +425,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e ], "post_echo_async", BODY_FORM, - None, + {"password": "hello123", "photo": "", "username": "Jane"}, ), ( False, @@ -433,7 +433,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e [(b"content-type", b"text/plain")], "post_echo_async", b"", - None, + "", ), ( False, @@ -468,7 +468,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e ], "post_echo_async", BODY_FORM, - None, + {"password": "[Filtered]", "photo": "", "username": "Jane"}, ), ], ) From 543d79d4c016254f76f22f3648375cb7d738097f Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 10:26:14 +0100 Subject: [PATCH 04/26] Cleanup --- sentry_sdk/integrations/django/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sentry_sdk/integrations/django/__init__.py b/sentry_sdk/integrations/django/__init__.py index 3f3c181b54..95f18d00ab 100644 --- a/sentry_sdk/integrations/django/__init__.py +++ b/sentry_sdk/integrations/django/__init__.py @@ -547,7 +547,6 @@ def cookies(self): def raw_data(self): # type: () -> bytes - """Read the request body. we are extra careful here to not break the users code""" return self.request.body def form(self): From 44254bd52b76ff541698b5ade6a630a0f304ec6a Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 10:27:27 +0100 Subject: [PATCH 05/26] Cleanup --- sentry_sdk/integrations/_wsgi_common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index ab10bb7b32..dba49d2471 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -68,9 +68,9 @@ def extract_into_event(self, event): data = AnnotatedValue.removed_because_over_size_limit() else: # First read the raw body data - # It is important to check this first because if it is Django - # it will cache the body and then we can read it - # over and over again in parsed_body() (or json() or wherever) below. + # It is important to read this first because if it is Django + # it will cache the body and then we can read the cached version + # again in parsed_body() (or json() or wherever). raw_data = self.raw_data() parsed_body = self.parsed_body() From f4abc66ed5bf3615c37eb249813d4bd442a1701a Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 10:44:14 +0100 Subject: [PATCH 06/26] Fixed test --- sentry_sdk/integrations/_wsgi_common.py | 2 +- tests/integrations/django/asgi/test_asgi.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index dba49d2471..ab3817164d 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -76,7 +76,7 @@ def extract_into_event(self, event): parsed_body = self.parsed_body() if parsed_body is not None: data = parsed_body - elif raw_data is not None: + elif raw_data: data = AnnotatedValue.removed_because_raw_data() else: data = None diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index c989305e27..776c7eb3d2 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -390,7 +390,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e [(b"content-type", b"text/plain")], "post_echo_async", b"", - "", + None, ), ( True, @@ -433,7 +433,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e [(b"content-type", b"text/plain")], "post_echo_async", b"", - "", + None, ), ( False, From 7f4300ecc08ceb7383d46bf27da155acc8f966b2 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 11:31:05 +0100 Subject: [PATCH 07/26] Fixed bug with rest framework --- sentry_sdk/integrations/_wsgi_common.py | 11 ++++++++++- tests/integrations/django/test_basic.py | 12 ++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index ab3817164d..78dd4e6b22 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -7,6 +7,11 @@ from sentry_sdk._types import TYPE_CHECKING +try: + from rest_framework.request import Request as RestFrameworkRequest +except ImportError: + RestFrameworkRequest = None + if TYPE_CHECKING: import sentry_sdk @@ -71,7 +76,11 @@ def extract_into_event(self, event): # It is important to read this first because if it is Django # it will cache the body and then we can read the cached version # again in parsed_body() (or json() or wherever). - raw_data = self.raw_data() + # If DjangoRestFramework is used we do not need to + # read it upfront, because it will do it for us. + raw_data = None + if type(self.request) != RestFrameworkRequest: + raw_data = self.raw_data() parsed_body = self.parsed_body() if parsed_body is not None: diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index a323d8c922..e796e61370 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -833,15 +833,19 @@ def test_template_exception( @pytest.mark.parametrize( - "route", ["rest_framework_exc", "rest_framework_read_body_and_exc"] + "route", + [ + # "rest_framework_exc", + "rest_framework_read_body_and_exc", + ], ) @pytest.mark.parametrize( "ct,body", [ ["application/json", {"foo": "bar"}], - ["application/json", 1], - ["application/json", "foo"], - ["application/x-www-form-urlencoded", {"foo": "bar"}], + # ["application/json", 1], + # ["application/json", "foo"], + # ["application/x-www-form-urlencoded", {"foo": "bar"}], ], ) def test_rest_framework_basic( From 2bd5729fa9189e406241c6e55c46d63f8807ab0c Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 11:41:28 +0100 Subject: [PATCH 08/26] silence mypy --- sentry_sdk/integrations/_wsgi_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index 78dd4e6b22..41023735e3 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -8,7 +8,7 @@ from sentry_sdk._types import TYPE_CHECKING try: - from rest_framework.request import Request as RestFrameworkRequest + from rest_framework.request import Request as RestFrameworkRequest # type: ignore[import-not-found] except ImportError: RestFrameworkRequest = None From ff211b158bb627bb24b3759fd217f69dcf8495ac Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 14:34:12 +0100 Subject: [PATCH 09/26] Capture eventual errors caused by DjangoRestFramework (or our test setup) --- sentry_sdk/integrations/_wsgi_common.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index 41023735e3..900f910554 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -7,10 +7,6 @@ from sentry_sdk._types import TYPE_CHECKING -try: - from rest_framework.request import Request as RestFrameworkRequest # type: ignore[import-not-found] -except ImportError: - RestFrameworkRequest = None if TYPE_CHECKING: import sentry_sdk @@ -76,11 +72,13 @@ def extract_into_event(self, event): # It is important to read this first because if it is Django # it will cache the body and then we can read the cached version # again in parsed_body() (or json() or wherever). - # If DjangoRestFramework is used we do not need to - # read it upfront, because it will do it for us. raw_data = None - if type(self.request) != RestFrameworkRequest: + try: raw_data = self.raw_data() + except ValueError: + # If DjangoRestFramework is used it already read the body for us + # so reading it here will fail. We can ignore this. + pass parsed_body = self.parsed_body() if parsed_body is not None: From 93e1e70326f815a706fc633e2bf8fbd0ef7930b0 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 14:42:36 +0100 Subject: [PATCH 10/26] cleanup --- tests/integrations/django/test_basic.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index e796e61370..a323d8c922 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -833,19 +833,15 @@ def test_template_exception( @pytest.mark.parametrize( - "route", - [ - # "rest_framework_exc", - "rest_framework_read_body_and_exc", - ], + "route", ["rest_framework_exc", "rest_framework_read_body_and_exc"] ) @pytest.mark.parametrize( "ct,body", [ ["application/json", {"foo": "bar"}], - # ["application/json", 1], - # ["application/json", "foo"], - # ["application/x-www-form-urlencoded", {"foo": "bar"}], + ["application/json", 1], + ["application/json", "foo"], + ["application/x-www-form-urlencoded", {"foo": "bar"}], ], ) def test_rest_framework_basic( From c64ebcdfc70d3919e2158e8acbe1bf4ae1e5545c Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 14:46:52 +0100 Subject: [PATCH 11/26] Except more specific error --- sentry_sdk/integrations/_wsgi_common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index 900f910554..204137e27e 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -7,6 +7,11 @@ from sentry_sdk._types import TYPE_CHECKING +try: + from django.http.request import RawPostDataException # type: ignore +except ImportError: + RawPostDataException = Exception + if TYPE_CHECKING: import sentry_sdk @@ -75,7 +80,7 @@ def extract_into_event(self, event): raw_data = None try: raw_data = self.raw_data() - except ValueError: + except (RawPostDataException, ValueError): # If DjangoRestFramework is used it already read the body for us # so reading it here will fail. We can ignore this. pass From 6f437336df79b0d826c089f7c3c0ce9327002363 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 14:47:53 +0100 Subject: [PATCH 12/26] Fix --- sentry_sdk/integrations/_wsgi_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index 204137e27e..bca2251bd8 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -10,7 +10,7 @@ try: from django.http.request import RawPostDataException # type: ignore except ImportError: - RawPostDataException = Exception + RawPostDataException = None if TYPE_CHECKING: From b5d4594d78dd51a71b976bea43998b2cca2d9d83 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 14:52:36 +0100 Subject: [PATCH 13/26] fixe typing ignore --- sentry_sdk/integrations/_wsgi_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index bca2251bd8..2bdab84a7b 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -8,7 +8,7 @@ from sentry_sdk._types import TYPE_CHECKING try: - from django.http.request import RawPostDataException # type: ignore + from django.http.request import RawPostDataException # type: ignore[import-not-found] except ImportError: RawPostDataException = None From d6ecf29737568505c1d3eb7c0a4c758f8d705565 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 14:55:19 +0100 Subject: [PATCH 14/26] Remove type ignore --- sentry_sdk/integrations/_wsgi_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index 2bdab84a7b..e2a83416d9 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -8,7 +8,7 @@ from sentry_sdk._types import TYPE_CHECKING try: - from django.http.request import RawPostDataException # type: ignore[import-not-found] + from django.http.request import RawPostDataException except ImportError: RawPostDataException = None From efe3b3261e65f0b4ebe896a8c564fbc7e8c92bdf Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 17 Nov 2023 15:34:03 +0100 Subject: [PATCH 15/26] Make it work in Python 2.7 --- sentry_sdk/integrations/_wsgi_common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sentry_sdk/integrations/_wsgi_common.py b/sentry_sdk/integrations/_wsgi_common.py index e2a83416d9..5a41654498 100644 --- a/sentry_sdk/integrations/_wsgi_common.py +++ b/sentry_sdk/integrations/_wsgi_common.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + import json from copy import deepcopy From 3762a1922b78d3eeb1f71c4c229c4605894247f3 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 08:42:14 +0100 Subject: [PATCH 16/26] Increased test timeout --- scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt | 2 +- scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt index 94723c1658..bade2ce995 100644 --- a/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt +++ b/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt @@ -15,7 +15,7 @@ - name: Test {{ framework }} uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt index c2d10596ea..888768fc8a 100644 --- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt +++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt @@ -20,7 +20,7 @@ - name: Test {{ framework }} uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash From 4edbf0fca0e12c5924f48f82cc427f4c34f7f0ad Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 08:48:43 +0100 Subject: [PATCH 17/26] Update test matrix --- .github/workflows/test-common.yml | 4 ++-- .github/workflows/test-integration-aiohttp.yml | 2 +- .github/workflows/test-integration-ariadne.yml | 2 +- .github/workflows/test-integration-arq.yml | 2 +- .github/workflows/test-integration-asgi.yml | 2 +- .github/workflows/test-integration-asyncpg.yml | 2 +- .github/workflows/test-integration-aws_lambda.yml | 2 +- .github/workflows/test-integration-beam.yml | 2 +- .github/workflows/test-integration-boto3.yml | 4 ++-- .github/workflows/test-integration-bottle.yml | 4 ++-- .github/workflows/test-integration-celery.yml | 4 ++-- .github/workflows/test-integration-chalice.yml | 2 +- .github/workflows/test-integration-clickhouse_driver.yml | 2 +- .github/workflows/test-integration-cloud_resource_context.yml | 2 +- .github/workflows/test-integration-django.yml | 4 ++-- .github/workflows/test-integration-falcon.yml | 4 ++-- .github/workflows/test-integration-fastapi.yml | 2 +- .github/workflows/test-integration-flask.yml | 4 ++-- .github/workflows/test-integration-gcp.yml | 2 +- .github/workflows/test-integration-gevent.yml | 4 ++-- .github/workflows/test-integration-gql.yml | 2 +- .github/workflows/test-integration-graphene.yml | 2 +- .github/workflows/test-integration-grpc.yml | 2 +- .github/workflows/test-integration-httpx.yml | 2 +- .github/workflows/test-integration-huey.yml | 4 ++-- .github/workflows/test-integration-loguru.yml | 2 +- .github/workflows/test-integration-opentelemetry.yml | 2 +- .github/workflows/test-integration-pure_eval.yml | 2 +- .github/workflows/test-integration-pymongo.yml | 4 ++-- .github/workflows/test-integration-pyramid.yml | 4 ++-- .github/workflows/test-integration-quart.yml | 2 +- .github/workflows/test-integration-redis.yml | 4 ++-- .github/workflows/test-integration-rediscluster.yml | 4 ++-- .github/workflows/test-integration-requests.yml | 4 ++-- .github/workflows/test-integration-rq.yml | 4 ++-- .github/workflows/test-integration-sanic.yml | 2 +- .github/workflows/test-integration-sqlalchemy.yml | 4 ++-- .github/workflows/test-integration-starlette.yml | 2 +- .github/workflows/test-integration-starlite.yml | 2 +- .github/workflows/test-integration-strawberry.yml | 2 +- .github/workflows/test-integration-tornado.yml | 2 +- .github/workflows/test-integration-trytond.yml | 2 +- 42 files changed, 58 insertions(+), 58 deletions(-) diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml index 7204c5d7d7..77b4e79cb1 100644 --- a/.github/workflows/test-common.yml +++ b/.github/workflows/test-common.yml @@ -51,7 +51,7 @@ jobs: - name: Test common uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test common uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml index f70d652f2e..c30226a292 100644 --- a/.github/workflows/test-integration-aiohttp.yml +++ b/.github/workflows/test-integration-aiohttp.yml @@ -51,7 +51,7 @@ jobs: - name: Test aiohttp uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml index 38e0d8271b..328017fbe9 100644 --- a/.github/workflows/test-integration-ariadne.yml +++ b/.github/workflows/test-integration-ariadne.yml @@ -51,7 +51,7 @@ jobs: - name: Test ariadne uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml index 614e53f390..e66198e328 100644 --- a/.github/workflows/test-integration-arq.yml +++ b/.github/workflows/test-integration-arq.yml @@ -51,7 +51,7 @@ jobs: - name: Test arq uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml index 9a29398fc2..a5dd2a49ae 100644 --- a/.github/workflows/test-integration-asgi.yml +++ b/.github/workflows/test-integration-asgi.yml @@ -51,7 +51,7 @@ jobs: - name: Test asgi uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml index 4b2ed26671..06b2538619 100644 --- a/.github/workflows/test-integration-asyncpg.yml +++ b/.github/workflows/test-integration-asyncpg.yml @@ -72,7 +72,7 @@ jobs: - name: Test asyncpg uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml index 385bb4b13a..5538d3e3a8 100644 --- a/.github/workflows/test-integration-aws_lambda.yml +++ b/.github/workflows/test-integration-aws_lambda.yml @@ -53,7 +53,7 @@ jobs: - name: Test aws_lambda uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml index a86d6ccd7d..3a73a78b8b 100644 --- a/.github/workflows/test-integration-beam.yml +++ b/.github/workflows/test-integration-beam.yml @@ -51,7 +51,7 @@ jobs: - name: Test beam uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml index fb246c899e..86a06357d1 100644 --- a/.github/workflows/test-integration-boto3.yml +++ b/.github/workflows/test-integration-boto3.yml @@ -51,7 +51,7 @@ jobs: - name: Test boto3 uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test boto3 uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml index 5bbdcaac53..9a40ecda67 100644 --- a/.github/workflows/test-integration-bottle.yml +++ b/.github/workflows/test-integration-bottle.yml @@ -51,7 +51,7 @@ jobs: - name: Test bottle uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test bottle uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml index 71623f0e1e..789c81053c 100644 --- a/.github/workflows/test-integration-celery.yml +++ b/.github/workflows/test-integration-celery.yml @@ -51,7 +51,7 @@ jobs: - name: Test celery uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test celery uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml index 6615aeb75d..fe9d0f05de 100644 --- a/.github/workflows/test-integration-chalice.yml +++ b/.github/workflows/test-integration-chalice.yml @@ -51,7 +51,7 @@ jobs: - name: Test chalice uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml index 30561ab5a1..d8b1595d49 100644 --- a/.github/workflows/test-integration-clickhouse_driver.yml +++ b/.github/workflows/test-integration-clickhouse_driver.yml @@ -53,7 +53,7 @@ jobs: - name: Test clickhouse_driver uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml index f6140d823c..bcab4c920e 100644 --- a/.github/workflows/test-integration-cloud_resource_context.yml +++ b/.github/workflows/test-integration-cloud_resource_context.yml @@ -51,7 +51,7 @@ jobs: - name: Test cloud_resource_context uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml index 819fb70f1a..9cef4acf6c 100644 --- a/.github/workflows/test-integration-django.yml +++ b/.github/workflows/test-integration-django.yml @@ -72,7 +72,7 @@ jobs: - name: Test django uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -125,7 +125,7 @@ jobs: - name: Test django uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml index 09d8ff8d80..7ff3dcd663 100644 --- a/.github/workflows/test-integration-falcon.yml +++ b/.github/workflows/test-integration-falcon.yml @@ -51,7 +51,7 @@ jobs: - name: Test falcon uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test falcon uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml index 0a330b1401..b2edd9309c 100644 --- a/.github/workflows/test-integration-fastapi.yml +++ b/.github/workflows/test-integration-fastapi.yml @@ -51,7 +51,7 @@ jobs: - name: Test fastapi uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml index d716df171d..078d75cfb3 100644 --- a/.github/workflows/test-integration-flask.yml +++ b/.github/workflows/test-integration-flask.yml @@ -51,7 +51,7 @@ jobs: - name: Test flask uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test flask uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml index c6eb4adcc8..0fd12a84a9 100644 --- a/.github/workflows/test-integration-gcp.yml +++ b/.github/workflows/test-integration-gcp.yml @@ -51,7 +51,7 @@ jobs: - name: Test gcp uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml index d879f5c2f5..aabb859fa9 100644 --- a/.github/workflows/test-integration-gevent.yml +++ b/.github/workflows/test-integration-gevent.yml @@ -51,7 +51,7 @@ jobs: - name: Test gevent uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test gevent uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml index 9ebd5a16b7..1337e74871 100644 --- a/.github/workflows/test-integration-gql.yml +++ b/.github/workflows/test-integration-gql.yml @@ -51,7 +51,7 @@ jobs: - name: Test gql uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml index 5236731eb0..22f464114c 100644 --- a/.github/workflows/test-integration-graphene.yml +++ b/.github/workflows/test-integration-graphene.yml @@ -51,7 +51,7 @@ jobs: - name: Test graphene uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml index 0e4f48d423..c3a57298fc 100644 --- a/.github/workflows/test-integration-grpc.yml +++ b/.github/workflows/test-integration-grpc.yml @@ -51,7 +51,7 @@ jobs: - name: Test grpc uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml index 3c67d2370c..9836dedb2d 100644 --- a/.github/workflows/test-integration-httpx.yml +++ b/.github/workflows/test-integration-httpx.yml @@ -51,7 +51,7 @@ jobs: - name: Test httpx uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml index db6c5fcbc4..5555bf7d3d 100644 --- a/.github/workflows/test-integration-huey.yml +++ b/.github/workflows/test-integration-huey.yml @@ -51,7 +51,7 @@ jobs: - name: Test huey uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test huey uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml index 885b1534f4..3a62cbc7ac 100644 --- a/.github/workflows/test-integration-loguru.yml +++ b/.github/workflows/test-integration-loguru.yml @@ -51,7 +51,7 @@ jobs: - name: Test loguru uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml index 5e2722ed49..ae28f86d24 100644 --- a/.github/workflows/test-integration-opentelemetry.yml +++ b/.github/workflows/test-integration-opentelemetry.yml @@ -51,7 +51,7 @@ jobs: - name: Test opentelemetry uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml index 30b5f8cc1b..17dfc5c549 100644 --- a/.github/workflows/test-integration-pure_eval.yml +++ b/.github/workflows/test-integration-pure_eval.yml @@ -51,7 +51,7 @@ jobs: - name: Test pure_eval uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml index 2a3d7697f2..0963a09f82 100644 --- a/.github/workflows/test-integration-pymongo.yml +++ b/.github/workflows/test-integration-pymongo.yml @@ -51,7 +51,7 @@ jobs: - name: Test pymongo uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test pymongo uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml index 7a4b327b3f..1757833543 100644 --- a/.github/workflows/test-integration-pyramid.yml +++ b/.github/workflows/test-integration-pyramid.yml @@ -51,7 +51,7 @@ jobs: - name: Test pyramid uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test pyramid uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml index 838683cf9c..8aef8a2fcd 100644 --- a/.github/workflows/test-integration-quart.yml +++ b/.github/workflows/test-integration-quart.yml @@ -51,7 +51,7 @@ jobs: - name: Test quart uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml index 54ad9abe2a..13909d4b4d 100644 --- a/.github/workflows/test-integration-redis.yml +++ b/.github/workflows/test-integration-redis.yml @@ -51,7 +51,7 @@ jobs: - name: Test redis uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test redis uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml index 73ed5c1733..6cf269ab5b 100644 --- a/.github/workflows/test-integration-rediscluster.yml +++ b/.github/workflows/test-integration-rediscluster.yml @@ -51,7 +51,7 @@ jobs: - name: Test rediscluster uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test rediscluster uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml index bc8e4a990c..e6be34eb72 100644 --- a/.github/workflows/test-integration-requests.yml +++ b/.github/workflows/test-integration-requests.yml @@ -51,7 +51,7 @@ jobs: - name: Test requests uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test requests uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml index b0812c36e6..b07a72c104 100644 --- a/.github/workflows/test-integration-rq.yml +++ b/.github/workflows/test-integration-rq.yml @@ -51,7 +51,7 @@ jobs: - name: Test rq uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test rq uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml index 27ca05eb6a..5340a53ea2 100644 --- a/.github/workflows/test-integration-sanic.yml +++ b/.github/workflows/test-integration-sanic.yml @@ -51,7 +51,7 @@ jobs: - name: Test sanic uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml index 70cbb7ff79..fd19083482 100644 --- a/.github/workflows/test-integration-sqlalchemy.yml +++ b/.github/workflows/test-integration-sqlalchemy.yml @@ -51,7 +51,7 @@ jobs: - name: Test sqlalchemy uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test sqlalchemy uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml index ad3e269075..d398719d71 100644 --- a/.github/workflows/test-integration-starlette.yml +++ b/.github/workflows/test-integration-starlette.yml @@ -51,7 +51,7 @@ jobs: - name: Test starlette uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml index 01715e1c66..3e2ef2b556 100644 --- a/.github/workflows/test-integration-starlite.yml +++ b/.github/workflows/test-integration-starlite.yml @@ -51,7 +51,7 @@ jobs: - name: Test starlite uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml index 16b42ec2a2..4d63fd70ba 100644 --- a/.github/workflows/test-integration-strawberry.yml +++ b/.github/workflows/test-integration-strawberry.yml @@ -51,7 +51,7 @@ jobs: - name: Test strawberry uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml index c9ccec4f38..fcad1e23b4 100644 --- a/.github/workflows/test-integration-tornado.yml +++ b/.github/workflows/test-integration-tornado.yml @@ -51,7 +51,7 @@ jobs: - name: Test tornado uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml index 137cec7ef4..ec831756f1 100644 --- a/.github/workflows/test-integration-trytond.yml +++ b/.github/workflows/test-integration-trytond.yml @@ -51,7 +51,7 @@ jobs: - name: Test trytond uses: nick-fields/retry@v2 with: - timeout_minutes: 15 + timeout_minutes: 20 max_attempts: 2 retry_wait_seconds: 5 shell: bash From 3a1f15a9a2a3f36263b827e9fec5367d7f1c3c3c Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 09:00:52 +0100 Subject: [PATCH 18/26] is_coroutine_function was removed from quart, taking from asyncio directly --- sentry_sdk/integrations/quart.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/integrations/quart.py b/sentry_sdk/integrations/quart.py index 38420ec795..31e1211257 100644 --- a/sentry_sdk/integrations/quart.py +++ b/sentry_sdk/integrations/quart.py @@ -1,5 +1,6 @@ from __future__ import absolute_import +import asyncio import inspect import threading @@ -45,7 +46,6 @@ request_started, websocket_started, ) - from quart.utils import is_coroutine_function # type: ignore except ImportError: raise DidNotEnable("Quart is not installed") else: @@ -113,7 +113,9 @@ def _sentry_route(*args, **kwargs): def decorator(old_func): # type: (Any) -> Any - if inspect.isfunction(old_func) and not is_coroutine_function(old_func): + if inspect.isfunction(old_func) and not asyncio.is_coroutine_function( + old_func + ): @wraps(old_func) def _sentry_func(*args, **kwargs): From ba68dc9599cd22dc030163b598351657278d76c3 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 09:11:10 +0100 Subject: [PATCH 19/26] fix --- sentry_sdk/integrations/quart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/quart.py b/sentry_sdk/integrations/quart.py index 31e1211257..4dee751d65 100644 --- a/sentry_sdk/integrations/quart.py +++ b/sentry_sdk/integrations/quart.py @@ -113,7 +113,7 @@ def _sentry_route(*args, **kwargs): def decorator(old_func): # type: (Any) -> Any - if inspect.isfunction(old_func) and not asyncio.is_coroutine_function( + if inspect.isfunction(old_func) and not asyncio.iscoroutinefunction( old_func ): From aa9718d5eaebc3c294ed8df6e3cd4f29674c5f37 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 09:57:09 +0100 Subject: [PATCH 20/26] trying something --- tests/integrations/django/asgi/test_asgi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 776c7eb3d2..98a126a679 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -506,8 +506,9 @@ async def test_asgi_request_body( body=body, ) response = await comm.get_response() - assert response["status"] == 200 + + await comm.wait() assert response["body"] == body (envelope,) = envelopes From a02aade43225e137311b4f2512132b87c25f1a99 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 10:58:16 +0100 Subject: [PATCH 21/26] It is not a timeout problem --- .github/workflows/test-common.yml | 4 +- .../workflows/test-integration-aiohttp.yml | 2 +- .../workflows/test-integration-ariadne.yml | 2 +- .github/workflows/test-integration-arq.yml | 2 +- .github/workflows/test-integration-asgi.yml | 2 +- .../workflows/test-integration-asyncpg.yml | 2 +- .../workflows/test-integration-aws_lambda.yml | 2 +- .github/workflows/test-integration-beam.yml | 2 +- .github/workflows/test-integration-boto3.yml | 4 +- .github/workflows/test-integration-bottle.yml | 4 +- .github/workflows/test-integration-celery.yml | 4 +- .../workflows/test-integration-chalice.yml | 2 +- .../test-integration-clickhouse_driver.yml | 2 +- ...est-integration-cloud_resource_context.yml | 2 +- .github/workflows/test-integration-django.yml | 4 +- .github/workflows/test-integration-falcon.yml | 4 +- .../workflows/test-integration-fastapi.yml | 2 +- .github/workflows/test-integration-flask.yml | 4 +- .github/workflows/test-integration-gcp.yml | 2 +- .github/workflows/test-integration-gevent.yml | 4 +- .github/workflows/test-integration-gql.yml | 2 +- .../workflows/test-integration-graphene.yml | 2 +- .github/workflows/test-integration-grpc.yml | 2 +- .github/workflows/test-integration-httpx.yml | 2 +- .github/workflows/test-integration-huey.yml | 4 +- .github/workflows/test-integration-loguru.yml | 2 +- .../test-integration-opentelemetry.yml | 2 +- .../workflows/test-integration-pure_eval.yml | 2 +- .../workflows/test-integration-pymongo.yml | 4 +- .../workflows/test-integration-pyramid.yml | 4 +- .github/workflows/test-integration-quart.yml | 2 +- .github/workflows/test-integration-redis.yml | 4 +- .../test-integration-rediscluster.yml | 4 +- .../workflows/test-integration-requests.yml | 4 +- .github/workflows/test-integration-rq.yml | 4 +- .github/workflows/test-integration-sanic.yml | 2 +- .../workflows/test-integration-sqlalchemy.yml | 4 +- .../workflows/test-integration-starlette.yml | 2 +- .../workflows/test-integration-starlite.yml | 2 +- .../workflows/test-integration-strawberry.yml | 2 +- .../workflows/test-integration-tornado.yml | 2 +- .../workflows/test-integration-trytond.yml | 2 +- .../ci-yaml-test-py27-snippet.txt | 2 +- .../ci-yaml-test-snippet.txt | 2 +- tests/integrations/django/asgi/test_asgi.py | 69 ++++++++++--------- 45 files changed, 96 insertions(+), 93 deletions(-) diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml index 77b4e79cb1..7204c5d7d7 100644 --- a/.github/workflows/test-common.yml +++ b/.github/workflows/test-common.yml @@ -51,7 +51,7 @@ jobs: - name: Test common uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test common uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml index c30226a292..f70d652f2e 100644 --- a/.github/workflows/test-integration-aiohttp.yml +++ b/.github/workflows/test-integration-aiohttp.yml @@ -51,7 +51,7 @@ jobs: - name: Test aiohttp uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml index 328017fbe9..38e0d8271b 100644 --- a/.github/workflows/test-integration-ariadne.yml +++ b/.github/workflows/test-integration-ariadne.yml @@ -51,7 +51,7 @@ jobs: - name: Test ariadne uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml index e66198e328..614e53f390 100644 --- a/.github/workflows/test-integration-arq.yml +++ b/.github/workflows/test-integration-arq.yml @@ -51,7 +51,7 @@ jobs: - name: Test arq uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml index a5dd2a49ae..9a29398fc2 100644 --- a/.github/workflows/test-integration-asgi.yml +++ b/.github/workflows/test-integration-asgi.yml @@ -51,7 +51,7 @@ jobs: - name: Test asgi uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml index 06b2538619..4b2ed26671 100644 --- a/.github/workflows/test-integration-asyncpg.yml +++ b/.github/workflows/test-integration-asyncpg.yml @@ -72,7 +72,7 @@ jobs: - name: Test asyncpg uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml index 5538d3e3a8..385bb4b13a 100644 --- a/.github/workflows/test-integration-aws_lambda.yml +++ b/.github/workflows/test-integration-aws_lambda.yml @@ -53,7 +53,7 @@ jobs: - name: Test aws_lambda uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml index 3a73a78b8b..a86d6ccd7d 100644 --- a/.github/workflows/test-integration-beam.yml +++ b/.github/workflows/test-integration-beam.yml @@ -51,7 +51,7 @@ jobs: - name: Test beam uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml index 86a06357d1..fb246c899e 100644 --- a/.github/workflows/test-integration-boto3.yml +++ b/.github/workflows/test-integration-boto3.yml @@ -51,7 +51,7 @@ jobs: - name: Test boto3 uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test boto3 uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml index 9a40ecda67..5bbdcaac53 100644 --- a/.github/workflows/test-integration-bottle.yml +++ b/.github/workflows/test-integration-bottle.yml @@ -51,7 +51,7 @@ jobs: - name: Test bottle uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test bottle uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml index 789c81053c..71623f0e1e 100644 --- a/.github/workflows/test-integration-celery.yml +++ b/.github/workflows/test-integration-celery.yml @@ -51,7 +51,7 @@ jobs: - name: Test celery uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test celery uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml index fe9d0f05de..6615aeb75d 100644 --- a/.github/workflows/test-integration-chalice.yml +++ b/.github/workflows/test-integration-chalice.yml @@ -51,7 +51,7 @@ jobs: - name: Test chalice uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml index d8b1595d49..30561ab5a1 100644 --- a/.github/workflows/test-integration-clickhouse_driver.yml +++ b/.github/workflows/test-integration-clickhouse_driver.yml @@ -53,7 +53,7 @@ jobs: - name: Test clickhouse_driver uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml index bcab4c920e..f6140d823c 100644 --- a/.github/workflows/test-integration-cloud_resource_context.yml +++ b/.github/workflows/test-integration-cloud_resource_context.yml @@ -51,7 +51,7 @@ jobs: - name: Test cloud_resource_context uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml index 9cef4acf6c..819fb70f1a 100644 --- a/.github/workflows/test-integration-django.yml +++ b/.github/workflows/test-integration-django.yml @@ -72,7 +72,7 @@ jobs: - name: Test django uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -125,7 +125,7 @@ jobs: - name: Test django uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml index 7ff3dcd663..09d8ff8d80 100644 --- a/.github/workflows/test-integration-falcon.yml +++ b/.github/workflows/test-integration-falcon.yml @@ -51,7 +51,7 @@ jobs: - name: Test falcon uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test falcon uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml index b2edd9309c..0a330b1401 100644 --- a/.github/workflows/test-integration-fastapi.yml +++ b/.github/workflows/test-integration-fastapi.yml @@ -51,7 +51,7 @@ jobs: - name: Test fastapi uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml index 078d75cfb3..d716df171d 100644 --- a/.github/workflows/test-integration-flask.yml +++ b/.github/workflows/test-integration-flask.yml @@ -51,7 +51,7 @@ jobs: - name: Test flask uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test flask uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml index 0fd12a84a9..c6eb4adcc8 100644 --- a/.github/workflows/test-integration-gcp.yml +++ b/.github/workflows/test-integration-gcp.yml @@ -51,7 +51,7 @@ jobs: - name: Test gcp uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml index aabb859fa9..d879f5c2f5 100644 --- a/.github/workflows/test-integration-gevent.yml +++ b/.github/workflows/test-integration-gevent.yml @@ -51,7 +51,7 @@ jobs: - name: Test gevent uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test gevent uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml index 1337e74871..9ebd5a16b7 100644 --- a/.github/workflows/test-integration-gql.yml +++ b/.github/workflows/test-integration-gql.yml @@ -51,7 +51,7 @@ jobs: - name: Test gql uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml index 22f464114c..5236731eb0 100644 --- a/.github/workflows/test-integration-graphene.yml +++ b/.github/workflows/test-integration-graphene.yml @@ -51,7 +51,7 @@ jobs: - name: Test graphene uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml index c3a57298fc..0e4f48d423 100644 --- a/.github/workflows/test-integration-grpc.yml +++ b/.github/workflows/test-integration-grpc.yml @@ -51,7 +51,7 @@ jobs: - name: Test grpc uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml index 9836dedb2d..3c67d2370c 100644 --- a/.github/workflows/test-integration-httpx.yml +++ b/.github/workflows/test-integration-httpx.yml @@ -51,7 +51,7 @@ jobs: - name: Test httpx uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml index 5555bf7d3d..db6c5fcbc4 100644 --- a/.github/workflows/test-integration-huey.yml +++ b/.github/workflows/test-integration-huey.yml @@ -51,7 +51,7 @@ jobs: - name: Test huey uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test huey uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml index 3a62cbc7ac..885b1534f4 100644 --- a/.github/workflows/test-integration-loguru.yml +++ b/.github/workflows/test-integration-loguru.yml @@ -51,7 +51,7 @@ jobs: - name: Test loguru uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml index ae28f86d24..5e2722ed49 100644 --- a/.github/workflows/test-integration-opentelemetry.yml +++ b/.github/workflows/test-integration-opentelemetry.yml @@ -51,7 +51,7 @@ jobs: - name: Test opentelemetry uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml index 17dfc5c549..30b5f8cc1b 100644 --- a/.github/workflows/test-integration-pure_eval.yml +++ b/.github/workflows/test-integration-pure_eval.yml @@ -51,7 +51,7 @@ jobs: - name: Test pure_eval uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml index 0963a09f82..2a3d7697f2 100644 --- a/.github/workflows/test-integration-pymongo.yml +++ b/.github/workflows/test-integration-pymongo.yml @@ -51,7 +51,7 @@ jobs: - name: Test pymongo uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test pymongo uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml index 1757833543..7a4b327b3f 100644 --- a/.github/workflows/test-integration-pyramid.yml +++ b/.github/workflows/test-integration-pyramid.yml @@ -51,7 +51,7 @@ jobs: - name: Test pyramid uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test pyramid uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml index 8aef8a2fcd..838683cf9c 100644 --- a/.github/workflows/test-integration-quart.yml +++ b/.github/workflows/test-integration-quart.yml @@ -51,7 +51,7 @@ jobs: - name: Test quart uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml index 13909d4b4d..54ad9abe2a 100644 --- a/.github/workflows/test-integration-redis.yml +++ b/.github/workflows/test-integration-redis.yml @@ -51,7 +51,7 @@ jobs: - name: Test redis uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test redis uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml index 6cf269ab5b..73ed5c1733 100644 --- a/.github/workflows/test-integration-rediscluster.yml +++ b/.github/workflows/test-integration-rediscluster.yml @@ -51,7 +51,7 @@ jobs: - name: Test rediscluster uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test rediscluster uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml index e6be34eb72..bc8e4a990c 100644 --- a/.github/workflows/test-integration-requests.yml +++ b/.github/workflows/test-integration-requests.yml @@ -51,7 +51,7 @@ jobs: - name: Test requests uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test requests uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml index b07a72c104..b0812c36e6 100644 --- a/.github/workflows/test-integration-rq.yml +++ b/.github/workflows/test-integration-rq.yml @@ -51,7 +51,7 @@ jobs: - name: Test rq uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test rq uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml index 5340a53ea2..27ca05eb6a 100644 --- a/.github/workflows/test-integration-sanic.yml +++ b/.github/workflows/test-integration-sanic.yml @@ -51,7 +51,7 @@ jobs: - name: Test sanic uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml index fd19083482..70cbb7ff79 100644 --- a/.github/workflows/test-integration-sqlalchemy.yml +++ b/.github/workflows/test-integration-sqlalchemy.yml @@ -51,7 +51,7 @@ jobs: - name: Test sqlalchemy uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash @@ -85,7 +85,7 @@ jobs: - name: Test sqlalchemy uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml index d398719d71..ad3e269075 100644 --- a/.github/workflows/test-integration-starlette.yml +++ b/.github/workflows/test-integration-starlette.yml @@ -51,7 +51,7 @@ jobs: - name: Test starlette uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml index 3e2ef2b556..01715e1c66 100644 --- a/.github/workflows/test-integration-starlite.yml +++ b/.github/workflows/test-integration-starlite.yml @@ -51,7 +51,7 @@ jobs: - name: Test starlite uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml index 4d63fd70ba..16b42ec2a2 100644 --- a/.github/workflows/test-integration-strawberry.yml +++ b/.github/workflows/test-integration-strawberry.yml @@ -51,7 +51,7 @@ jobs: - name: Test strawberry uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml index fcad1e23b4..c9ccec4f38 100644 --- a/.github/workflows/test-integration-tornado.yml +++ b/.github/workflows/test-integration-tornado.yml @@ -51,7 +51,7 @@ jobs: - name: Test tornado uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml index ec831756f1..137cec7ef4 100644 --- a/.github/workflows/test-integration-trytond.yml +++ b/.github/workflows/test-integration-trytond.yml @@ -51,7 +51,7 @@ jobs: - name: Test trytond uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt index bade2ce995..94723c1658 100644 --- a/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt +++ b/scripts/split-tox-gh-actions/ci-yaml-test-py27-snippet.txt @@ -15,7 +15,7 @@ - name: Test {{ framework }} uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt index 888768fc8a..c2d10596ea 100644 --- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt +++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt @@ -20,7 +20,7 @@ - name: Test {{ framework }} uses: nick-fields/retry@v2 with: - timeout_minutes: 20 + timeout_minutes: 15 max_attempts: 2 retry_wait_seconds: 5 shell: bash diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 98a126a679..7d5403f96e 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -384,38 +384,38 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e @pytest.mark.parametrize( "send_default_pii,method,headers,url_name,body,expected_data", [ - ( - True, - "POST", - [(b"content-type", b"text/plain")], - "post_echo_async", - b"", - None, - ), - ( - True, - "POST", - [(b"content-type", b"text/plain")], - "post_echo_async", - b"some raw text body", - "", - ), - ( - True, - "POST", - [(b"content-type", b"application/json")], - "post_echo_async", - b'{"username":"xyz","password":"xyz"}', - {"username": "xyz", "password": "xyz"}, - ), - ( - True, - "POST", - [(b"content-type", b"application/xml")], - "post_echo_async", - b'', - "", - ), + # ( + # True, + # "POST", + # [(b"content-type", b"text/plain")], + # "post_echo_async", + # b"", + # None, + # ), + # ( + # True, + # "POST", + # [(b"content-type", b"text/plain")], + # "post_echo_async", + # b"some raw text body", + # "", + # ), + # ( + # True, + # "POST", + # [(b"content-type", b"application/json")], + # "post_echo_async", + # b'{"username":"xyz","password":"xyz"}', + # {"username": "xyz", "password": "xyz"}, + # ), + # ( + # True, + # "POST", + # [(b"content-type", b"application/xml")], + # "post_echo_async", + # b'', + # "", + # ), ( True, "POST", @@ -474,7 +474,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e ) @pytest.mark.parametrize("application", APPS) @pytest.mark.asyncio -@pytest.mark.forked +# @pytest.mark.forked @pytest.mark.skipif( django.VERSION < (3, 1), reason="async views have been introduced in Django 3.1" ) @@ -496,6 +496,9 @@ async def test_asgi_request_body( ], ) + import ipdb + + ipdb.set_trace() envelopes = capture_envelopes() comm = HttpCommunicator( From 538feac55bfbdcf9eff3d003d3d8a9b6e5f62515 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 10:59:19 +0100 Subject: [PATCH 22/26] hopalla --- tests/integrations/django/asgi/test_asgi.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 7d5403f96e..e9409b103f 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -496,9 +496,6 @@ async def test_asgi_request_body( ], ) - import ipdb - - ipdb.set_trace() envelopes = capture_envelopes() comm = HttpCommunicator( From ea3a4b31b9c479b1290b9cd23db7ccf63471fba9 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 11:00:24 +0100 Subject: [PATCH 23/26] Better readablye diff --- tests/integrations/django/asgi/test_asgi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index e9409b103f..9d2b7396c1 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -381,6 +381,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e BODY_FORM_CONTENT_LENGTH = str(len(BODY_FORM)).encode("utf-8") +@pytest.mark.parametrize("application", APPS) @pytest.mark.parametrize( "send_default_pii,method,headers,url_name,body,expected_data", [ @@ -472,7 +473,6 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e ), ], ) -@pytest.mark.parametrize("application", APPS) @pytest.mark.asyncio # @pytest.mark.forked @pytest.mark.skipif( From bc72552bfad48817fa3b0a8b50e2985b8eb8559f Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 11:31:59 +0100 Subject: [PATCH 24/26] Fix hanging test --- tests/integrations/django/asgi/test_asgi.py | 68 ++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 9d2b7396c1..9d9fc1ffb8 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -373,8 +373,8 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e PICTURE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "image.png") -BODY_FORM = """--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="username"\r\n\r\nJane\r\n--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="password"\r\n\r\nhello123\r\n--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="photo"; filename="photo.jpg"\r\nContent-Type: image/jpg\r\nContent-Transfer-Encoding: base64\r\n\r\n{{image_data}}\r\n--fd721ef49ea403a6--\r\n""".replace( - "{{image_data}}", str(base64.b64encode(open(PICTURE, "rb").read())) +BODY_FORM = """--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="username"\r\n\r\nJane\r\n--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="password"\r\n\r\nhello123\r\n--fd721ef49ea403a6\r\nContent-Disposition: form-data; name="photo"; filename="image.png"\r\nContent-Type: image/png\r\nContent-Transfer-Encoding: base64\r\n\r\n{{image_data}}\r\n--fd721ef49ea403a6--\r\n""".replace( + "{{image_data}}", base64.b64encode(open(PICTURE, "rb").read()).decode("utf-8") ).encode( "utf-8" ) @@ -428,38 +428,38 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e BODY_FORM, {"password": "hello123", "photo": "", "username": "Jane"}, ), - ( - False, - "POST", - [(b"content-type", b"text/plain")], - "post_echo_async", - b"", - None, - ), - ( - False, - "POST", - [(b"content-type", b"text/plain")], - "post_echo_async", - b"some raw text body", - "", - ), - ( - False, - "POST", - [(b"content-type", b"application/json")], - "post_echo_async", - b'{"username":"xyz","password":"xyz"}', - {"username": "xyz", "password": "[Filtered]"}, - ), - ( - False, - "POST", - [(b"content-type", b"application/xml")], - "post_echo_async", - b'', - "", - ), + # ( + # False, + # "POST", + # [(b"content-type", b"text/plain")], + # "post_echo_async", + # b"", + # None, + # ), + # ( + # False, + # "POST", + # [(b"content-type", b"text/plain")], + # "post_echo_async", + # b"some raw text body", + # "", + # ), + # ( + # False, + # "POST", + # [(b"content-type", b"application/json")], + # "post_echo_async", + # b'{"username":"xyz","password":"xyz"}', + # {"username": "xyz", "password": "[Filtered]"}, + # ), + # ( + # False, + # "POST", + # [(b"content-type", b"application/xml")], + # "post_echo_async", + # b'', + # "", + # ), ( False, "POST", From dfab15fee3235e6c6ba44f5709e269cbcb9e6efc Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 11:32:41 +0100 Subject: [PATCH 25/26] Reactivated tests --- tests/integrations/django/asgi/test_asgi.py | 128 ++++++++++---------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 9d9fc1ffb8..8cbd08c37b 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -385,38 +385,38 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e @pytest.mark.parametrize( "send_default_pii,method,headers,url_name,body,expected_data", [ - # ( - # True, - # "POST", - # [(b"content-type", b"text/plain")], - # "post_echo_async", - # b"", - # None, - # ), - # ( - # True, - # "POST", - # [(b"content-type", b"text/plain")], - # "post_echo_async", - # b"some raw text body", - # "", - # ), - # ( - # True, - # "POST", - # [(b"content-type", b"application/json")], - # "post_echo_async", - # b'{"username":"xyz","password":"xyz"}', - # {"username": "xyz", "password": "xyz"}, - # ), - # ( - # True, - # "POST", - # [(b"content-type", b"application/xml")], - # "post_echo_async", - # b'', - # "", - # ), + ( + True, + "POST", + [(b"content-type", b"text/plain")], + "post_echo_async", + b"", + None, + ), + ( + True, + "POST", + [(b"content-type", b"text/plain")], + "post_echo_async", + b"some raw text body", + "", + ), + ( + True, + "POST", + [(b"content-type", b"application/json")], + "post_echo_async", + b'{"username":"xyz","password":"xyz"}', + {"username": "xyz", "password": "xyz"}, + ), + ( + True, + "POST", + [(b"content-type", b"application/xml")], + "post_echo_async", + b'', + "", + ), ( True, "POST", @@ -428,38 +428,38 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e BODY_FORM, {"password": "hello123", "photo": "", "username": "Jane"}, ), - # ( - # False, - # "POST", - # [(b"content-type", b"text/plain")], - # "post_echo_async", - # b"", - # None, - # ), - # ( - # False, - # "POST", - # [(b"content-type", b"text/plain")], - # "post_echo_async", - # b"some raw text body", - # "", - # ), - # ( - # False, - # "POST", - # [(b"content-type", b"application/json")], - # "post_echo_async", - # b'{"username":"xyz","password":"xyz"}', - # {"username": "xyz", "password": "[Filtered]"}, - # ), - # ( - # False, - # "POST", - # [(b"content-type", b"application/xml")], - # "post_echo_async", - # b'', - # "", - # ), + ( + False, + "POST", + [(b"content-type", b"text/plain")], + "post_echo_async", + b"", + None, + ), + ( + False, + "POST", + [(b"content-type", b"text/plain")], + "post_echo_async", + b"some raw text body", + "", + ), + ( + False, + "POST", + [(b"content-type", b"application/json")], + "post_echo_async", + b'{"username":"xyz","password":"xyz"}', + {"username": "xyz", "password": "[Filtered]"}, + ), + ( + False, + "POST", + [(b"content-type", b"application/xml")], + "post_echo_async", + b'', + "", + ), ( False, "POST", From 9eab8a61b8b67ed12ddb5a111f130ed31fce08ad Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 20 Nov 2023 11:55:01 +0100 Subject: [PATCH 26/26] enabled forking again (was just for local testing) --- tests/integrations/django/asgi/test_asgi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 8cbd08c37b..21a72e4a32 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -474,7 +474,7 @@ async def test_trace_from_headers_if_performance_disabled(sentry_init, capture_e ], ) @pytest.mark.asyncio -# @pytest.mark.forked +@pytest.mark.forked @pytest.mark.skipif( django.VERSION < (3, 1), reason="async views have been introduced in Django 3.1" )