File tree Expand file tree Collapse file tree 2 files changed +39
-3
lines changed
tests/integrations/opentelemetry Expand file tree Collapse file tree 2 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,13 @@ def get_file_text(file_name):
61
61
"opentelemetry" : ["opentelemetry-distro>=0.35b0" ],
62
62
"opentelemetry-experimental" : [
63
63
"opentelemetry-distro~=0.40b0" ,
64
- # XXX otel: this is just a cherry-picked selection, there's much more
65
- # that can be imported
64
+ # XXX otel: this is just a cherry-picked selection for the PoC,
65
+ # there's much more that can be imported
66
66
"opentelemetry-instrumentation-fastapi~=0.40b0" ,
67
67
"opentelemetry-instrumentation-flask~=0.40b0" ,
68
68
"opentelemetry-instrumentation-requests~=0.40b0" ,
69
+ "opentelemetry-instrumentation-sqlite3~=0.40b0" ,
69
70
"opentelemetry-instrumentation-urllib~=0.40b0" ,
70
- "opentelemetry-instrumentation-wsgi~=0.40b0" ,
71
71
],
72
72
"pure_eval" : ["pure_eval" , "executing" , "asttokens" ],
73
73
"pymongo" : ["pymongo>=3.1" ],
Original file line number Diff line number Diff line change
1
+ try :
2
+ # python 3.3 and above
3
+ from unittest .mock import MagicMock
4
+ except ImportError :
5
+ # python < 3.3
6
+ from mock import MagicMock
7
+
8
+
9
+ from sentry_sdk .integrations .opentelemetry .integration import OpenTelemetryIntegration
10
+
11
+
12
+ def test_integration_enabled_if_option_is_on (sentry_init ):
13
+ OpenTelemetryIntegration .setup_once = MagicMock ()
14
+ sentry_init (
15
+ _experiments = {
16
+ "otel_powered_performance" : True ,
17
+ }
18
+ )
19
+
20
+ OpenTelemetryIntegration .setup_once .assert_called_once ()
21
+
22
+
23
+ def test_integration_not_enabled_if_option_is_off (sentry_init ):
24
+ OpenTelemetryIntegration .setup_once = MagicMock ()
25
+ sentry_init (
26
+ _experiments = {
27
+ "otel_powered_performance" : False ,
28
+ }
29
+ )
30
+ OpenTelemetryIntegration .setup_once .assert_not_called ()
31
+
32
+
33
+ def test_integration_not_enabled_if_option_is_missing (sentry_init ):
34
+ OpenTelemetryIntegration .setup_once = MagicMock ()
35
+ sentry_init ()
36
+ OpenTelemetryIntegration .setup_once .assert_not_called ()
You can’t perform that action at this time.
0 commit comments