Skip to content

Commit ea4b9a5

Browse files
RUST-1649 Deprecate sharded-replicaset test topology / sync outdated spec tests (#880)
1 parent 3ffc906 commit ea4b9a5

File tree

546 files changed

+16235
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

546 files changed

+16235
-301
lines changed

src/test/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ mod documentation_examples;
1414
mod index_management;
1515
#[cfg(all(not(feature = "sync"), not(feature = "tokio-sync")))]
1616
mod lambda_examples;
17-
pub mod spec;
17+
pub(crate) mod serde_helpers;
18+
pub(crate) mod spec;
1819
mod timeseries;
1920
pub(crate) mod util;
2021

src/test/serde_helpers.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use serde::de::{Deserialize, DeserializeOwned, Deserializer};
2+
3+
pub(crate) fn deserialize_nonempty_vec<'de, D, T>(
4+
deserializer: D,
5+
) -> std::result::Result<Option<Vec<T>>, D::Error>
6+
where
7+
D: Deserializer<'de>,
8+
T: DeserializeOwned,
9+
{
10+
let vec: Vec<T> = Vec::deserialize(deserializer)?;
11+
if vec.is_empty() {
12+
return Err(serde::de::Error::custom(format!(
13+
"list provided for {} cannot be empty",
14+
std::any::type_name::<T>()
15+
)));
16+
}
17+
Ok(Some(vec))
18+
}

src/test/spec/change_streams.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,20 @@ use crate::test::{spec::unified_runner::run_unified_tests, LOCK};
44
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
55
async fn run_unified() {
66
let _guard = LOCK.run_exclusively().await;
7-
run_unified_tests(&["change-streams", "unified"]).await;
7+
run_unified_tests(&["change-streams", "unified"])
8+
.skip_files(&[
9+
// TODO RUST-1281: unskip this file
10+
"change-streams-showExpandedEvents.json",
11+
// TODO RUST-1423: unskip this file
12+
"change-streams-disambiguatedPaths.json",
13+
])
14+
.skip_tests(&[
15+
// TODO RUST-1658: unskip these tests
16+
"Test with document comment",
17+
"Test with string comment",
18+
"Test that comment is set on getMore",
19+
"Test with document comment - pre 4.4",
20+
"Test that comment is not set on getMore - pre 4.4",
21+
])
22+
.await;
823
}

src/test/spec/json/change-streams/unified/change-streams-clusterTime.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"minServerVersion": "4.0.0",
2929
"topologies": [
3030
"replicaset",
31-
"sharded-replicaset",
3231
"load-balanced",
3332
"sharded"
3433
],

src/test/spec/json/change-streams/unified/change-streams-clusterTime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ createEntities:
1515

1616
runOnRequirements:
1717
- minServerVersion: "4.0.0"
18-
topologies: [ replicaset, sharded-replicaset, load-balanced, sharded ]
18+
topologies: [ replicaset, load-balanced, sharded ]
1919
serverless: forbid
2020

