Skip to content

Commit 1d5b6ad

Browse files
committed
rudimentary tests
1 parent c402deb commit 1d5b6ad

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ def get_file_text(file_name):
6161
"opentelemetry": ["opentelemetry-distro>=0.35b0"],
6262
"opentelemetry-experimental": [
6363
"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
6666
"opentelemetry-instrumentation-fastapi~=0.40b0",
6767
"opentelemetry-instrumentation-flask~=0.40b0",
6868
"opentelemetry-instrumentation-requests~=0.40b0",
69+
"opentelemetry-instrumentation-sqlite3~=0.40b0",
6970
"opentelemetry-instrumentation-urllib~=0.40b0",
70-
"opentelemetry-instrumentation-wsgi~=0.40b0",
7171
],
7272
"pure_eval": ["pure_eval", "executing", "asttokens"],
7373
"pymongo": ["pymongo>=3.1"],
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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()

0 commit comments

Comments
 (0)