Skip to content

Commit 63df382

Browse files
authored
test(data-collection): Remove redundant empty data_collection from sentry_init (#7903)
Refs PY-2936
1 parent c42a557 commit 63df382

9 files changed

Lines changed: 13 additions & 198 deletions

File tree

‎tests/integrations/aiomysql/test_aiomysql.py‎

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -361,47 +361,6 @@ async def test_execute_record_params(sentry_init, capture_events) -> None:
361361
]
362362

363363

364-
@pytest.mark.asyncio
365-
async def test_execute_record_params_with_data_collection_default(
366-
sentry_init, capture_events
367-
) -> None:
368-
sentry_init(
369-
integrations=[AioMySQLIntegration()],
370-
data_collection={},
371-
)
372-
events = capture_events()
373-
374-
conn = await aiomysql.connect(**_connect_args())
375-
376-
async with conn.cursor() as cur:
377-
await cur.execute(
378-
"INSERT INTO users(name, password, dob) VALUES (%s, %s, %s)",
379-
("Bob", "secret_pw", datetime.date(1984, 3, 1)),
380-
)
381-
382-
conn.close()
383-
384-
capture_message("hi")
385-
386-
(event,) = events
387-
388-
for crumb in event["breadcrumbs"]["values"]:
389-
del crumb["timestamp"]
390-
391-
assert event["breadcrumbs"]["values"] == [
392-
CRUMBS_CONNECT,
393-
{
394-
"category": "query",
395-
"data": {
396-
"db.params": ["Bob", "secret_pw", "datetime.date(1984, 3, 1)"],
397-
"db.paramstyle": "format",
398-
},
399-
"message": "INSERT INTO users(name, password, dob) VALUES (%s, %s, %s)",
400-
"type": "default",
401-
},
402-
]
403-
404-
405364
@pytest.mark.asyncio
406365
async def test_cursor_context_manager(sentry_init, capture_events) -> None:
407366
sentry_init(

‎tests/integrations/clickhouse_driver/test_clickhouse_driver.py‎

Lines changed: 2 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -322,109 +322,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled(
322322
assert event["breadcrumbs"]["values"] == expected_breadcrumbs
323323

324324

325-
def test_clickhouse_client_breadcrumbs_with_data_collection_default(
326-
sentry_init, capture_events
327-
) -> None:
328-
sentry_init(
329-
integrations=[ClickhouseDriverIntegration()],
330-
data_collection={},
331-
)
332-
events = capture_events()
333-
334-
client = Client("localhost")
335-
client.execute("DROP TABLE IF EXISTS test")
336-
client.execute("CREATE TABLE test (x Int32) ENGINE = Memory")
337-
client.execute("INSERT INTO test (x) VALUES", [{"x": 100}])
338-
client.execute("INSERT INTO test (x) VALUES", [[170], [200]])
339-
340-
res = client.execute("SELECT sum(x) FROM test WHERE x > %(minv)i", {"minv": 150})
341-
assert res[0][0] == 370
342-
343-
capture_message("hi")
344-
345-
(event,) = events
346-
347-
expected_breadcrumbs = [
348-
{
349-
"category": "query",
350-
"data": {
351-
"db.system": "clickhouse",
352-
"db.driver.name": "clickhouse-driver",
353-
"db.name": "",
354-
"db.user": "default",
355-
"server.address": "localhost",
356-
"server.port": 9000,
357-
"db.result": [],
358-
},
359-
"message": "DROP TABLE IF EXISTS test",
360-
"type": "default",
361-
},
362-
{
363-
"category": "query",
364-
"data": {
365-
"db.system": "clickhouse",
366-
"db.driver.name": "clickhouse-driver",
367-
"db.name": "",
368-
"db.user": "default",
369-
"server.address": "localhost",
370-
"server.port": 9000,
371-
"db.result": [],
372-
},
373-
"message": "CREATE TABLE test (x Int32) ENGINE = Memory",
374-
"type": "default",
375-
},
376-
{
377-
"category": "query",
378-
"data": {
379-
"db.system": "clickhouse",
380-
"db.driver.name": "clickhouse-driver",
381-
"db.name": "",
382-
"db.user": "default",
383-
"server.address": "localhost",
384-
"server.port": 9000,
385-
},
386-
"message": "INSERT INTO test (x) VALUES",
387-
"type": "default",
388-
},
389-
{
390-
"category": "query",
391-
"data": {
392-
"db.system": "clickhouse",
393-
"db.driver.name": "clickhouse-driver",
394-
"db.name": "",
395-
"db.user": "default",
396-
"server.address": "localhost",
397-
"server.port": 9000,
398-
},
399-
"message": "INSERT INTO test (x) VALUES",
400-
"type": "default",
401-
},
402-
{
403-
"category": "query",
404-
"data": {
405-
"db.system": "clickhouse",
406-
"db.driver.name": "clickhouse-driver",
407-
"db.name": "",
408-
"db.user": "default",
409-
"server.address": "localhost",
410-
"server.port": 9000,
411-
"db.result": [[370]],
412-
},
413-
"message": "SELECT sum(x) FROM test WHERE x > 150",
414-
"type": "default",
415-
},
416-
]
417-
418-
for crumb in expected_breadcrumbs:
419-
crumb["data"] = ApproxDict(crumb["data"])
420-
421-
for crumb in event["breadcrumbs"]["values"]:
422-
crumb.pop("timestamp", None)
423-
424-
assert event["breadcrumbs"]["values"] == expected_breadcrumbs
425-
426-
427-
def test_clickhouse_client_with_data_collection(sentry_init, capture_items) -> None:
325+
def test_clickhouse_client(sentry_init, capture_items) -> None:
428326
sentry_init(
429327
integrations=[ClickhouseDriverIntegration()],
430328
traces_sample_rate=1.0,
@@ -455,9 +353,7 @@ def test_clickhouse_client_with_data_collection(sentry_init, capture_items) -> N
455353
assert "db.result" not in attribute_keys
456354

457355

458-
def test_clickhouse_client_send_data_generator_with_data_collection(
459-
sentry_init, capture_events
460-
) -> None:
356+
def test_clickhouse_client_send_data_generator(sentry_init, capture_events) -> None:
461357
sentry_init(
462358
integrations=[ClickhouseDriverIntegration()],
463359
data_collection={"database_query_data": True},

‎tests/integrations/django/asgi/test_asgi.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ async def test_basic(
5252
):
5353
sentry_init(
5454
integrations=[DjangoIntegration()],
55-
data_collection={},
5655
)
5756

5857
import channels # type: ignore[import-not-found]
@@ -112,7 +111,6 @@ async def test_async_views(
112111
):
113112
sentry_init(
114113
integrations=[DjangoIntegration()],
115-
data_collection={},
116114
)
117115

118116
comm = HttpCommunicator(application, "GET", "/async_message")
@@ -171,7 +169,6 @@ async def test_async_views_concurrent_execution(
171169
settings.MIDDLEWARE = []
172170
sentry_init(
173171
integrations=[DjangoIntegration()],
174-
data_collection={},
175172
)
176173

177174
application = make_asgi_application()
@@ -211,7 +208,6 @@ async def test_async_middleware_that_is_function_concurrent_execution(
211208
]
212209
sentry_init(
213210
integrations=[DjangoIntegration()],
214-
data_collection={},
215211
)
216212

217213
application = make_asgi_application()
@@ -507,7 +503,9 @@ async def test_asgi_request_body(
507503
body,
508504
expected_data,
509505
):
510-
sentry_init(integrations=[DjangoIntegration()], data_collection={})
506+
sentry_init(
507+
integrations=[DjangoIntegration()],
508+
)
511509

512510
comm = HttpCommunicator(
513511
application,

‎tests/integrations/django/test_basic.py‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def test_view_exceptions(
5656
):
5757
sentry_init(
5858
integrations=[DjangoIntegration()],
59-
data_collection={},
6059
)
6160
exceptions = capture_exceptions()
6261
items = capture_items("event")
@@ -85,7 +84,6 @@ def test_ensures_x_forwarded_header_is_honored_in_sdk_when_enabled_in_django(
8584

8685
sentry_init(
8786
integrations=[DjangoIntegration()],
88-
data_collection={},
8987
)
9088
exceptions = capture_exceptions()
9189
items = capture_items("event")
@@ -111,7 +109,6 @@ def test_ensures_x_forwarded_header_is_not_honored_when_unenabled_in_django(
111109
"""
112110
sentry_init(
113111
integrations=[DjangoIntegration()],
114-
data_collection={},
115112
)
116113
exceptions = capture_exceptions()
117114
items = capture_items("event")
@@ -125,7 +122,9 @@ def test_ensures_x_forwarded_header_is_not_honored_when_unenabled_in_django(
125122

126123

127124
def test_middleware_exceptions(sentry_init, client, capture_exceptions):
128-
sentry_init(integrations=[DjangoIntegration()], data_collection={})
125+
sentry_init(
126+
integrations=[DjangoIntegration()],
127+
)
129128
exceptions = capture_exceptions()
130129
client.get(reverse("middleware_exc"))
131130

@@ -140,7 +139,6 @@ def test_request_captured(
140139
):
141140
sentry_init(
142141
integrations=[DjangoIntegration()],
143-
data_collection={},
144142
)
145143
items = capture_items("event")
146144
content, status, headers = unpack_werkzeug_response(client.get(reverse("message")))
@@ -313,7 +311,6 @@ def test_user_captured(
313311
):
314312
sentry_init(
315313
integrations=[DjangoIntegration()],
316-
data_collection={},
317314
)
318315
items = capture_items("event")
319316
content, status, headers = unpack_werkzeug_response(client.get(reverse("mylogin")))
@@ -343,7 +340,6 @@ def test_materialized_user_captured(
343340
):
344341
sentry_init(
345342
integrations=[DjangoIntegration()],
346-
data_collection={},
347343
traces_sample_rate=1.0,
348344
)
349345

@@ -445,7 +441,9 @@ def test_custom_error_handler_request_context(
445441

446442

447443
def test_500(sentry_init, client):
448-
sentry_init(integrations=[DjangoIntegration()], data_collection={})
444+
sentry_init(
445+
integrations=[DjangoIntegration()],
446+
)
449447

450448
content, status, headers = unpack_werkzeug_response(client.get("/view-exc"))
451449
assert status.lower() == "500 internal server error"
@@ -686,7 +684,6 @@ def test_django_connect_trace(
686684
"""
687685
sentry_init(
688686
integrations=[DjangoIntegration()],
689-
data_collection={},
690687
traces_sample_rate=1.0,
691688
)
692689

@@ -847,7 +844,6 @@ def test_segment_name(
847844
sentry_init(
848845
integrations=[DjangoIntegration()],
849846
traces_sample_rate=1.0,
850-
data_collection={},
851847
)
852848
items = capture_items("event", "span")
853849

@@ -883,7 +879,6 @@ def test_segment_name_tracing_disabled(
883879
):
884880
sentry_init(
885881
integrations=[DjangoIntegration()],
886-
data_collection={},
887882
)
888883
items = capture_items("event")
889884

@@ -1217,7 +1212,6 @@ def test_rest_framework_basic(
12171212
pytest.importorskip("rest_framework")
12181213
sentry_init(
12191214
integrations=[DjangoIntegration()],
1220-
data_collection={},
12211215
)
12221216
exceptions = capture_exceptions()
12231217
items = capture_items("event")

‎tests/integrations/django/test_data_scrubbing.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ def test_empty_query_string_is_dropped_with_data_collection(
215215
# reduce envelope size, so the ``query_string`` key is absent.
216216
sentry_init(
217217
integrations=[DjangoIntegration()],
218-
data_collection={},
219218
)
220219
events = capture_events()
221220

‎tests/integrations/django/test_db_query_data.py‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def test_query_source(
134134
):
135135
sentry_init(
136136
integrations=[DjangoIntegration()],
137-
data_collection={},
138137
traces_sample_rate=1.0,
139138
enable_db_query_source=True,
140139
db_query_source_threshold_ms=0,
@@ -199,7 +198,6 @@ def test_query_source_with_module_in_search_path(
199198

200199
sentry_init(
201200
integrations=[DjangoIntegration()],
202-
data_collection={},
203201
traces_sample_rate=1.0,
204202
enable_db_query_source=True,
205203
db_query_source_threshold_ms=0,
@@ -255,7 +253,6 @@ def test_query_source_with_in_app_exclude(
255253
):
256254
sentry_init(
257255
integrations=[DjangoIntegration()],
258-
data_collection={},
259256
traces_sample_rate=1.0,
260257
enable_db_query_source=True,
261258
db_query_source_threshold_ms=0,
@@ -325,7 +322,6 @@ def test_query_source_with_in_app_include(
325322
):
326323
sentry_init(
327324
integrations=[DjangoIntegration()],
328-
data_collection={},
329325
traces_sample_rate=1.0,
330326
enable_db_query_source=True,
331327
db_query_source_threshold_ms=0,
@@ -382,7 +378,6 @@ def test_no_query_source_if_duration_too_short(
382378
):
383379
sentry_init(
384380
integrations=[DjangoIntegration()],
385-
data_collection={},
386381
traces_sample_rate=1.0,
387382
enable_db_query_source=True,
388383
db_query_source_threshold_ms=100,
@@ -451,7 +446,6 @@ def test_query_source_if_duration_over_threshold(
451446
):
452447
sentry_init(
453448
integrations=[DjangoIntegration()],
454-
data_collection={},
455449
traces_sample_rate=1.0,
456450
enable_db_query_source=True,
457451
db_query_source_threshold_ms=100,

0 commit comments

Comments
 (0)