2121
initialData:
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
{
2+
"description": "disambiguatedPaths",
3+
"schemaVersion": "1.4",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": false
9+
}
10+
},
11+
{
12+
"database": {
13+
"id": "database0",
14+
"client": "client0",
15+
"databaseName": "database0"
16+
}
17+
},
18+
{
19+
"collection": {
20+
"id": "collection0",
21+
"database": "database0",
22+
"collectionName": "collection0"
23+
}
24+
}
25+
],
26+
"runOnRequirements": [
27+
{
28+
"minServerVersion": "6.1.0",
29+
"topologies": [
30+
"replicaset",
31+
"load-balanced",
32+
"sharded"
33+
],
34+
"serverless": "forbid"
35+
}
36+
],
37+
"initialData": [
38+
{
39+
"collectionName": "collection0",
40+
"databaseName": "database0",
41+
"documents": []
42+
}
43+
],
44+
"tests": [
45+
{
46+
"description": "disambiguatedPaths is not present when showExpandedEvents is false/unset",
47+
"operations": [
48+
{
49+
"name": "insertOne",
50+
"object": "collection0",
51+
"arguments": {
52+
"document": {
53+
"_id": 1,
54+
"a": {
55+
"1": 1
56+
}
57+
}
58+
}
59+
},
60+
{
61+
"name": "createChangeStream",
62+
"object": "collection0",
63+
"arguments": {
64+
"pipeline": []
65+
},
66+
"saveResultAsEntity": "changeStream0"
67+
},
68+
{
69+
"name": "updateOne",
70+
"object": "collection0",
71+
"arguments": {
72+
"filter": {
73+
"_id": 1
74+
},
75+
"update": {
76+
"$set": {
77+
"a.1": 2
78+
}
79+
}
80+
}
81+
},
82+
{
83+
"name": "iterateUntilDocumentOrError",
84+
"object": "changeStream0",
85+
"expectResult": {
86+
"operationType": "update",
87+
"ns": {
88+
"db": "database0",
89+
"coll": "collection0"
90+
},
91+
"updateDescription": {
92+
"updatedFields": {
93+
"$$exists": true
94+
},
95+
"removedFields": {
96+
"$$exists": true
97+
},
98+
"truncatedArrays": {
99+
"$$exists": true
100+
},
101+
"disambiguatedPaths": {
102+
"$$exists": false
103+
}
104+
}
105+
}
106+
}
107+
]
108+
},
109+
{
110+
"description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present",
111+
"operations": [
112+
{
113+
"name": "insertOne",
114+
"object": "collection0",
115+
"arguments": {
116+
"document": {
117+
"_id": 1,
118+
"a": {
119+
"1": 1
120+
}
121+
}
122+
}
123+
},
124+
{
125+
"name": "createChangeStream",
126+
"object": "collection0",
127+
"arguments": {
128+
"pipeline": [],
129+
"showExpandedEvents": true
130+
},
131+
"saveResultAsEntity": "changeStream0"
132+
},
133+
{
134+
"name": "updateOne",
135+
"object": "collection0",
136+
"arguments": {
137+
"filter": {
138+
"_id": 1
139+
},
140+
"update": {
141+
"$set": {
142+
"a.1": 2
143+
}
144+
}
145+
}
146+
},
147+
{
148+
"name": "iterateUntilDocumentOrError",
149+
"object": "changeStream0",
150+
"expectResult": {
151+
"operationType": "update",
152+
"ns": {
153+
"db": "database0",
154+
"coll": "collection0"
155+
},
156+
"updateDescription": {
157+
"updatedFields": {
158+
"$$exists": true
159+
},
160+
"removedFields": {
161+
"$$exists": true
162+
},
163+
"truncatedArrays": {
164+
"$$exists": true
165+
},
166+
"disambiguatedPaths": {
167+
"a.1": [
168+
"a",
169+
"1"
170+
]
171+
}
172+
}
173+
}
174+
}
175+
]
176+
},
177+
{
178+
"description": "disambiguatedPaths returns array indices as integers",
179+
"operations": [
180+
{
181+
"name": "insertOne",
182+
"object": "collection0",
183+
"arguments": {
184+
"document": {
185+
"_id": 1,
186+
"a": [
187+
{
188+
"1": 1
189+
}
190+
]
191+
}
192+
}
193+
},
194+
{
195+
"name": "createChangeStream",
196+
"object": "collection0",
197+
"arguments": {
198+
"pipeline": [],
199+
"showExpandedEvents": true
200+
},
201+
"saveResultAsEntity": "changeStream0"
202+
},
203+
{
204+
"name": "updateOne",
205+
"object": "collection0",
206+
"arguments": {
207+
"filter": {
208+
"_id": 1
209+
},
210+
"update": {
211+
"$set": {
212+
"a.0.1": 2
213+
}
214+
}
215+
}
216+
},
217+
{
218+
"name": "iterateUntilDocumentOrError",
219+
"object": "changeStream0",
220+
"expectResult": {
221+
"operationType": "update",
222+
"ns": {
223+
"db": "database0",
224+
"coll": "collection0"
225+
},
226+
"updateDescription": {
227+
"updatedFields": {
228+
"$$exists": true
229+
},
230+
"removedFields": {
231+
"$$exists": true
232+
},
233+
"truncatedArrays": {
234+
"$$exists": true
235+
},
236+
"disambiguatedPaths": {
237+
"a.0.1": [
238+
"a",
239+
{
240+
"$$type": "int"
241+
},
242+
"1"
243+
]
244+
}
245+
}
246+
}
247+
}
248+
]
249+
}
250+
]
251+
}

0 commit comments

Comments
 (0)