Skip to content

Commit 1ae1bdb

Browse files
committed
PYTHON-5993 Sync the spec prose test renumbering
The spec dropped its prose test for the sent cursor id, because the unified fixtures now assert db.mongodb.cursor_id: { $$gte: 1 }, which fails a driver that recorded the reply's 0. Its transaction prose test is renumbered from 4 to 3. Keeps the sent-cursor-id assertion as a driver test rather than deleting it: it checks equality with the id actually sent, which a lower bound cannot express. Renamed so it no longer claims to be a spec prose test. Also vendors valid-pass/operator-gte.json, the runner reference test for the new operator. It comes from a specification change that is not merged yet.
1 parent 1590f33 commit 1ae1bdb

3 files changed

Lines changed: 110 additions & 12 deletions

File tree

test/asynchronous/test_otel_getmore.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,15 @@ async def test_abandoned_cursor_still_ends_operation_span(self):
281281
]
282282
self.assertEqual(len(find_op_spans), 1)
283283

284-
async def test_prose_3_get_more_records_sent_cursor_id_not_returned_cursor_id(self):
285-
"""Prose Test 3: getMore records the cursor id it sent, not the cursor id returned."""
284+
async def test_get_more_records_sent_cursor_id_not_returned_cursor_id(self):
285+
"""getMore records the cursor id it sent, not the cursor id returned.
286+
287+
Was prose test 3 until DRIVERS-3598 replaced it with $$gte: 1 in the
288+
unified fixtures. Kept because it asserts equality with the id sent,
289+
which a lower bound cannot express.
290+
"""
286291
client = await self.async_rs_or_single_client(tracing={"enabled": True})
287-
coll = client.pymongo_test.prose3_getmore_cursor_id
292+
coll = client.pymongo_test.getmore_sent_cursor_id
288293
await coll.drop()
289294
await coll.insert_many([{"i": i} for i in range(3)])
290295
self.exporter.clear()
@@ -316,10 +321,10 @@ async def test_prose_3_get_more_records_sent_cursor_id_not_returned_cursor_id(se
316321
self.assertEqual(span.attributes["db.mongodb.cursor_id"], sent_cursor_id)
317322

318323
@async_client_context.require_transactions
319-
async def test_prose_4_get_more_in_transaction_nests_under_transaction_span(self):
320-
"""Prose Test 4: getMore inside a transaction nests under the transaction span."""
324+
async def test_prose_3_get_more_in_transaction_nests_under_transaction_span(self):
325+
"""Prose Test 3: getMore inside a transaction nests under the transaction span."""
321326
client = await self.async_rs_or_single_client(tracing={"enabled": True})
322-
coll = client.pymongo_test.prose4_getmore_in_txn
327+
coll = client.pymongo_test.prose3_getmore_in_txn
323328
await coll.drop()
324329
# Inserted outside the transaction, so the transaction below contains
325330
# only the find and getMore.

test/test_otel_getmore.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,15 @@ def test_abandoned_cursor_still_ends_operation_span(self):
281281
]
282282
self.assertEqual(len(find_op_spans), 1)
283283

284-
def test_prose_3_get_more_records_sent_cursor_id_not_returned_cursor_id(self):
285-
"""Prose Test 3: getMore records the cursor id it sent, not the cursor id returned."""
284+
def test_get_more_records_sent_cursor_id_not_returned_cursor_id(self):
285+
"""getMore records the cursor id it sent, not the cursor id returned.
286+
287+
Was prose test 3 until DRIVERS-3598 replaced it with $$gte: 1 in the
288+
unified fixtures. Kept because it asserts equality with the id sent,
289+
which a lower bound cannot express.
290+
"""
286291
client = self.rs_or_single_client(tracing={"enabled": True})
287-
coll = client.pymongo_test.prose3_getmore_cursor_id
292+
coll = client.pymongo_test.getmore_sent_cursor_id
288293
coll.drop()
289294
coll.insert_many([{"i": i} for i in range(3)])
290295
self.exporter.clear()
@@ -316,10 +321,10 @@ def test_prose_3_get_more_records_sent_cursor_id_not_returned_cursor_id(self):
316321
self.assertEqual(span.attributes["db.mongodb.cursor_id"], sent_cursor_id)
317322

318323
@client_context.require_transactions
319-
def test_prose_4_get_more_in_transaction_nests_under_transaction_span(self):
320-
"""Prose Test 4: getMore inside a transaction nests under the transaction span."""
324+
def test_prose_3_get_more_in_transaction_nests_under_transaction_span(self):
325+
"""Prose Test 3: getMore inside a transaction nests under the transaction span."""
321326
client = self.rs_or_single_client(tracing={"enabled": True})
322-
coll = client.pymongo_test.prose4_getmore_in_txn
327+
coll = client.pymongo_test.prose3_getmore_in_txn
323328
coll.drop()
324329
# Inserted outside the transaction, so the transaction below contains
325330
# only the find and getMore.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"description": "operator-gte",
3+
"schemaVersion": "1.29",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"observeEvents": [
9+
"commandStartedEvent"
10+
]
11+
}
12+
},
13+
{
14+
"database": {
15+
"id": "database0",
16+
"client": "client0",
17+
"databaseName": "database0Name"
18+
}
19+
},
20+
{
21+
"collection": {
22+
"id": "collection0",
23+
"database": "database0",
24+
"collectionName": "coll0"
25+
}
26+
}
27+
],
28+
"initialData": [
29+
{
30+
"collectionName": "coll0",
31+
"databaseName": "database0Name",
32+
"documents": []
33+
}
34+
],
35+
"tests": [
36+
{
37+
"description": "special gte matching operator",
38+
"operations": [
39+
{
40+
"name": "insertOne",
41+
"object": "collection0",
42+
"arguments": {
43+
"document": {
44+
"_id": 1,
45+
"x": 2,
46+
"y": 3,
47+
"z": 4
48+
}
49+
}
50+
}
51+
],
52+
"expectEvents": [
53+
{
54+
"client": "client0",
55+
"events": [
56+
{
57+
"commandStartedEvent": {
58+
"command": {
59+
"insert": "coll0",
60+
"documents": [
61+
{
62+
"_id": {
63+
"$$gte": 1
64+
},
65+
"x": {
66+
"$$gte": 1.9
67+
},
68+
"y": {
69+
"$$gte": {
70+
"$numberLong": "3"
71+
}
72+
},
73+
"z": {
74+
"$$gte": 4
75+
}
76+
}
77+
]
78+
},
79+
"commandName": "insert",
80+
"databaseName": "database0Name"
81+
}
82+
}
83+
]
84+
}
85+
]
86+
}
87+
]
88+
}

0 commit comments

Comments
 (0)