Skip to content

Commit 6ba761c

Browse files
ci(mariadb): add missing snapshot tests (#4418) (#4426)
(cherry picked from commit 444a6ae) Co-authored-by: Munir Abdinur <[email protected]>
1 parent 8a5c9da commit 6ba761c

5 files changed

+122
-8
lines changed

tests/contrib/mariadb/test_mariadb.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,15 @@ def test_analytics_default(connection, tracer):
130130

131131

132132
@pytest.mark.subprocess(env=dict(DD_SERVICE="mysvc"))
133-
@snapshot(async_mode=False, variants=SNAPSHOT_VARIANTS)
133+
@pytest.mark.snapshot(variants=SNAPSHOT_VARIANTS)
134134
def test_user_specified_dd_service_snapshot():
135135
"""
136136
When a user specifies a service for the app
137137
The mariadb integration should not use it.
138138
"""
139139
import mariadb
140140

141-
from ddtrace import config # noqa
142141
from ddtrace import patch
143-
from ddtrace import tracer
144142

145143
patch(mariadb=True)
146144
from tests.contrib.config import MARIADB_CONFIG
@@ -150,21 +148,18 @@ def test_user_specified_dd_service_snapshot():
150148
cursor.execute("SELECT 1")
151149
rows = cursor.fetchall()
152150
assert len(rows) == 1
153-
tracer.shutdown()
154151

155152

156153
@pytest.mark.subprocess(env=dict(DD_MARIADB_SERVICE="mysvc"))
157-
@snapshot(async_mode=False, variants=SNAPSHOT_VARIANTS)
154+
@pytest.mark.snapshot(variants=SNAPSHOT_VARIANTS)
158155
def test_user_specified_dd_mariadb_service_snapshot():
159156
"""
160157
When a user specifies a service for the app
161158
The mariadb integration should not use it.
162159
"""
163160
import mariadb
164161

165-
from ddtrace import config # noqa
166162
from ddtrace import patch
167-
from ddtrace import tracer
168163

169164
patch(mariadb=True)
170165
from tests.contrib.config import MARIADB_CONFIG
@@ -174,7 +169,6 @@ def test_user_specified_dd_mariadb_service_snapshot():
174169
cursor.execute("SELECT 1")
175170
rows = cursor.fetchall()
176171
assert len(rows) == 1
177-
tracer.shutdown()
178172

179173

180174
@snapshot(include_tracer=True, variants=SNAPSHOT_VARIANTS)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[[
2+
{
3+
"name": "mariadb.query",
4+
"service": "mysvc",
5+
"resource": "SELECT 1",
6+
"trace_id": 0,
7+
"span_id": 1,
8+
"parent_id": 0,
9+
"type": "sql",
10+
"meta": {
11+
"_dd.p.dm": "-0",
12+
"db.name": "test",
13+
"db.user": "test",
14+
"out.host": "127.0.0.1",
15+
"runtime-id": "4bf7d992405a49ec8cef450e74e9f121"
16+
},
17+
"metrics": {
18+
"_dd.agent_psr": 1.0,
19+
"_dd.measured": 1,
20+
"_dd.top_level": 1,
21+
"_dd.tracer_kr": 1.0,
22+
"_sampling_priority_v1": 1,
23+
"db.rowcount": 1,
24+
"out.port": 3306,
25+
"sql.rows": 1,
26+
"system.pid": 2209
27+
},
28+
"duration": 2895542,
29+
"start": 1666907272534186839
30+
}]]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[[
2+
{
3+
"name": "mariadb.query",
4+
"service": "mysvc",
5+
"resource": "SELECT 1",
6+
"trace_id": 0,
7+
"span_id": 1,
8+
"parent_id": 0,
9+
"type": "sql",
10+
"meta": {
11+
"_dd.p.dm": "-0",
12+
"db.name": "test",
13+
"db.user": "test",
14+
"out.host": "127.0.0.1",
15+
"runtime-id": "568b391eb6c9436d8115636d6346bdb6"
16+
},
17+
"metrics": {
18+
"_dd.agent_psr": 1.0,
19+
"_dd.measured": 1,
20+
"_dd.top_level": 1,
21+
"_dd.tracer_kr": 1.0,
22+
"_sampling_priority_v1": 1,
23+
"db.rowcount": 0,
24+
"out.port": 3306,
25+
"sql.rows": 0,
26+
"system.pid": 2187
27+
},
28+
"duration": 2572959,
29+
"start": 1666907195155263470
30+
}]]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[[
2+
{
3+
"name": "mariadb.query",
4+
"service": "mariadb",
5+
"resource": "SELECT 1",
6+
"trace_id": 0,
7+
"span_id": 1,
8+
"parent_id": 0,
9+
"type": "sql",
10+
"meta": {
11+
"_dd.p.dm": "-0",
12+
"db.name": "test",
13+
"db.user": "test",
14+
"out.host": "127.0.0.1",
15+
"runtime-id": "76924267a57b44f48c9c3c90527a8cff"
16+
},
17+
"metrics": {
18+
"_dd.agent_psr": 1.0,
19+
"_dd.measured": 1,
20+
"_dd.top_level": 1,
21+
"_dd.tracer_kr": 1.0,
22+
"_sampling_priority_v1": 1,
23+
"db.rowcount": 1,
24+
"out.port": 3306,
25+
"sql.rows": 1,
26+
"system.pid": 2201
27+
},
28+
"duration": 2602916,
29+
"start": 1666907268511224421
30+
}]]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[[
2+
{
3+
"name": "mariadb.query",
4+
"service": "mariadb",
5+
"resource": "SELECT 1",
6+
"trace_id": 0,
7+
"span_id": 1,
8+
"parent_id": 0,
9+
"type": "sql",
10+
"meta": {
11+
"_dd.p.dm": "-0",
12+
"db.name": "test",
13+
"db.user": "test",
14+
"out.host": "127.0.0.1",
15+
"runtime-id": "460f0ba847f14dd2ae661cb4a5511f5c"
16+
},
17+
"metrics": {
18+
"_dd.agent_psr": 1.0,
19+
"_dd.measured": 1,
20+
"_dd.top_level": 1,
21+
"_dd.tracer_kr": 1.0,
22+
"_sampling_priority_v1": 1,
23+
"db.rowcount": 0,
24+
"out.port": 3306,
25+
"sql.rows": 0,
26+
"system.pid": 2179
27+
},
28+
"duration": 2502750,
29+
"start": 1666907192496273844
30+
}]]

0 commit comments

Comments
 (0)