Skip to content

Commit eb69b8c

Browse files
authored
RUST-2138 Update and unskip otel tests (#1516)
1 parent 1a0607b commit eb69b8c

36 files changed

+721
-157
lines changed

src/otel.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,9 @@ impl CmdSpan {
256256
return;
257257
}
258258
if let Ok(out) = result {
259-
// tests don't match the spec here
260-
if false {
261-
if let Some(cursor_id) = <Op::Otel as OtelWitness>::output_cursor_id(out) {
262-
let span = self.context.span();
263-
span.set_attribute(KeyValue::new("db.mongodb.cursor_id", cursor_id));
264-
}
259+
if let Some(cursor_id) = <Op::Otel as OtelWitness>::output_cursor_id(out) {
260+
let span = self.context.span();
261+
span.set_attribute(KeyValue::new("db.mongodb.cursor_id", cursor_id));
265262
}
266263
}
267264
record_error(&self.context, result);

src/test/spec/json/open-telemetry/operation/aggregate.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@
6767
"db.collection.name": "test",
6868
"db.command.name": "aggregate",
6969
"network.transport": "tcp",
70-
"db.mongodb.cursor_id": {
71-
"$$exists": false
72-
},
7370
"db.response.status_code": {
7471
"$$exists": false
7572
},

src/test/spec/json/open-telemetry/operation/aggregate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ tests:
3535
db.collection.name: test
3636
db.operation.name: aggregate
3737
db.operation.summary: aggregate operation-aggregate.test
38+
3839
nested:
3940
- name: aggregate
4041
attributes:
@@ -43,7 +44,6 @@ tests:
4344
db.collection.name: *collectionName0
4445
db.command.name: aggregate
4546
network.transport: tcp
46-
db.mongodb.cursor_id: { $$exists: false }
4747
db.response.status_code: { $$exists: false }
4848
exception.message: { $$exists: false }
4949
exception.type: { $$exists: false }

src/test/spec/json/open-telemetry/operation/atlas_search.json

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,36 @@
113113
"attributes": {
114114
"db.system": "mongodb",
115115
"db.namespace": "operation-atlas-search",
116+
"db.command.name": "createSearchIndexes",
116117
"db.collection.name": "test",
118+
"db.mongodb.cursor_id": {
119+
"$$exists": false
120+
},
121+
"db.response.status_code": {
122+
"$$exists": true
123+
},
124+
"network.transport": "tcp",
125+
"db.mongodb.server_connection_id": {
126+
"$$type": [
127+
"int",
128+
"long"
129+
]
130+
},
131+
"db.mongodb.driver_connection_id": {
132+
"$$type": [
133+
"int",
134+
"long"
135+
]
136+
},
137+
"exception.message": {
138+
"$$exists": true
139+
},
140+
"exception.type": {
141+
"$$exists": true
142+
},
143+
"exception.stacktrace": {
144+
"$$exists": true
145+
},
117146
"server.address": {
118147
"$$type": "string"
119148
},
@@ -123,9 +152,6 @@
123152
"string"
124153
]
125154
},
126-
"server.type": {
127-
"$$type": "string"
128-
},
129155
"db.query.summary": "createSearchIndexes operation-atlas-search.test",
130156
"db.query.text": {
131157
"$$matchAsDocument": {
@@ -163,6 +189,7 @@
163189
"attributes": {
164190
"db.system": "mongodb",
165191
"db.namespace": "operation-atlas-search",
192+
"db.command.name": "updateSearchIndex",
166193
"db.collection.name": "test",
167194
"server.address": {
168195
"$$type": "string"
@@ -173,8 +200,33 @@
173200
"string"
174201
]
175202
},
176-
"server.type": {
177-
"$$type": "string"
203+
"db.mongodb.cursor_id": {
204+
"$$exists": false
205+
},
206+
"db.response.status_code": {
207+
"$$exists": true
208+
},
209+
"exception.message": {
210+
"$$exists": true
211+
},
212+
"exception.type": {
213+
"$$exists": true
214+
},
215+
"exception.stacktrace": {
216+
"$$exists": true
217+
},
218+
"network.transport": "tcp",
219+
"db.mongodb.server_connection_id": {
220+
"$$type": [
221+
"int",
222+
"long"
223+
]
224+
},
225+
"db.mongodb.driver_connection_id": {
226+
"$$type": [
227+
"int",
228+
"long"
229+
]
178230
},
179231
"db.query.summary": "updateSearchIndex operation-atlas-search.test",
180232
"db.query.text": {
@@ -205,6 +257,7 @@
205257
"attributes": {
206258
"db.system": "mongodb",
207259
"db.namespace": "operation-atlas-search",
260+
"db.command.name": "dropSearchIndex",
208261
"db.collection.name": "test",
209262
"server.address": {
210263
"$$type": "string"
@@ -215,8 +268,33 @@
215268
"string"
216269
]
217270
},
218-
"server.type": {
219-
"$$type": "string"
271+
"db.mongodb.cursor_id": {
272+
"$$exists": false
273+
},
274+
"db.response.status_code": {
275+
"$$exists": true
276+
},
277+
"exception.message": {
278+
"$$exists": true
279+
},
280+
"exception.type": {
281+
"$$exists": true
282+
},
283+
"exception.stacktrace": {
284+
"$$exists": true
285+
},
286+
"network.transport": "tcp",
287+
"db.mongodb.server_connection_id": {
288+
"$$type": [
289+
"int",
290+
"long"
291+
]
292+
},
293+
"db.mongodb.driver_connection_id": {
294+
"$$type": [
295+
"int",
296+
"long"
297+
]
220298
},
221299
"db.query.summary": "dropSearchIndex operation-atlas-search.test",
222300
"db.query.text": {

src/test/spec/json/open-telemetry/operation/atlas_search.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,20 @@ tests:
8080
attributes:
8181
db.system: mongodb
8282
db.namespace: operation-atlas-search
83+
db.command.name: createSearchIndexes
8384
db.collection.name: test
85+
db.mongodb.cursor_id: { $$exists: false }
86+
db.response.status_code: { $$exists: true }
87+
network.transport: tcp
88+
db.mongodb.server_connection_id:
89+
$$type: [ int, long ]
90+
db.mongodb.driver_connection_id:
91+
$$type: [ int, long ]
92+
exception.message: { $$exists: true }
93+
exception.type: { $$exists: true }
94+
exception.stacktrace: { $$exists: true }
8495
server.address: { $$type: string }
8596
server.port: { $$type: [ long, string ] }
86-
server.type: { $$type: string }
8797
db.query.summary: createSearchIndexes operation-atlas-search.test
8898
db.query.text:
8999
$$matchAsDocument:
@@ -98,15 +108,26 @@ tests:
98108
db.collection.name: test
99109
db.operation.name: updateSearchIndex
100110
db.operation.summary: updateSearchIndex operation-atlas-search.test
111+
101112
nested:
102113
- name: updateSearchIndex
103114
attributes:
104115
db.system: mongodb
105116
db.namespace: operation-atlas-search
117+
db.command.name: updateSearchIndex
106118
db.collection.name: test
107119
server.address: { $$type: string }
108120
server.port: { $$type: [ long, string ] }
109-
server.type: { $$type: string }
121+
db.mongodb.cursor_id: { $$exists: false }
122+
db.response.status_code: { $$exists: true }
123+
exception.message: { $$exists: true }
124+
exception.type: { $$exists: true }
125+
exception.stacktrace: { $$exists: true }
126+
network.transport: tcp
127+
db.mongodb.server_connection_id:
128+
$$type: [ int, long ]
129+
db.mongodb.driver_connection_id:
130+
$$type: [ int, long ]
110131
db.query.summary: updateSearchIndex operation-atlas-search.test
111132
db.query.text:
112133
$$matchAsDocument:
@@ -127,10 +148,20 @@ tests:
127148
attributes:
128149
db.system: mongodb
129150
db.namespace: operation-atlas-search
151+
db.command.name: dropSearchIndex
130152
db.collection.name: test
131153
server.address: { $$type: string }
132154
server.port: { $$type: [ long, string ] }
133-
server.type: { $$type: string }
155+
db.mongodb.cursor_id: { $$exists: false }
156+
db.response.status_code: { $$exists: true }
157+
exception.message: { $$exists: true }
158+
exception.type: { $$exists: true }
159+
exception.stacktrace: { $$exists: true }
160+
network.transport: tcp
161+
db.mongodb.server_connection_id:
162+
$$type: [ int, long ]
163+
db.mongodb.driver_connection_id:
164+
$$type: [ int, long ]
134165
db.query.summary: dropSearchIndex operation-atlas-search.test
135166
db.query.text:
136167
$$matchAsDocument:

src/test/spec/json/open-telemetry/operation/bulk_write.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@
211211
"long"
212212
]
213213
},
214-
"server.type": {
215-
"$$type": "string"
216-
},
217214
"db.query.summary": "bulkWrite admin",
218215
"db.query.text": {
219216
"$$matchAsDocument": {

src/test/spec/json/open-telemetry/operation/bulk_write.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ tests:
9797
exception.stacktrace: { $$exists: false }
9898
server.address: { $$type: string }
9999
server.port: { $$type: [ int, long ] }
100-
server.type: { $$type: string }
101100
db.query.summary: bulkWrite admin
102101
db.query.text:
103102
$$matchAsDocument:

src/test/spec/json/open-telemetry/operation/delete.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"name": "delete",
6262
"attributes": {
6363
"db.system": "mongodb",
64+
"db.command.name": "delete",
6465
"db.namespace": "operation-delete",
6566
"db.collection.name": "test",
6667
"server.address": {
@@ -72,6 +73,34 @@
7273
"string"
7374
]
7475
},
76+
"db.mongodb.cursor_id": {
77+
"$$exists": false
78+
},
79+
"db.response.status_code": {
80+
"$$exists": false
81+
},
82+
"exception.message": {
83+
"$$exists": false
84+
},
85+
"exception.type": {
86+
"$$exists": false
87+
},
88+
"exception.stacktrace": {
89+
"$$exists": false
90+
},
91+
"network.transport": "tcp",
92+
"db.mongodb.server_connection_id": {
93+
"$$type": [
94+
"int",
95+
"long"
96+
]
97+
},
98+
"db.mongodb.driver_connection_id": {
99+
"$$type": [
100+
"int",
101+
"long"
102+
]
103+
},
75104
"db.query.summary": "delete operation-delete.test",
76105
"db.query.text": {
77106
"$$matchAsDocument": {

src/test/spec/json/open-telemetry/operation/delete.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,21 @@ tests:
3838
- name: delete
3939
attributes:
4040
db.system: mongodb
41+
db.command.name: delete
4142
db.namespace: operation-delete
4243
db.collection.name: test
4344
server.address: { $$type: string }
4445
server.port: { $$type: [ long, string ] }
46+
db.mongodb.cursor_id: { $$exists: false }
47+
db.response.status_code: { $$exists: false }
48+
exception.message: { $$exists: false }
49+
exception.type: { $$exists: false }
50+
exception.stacktrace: { $$exists: false }
51+
network.transport: tcp
52+
db.mongodb.server_connection_id:
53+
$$type: [ int, long ]
54+
db.mongodb.driver_connection_id:
55+
$$type: [ int, long ]
4556
db.query.summary: delete operation-delete.test
4657
db.query.text:
4758
$$matchAsDocument:

src/test/spec/json/open-telemetry/operation/drop_collection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"description": "operation drop collection",
33
"schemaVersion": "1.27",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "7.0"
7+
}
8+
],
49
"createEntities": [
510
{
611
"client": {

0 commit comments

Comments
 (0)