Skip to content

Commit 51953eb

Browse files
authored
RUST-1296 Sync tests for pre and post image options in collection helpers (#724)
1 parent 38ba60b commit 51953eb

File tree

5 files changed

+321
-2
lines changed

5 files changed

+321
-2
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
use crate::test::LOCK;
1+
use crate::test::{log_uncaptured, LOCK};
22

33
use super::{run_spec_test_with_path, run_unified_format_test};
44

55
#[cfg_attr(feature = "tokio-runtime", tokio::test)]
66
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
77
async fn run() {
88
let _guard = LOCK.run_exclusively().await;
9-
run_spec_test_with_path(&["collection-management"], run_unified_format_test).await;
9+
run_spec_test_with_path(&["collection-management"], |path, test| async {
10+
if path.ends_with("modifyCollection-pre_and_post_images.json") {
11+
// modifyCollection is unsupported.
12+
log_uncaptured("skipping modifyCollection-pre_and_post_images");
13+
return;
14+
}
15+
run_unified_format_test(path, test).await;
16+
})
17+
.await;
1018
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"description": "createCollection-pre_and_post_images",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "6.0",
7+
"serverless": "forbid"
8+
}
9+
],
10+
"createEntities": [
11+
{
12+
"client": {
13+
"id": "client0",
14+
"observeEvents": [
15+
"commandStartedEvent"
16+
]
17+
}
18+
},
19+
{
20+
"database": {
21+
"id": "database0",
22+
"client": "client0",
23+
"databaseName": "papi-tests"
24+
}
25+
},
26+
{
27+
"collection": {
28+
"id": "collection0",
29+
"database": "database0",
30+
"collectionName": "test"
31+
}
32+
}
33+
],
34+
"tests": [
35+
{
36+
"description": "createCollection with changeStreamPreAndPostImages enabled",
37+
"operations": [
38+
{
39+
"name": "dropCollection",
40+
"object": "database0",
41+
"arguments": {
42+
"collection": "test"
43+
}
44+
},
45+
{
46+
"name": "createCollection",
47+
"object": "database0",
48+
"arguments": {
49+
"collection": "test",
50+
"changeStreamPreAndPostImages": {
51+
"enabled": true
52+
}
53+
}
54+
},
55+
{
56+
"name": "assertCollectionExists",
57+
"object": "testRunner",
58+
"arguments": {
59+
"databaseName": "papi-tests",
60+
"collectionName": "test"
61+
}
62+
}
63+
],
64+
"expectEvents": [
65+
{
66+
"client": "client0",
67+
"events": [
68+
{
69+
"commandStartedEvent": {
70+
"command": {
71+
"drop": "test"
72+
},
73+
"databaseName": "papi-tests"
74+
}
75+
},
76+
{
77+
"commandStartedEvent": {
78+
"command": {
79+
"create": "test",
80+
"changeStreamPreAndPostImages": {
81+
"enabled": true
82+
}
83+
},
84+
"databaseName": "papi-tests"
85+
}
86+
}
87+
]
88+
}
89+
]
90+
}
91+
]
92+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
description: "createCollection-pre_and_post_images"
2+
3+
schemaVersion: "1.4"
4+
5+
runOnRequirements:
6+
- minServerVersion: "6.0"
7+
serverless: forbid
8+
9+
createEntities:
10+
- client:
11+
id: &client0 client0
12+
observeEvents: [ commandStartedEvent ]
13+
- database:
14+
id: &database0 database0
15+
client: *client0
16+
databaseName: &database0Name papi-tests
17+
- collection:
18+
id: &collection0 collection0
19+
database: *database0
20+
collectionName: &collection0Name test
21+
22+
tests:
23+
- description: "createCollection with changeStreamPreAndPostImages enabled"
24+
operations:
25+
- name: dropCollection
26+
object: *database0
27+
arguments:
28+
collection: *collection0Name
29+
- name: createCollection
30+
object: *database0
31+
arguments:
32+
collection: *collection0Name
33+
changeStreamPreAndPostImages: { enabled: true }
34+
- name: assertCollectionExists
35+
object: testRunner
36+
arguments:
37+
databaseName: *database0Name
38+
collectionName: *collection0Name
39+
expectEvents:
40+
- client: *client0
41+
events:
42+
- commandStartedEvent:
43+
command:
44+
drop: *collection0Name
45+
databaseName: *database0Name
46+
- commandStartedEvent:
47+
command:
48+
create: *collection0Name
49+
changeStreamPreAndPostImages: { enabled: true }
50+
databaseName: *database0Name
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"description": "modifyCollection-pre_and_post_images",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "6.0",
7+
"serverless": "forbid"
8+
}
9+
],
10+
"createEntities": [
11+
{
12+
"client": {
13+
"id": "client0",
14+
"observeEvents": [
15+
"commandStartedEvent"
16+
]
17+
}
18+
},
19+
{
20+
"database": {
21+
"id": "database0",
22+
"client": "client0",
23+
"databaseName": "papi-tests"
24+
}
25+
},
26+
{
27+
"collection": {
28+
"id": "collection0",
29+
"database": "database0",
30+
"collectionName": "test"
31+
}
32+
}
33+
],
34+
"tests": [
35+
{
36+
"description": "modifyCollection to changeStreamPreAndPostImages enabled",
37+
"operations": [
38+
{
39+
"name": "dropCollection",
40+
"object": "database0",
41+
"arguments": {
42+
"collection": "test"
43+
}
44+
},
45+
{
46+
"name": "createCollection",
47+
"object": "database0",
48+
"arguments": {
49+
"collection": "test",
50+
"changeStreamPreAndPostImages": {
51+
"enabled": false
52+
}
53+
}
54+
},
55+
{
56+
"name": "assertCollectionExists",
57+
"object": "testRunner",
58+
"arguments": {
59+
"databaseName": "papi-tests",
60+
"collectionName": "test"
61+
}
62+
},
63+
{
64+
"name": "modifyCollection",
65+
"object": "database0",
66+
"arguments": {
67+
"collection": "test",
68+
"changeStreamPreAndPostImages": {
69+
"enabled": true
70+
}
71+
}
72+
}
73+
],
74+
"expectEvents": [
75+
{
76+
"client": "client0",
77+
"events": [
78+
{
79+
"commandStartedEvent": {
80+
"command": {
81+
"drop": "test"
82+
},
83+
"databaseName": "papi-tests"
84+
}
85+
},
86+
{
87+
"commandStartedEvent": {
88+
"command": {
89+
"create": "test",
90+
"changeStreamPreAndPostImages": {
91+
"enabled": false
92+
}
93+
}
94+
}
95+
},
96+
{
97+
"commandStartedEvent": {
98+
"command": {
99+
"collMod": "test",
100+
"changeStreamPreAndPostImages": {
101+
"enabled": true
102+
}
103+
}
104+
}
105+
}
106+
]
107+
}
108+
]
109+
}
110+
]
111+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
description: "modifyCollection-pre_and_post_images"
2+
3+
schemaVersion: "1.4"
4+
5+
runOnRequirements:
6+
- minServerVersion: "6.0"
7+
serverless: forbid
8+
9+
createEntities:
10+
- client:
11+
id: &client0 client0
12+
observeEvents: [ commandStartedEvent ]
13+
- database:
14+
id: &database0 database0
15+
client: *client0
16+
databaseName: &database0Name papi-tests
17+
- collection:
18+
id: &collection0 collection0
19+
database: *database0
20+
collectionName: &collection0Name test
21+
22+
tests:
23+
- description: "modifyCollection to changeStreamPreAndPostImages enabled"
24+
operations:
25+
- name: dropCollection
26+
object: *database0
27+
arguments:
28+
collection: *collection0Name
29+
- name: createCollection
30+
object: *database0
31+
arguments:
32+
collection: *collection0Name
33+
changeStreamPreAndPostImages: { enabled: false }
34+
- name: assertCollectionExists
35+
object: testRunner
36+
arguments:
37+
databaseName: *database0Name
38+
collectionName: *collection0Name
39+
- name: modifyCollection
40+
object: *database0
41+
arguments:
42+
collection: *collection0Name
43+
changeStreamPreAndPostImages: { enabled: true }
44+
expectEvents:
45+
- client: *client0
46+
events:
47+
- commandStartedEvent:
48+
command:
49+
drop: *collection0Name
50+
databaseName: *database0Name
51+
- commandStartedEvent:
52+
command:
53+
create: *collection0Name
54+
changeStreamPreAndPostImages: { enabled: false }
55+
- commandStartedEvent:
56+
command:
57+
collMod: *collection0Name
58+
changeStreamPreAndPostImages: { enabled: true }

0 commit comments

Comments
 (0)