File tree Expand file tree Collapse file tree 15 files changed +422
-242
lines changed
src/test/spec/json/index-management Expand file tree Collapse file tree 15 files changed +422
-242
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,6 @@ PREPARE_SHELL: |
55
55
export PROJECT_DIRECTORY="${PROJECT_DIRECTORY} "
56
56
export MONGOCRYPT_LIB_DIR="${MONGOCRYPT_LIB_DIR} "
57
57
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH} "
58
- export INDEX_MANAGEMENT_TEST_UNIFIED=1
59
58
60
59
export TMPDIR="${TMPDIR} "
61
60
export PATH="${PATH} "
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ if [ "$COMPRESSION" = true ]; then
22
22
fi
23
23
24
24
export SESSION_TEST_REQUIRE_MONGOCRYPTD=true
25
+ export INDEX_MANAGEMENT_TEST_UNIFIED=1
25
26
26
27
echo " cargo test options: $( cargo_test_options) "
27
28
Original file line number Diff line number Diff line change @@ -198,3 +198,26 @@ Case 5: ``dropSearchIndex`` suppresses namespace not found errors
198
198
199
199
#. Create a driver-side collection object for a randomly generated collection name. Do not create this collection on the server.
200
200
#. Run a ``dropSearchIndex `` command and assert that no error is thrown.
201
+
202
+ Case 6: Driver can successfully create and list search indexes with non-default readConcern and writeConcern
203
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
204
+
205
+ #. Create a collection with the "create" command using a randomly generated name (referred to as ``coll0 ``).
206
+ #. Apply a write concern ``WriteConcern(w=1) `` and a read concern with ``ReadConcern(level="majority") `` to ``coll0 ``.
207
+ #. Create a new search index on ``coll0 `` with the ``createSearchIndex `` helper. Use the following definition:
208
+
209
+ .. code :: typescript
210
+
211
+ {
212
+ name : ' test-search-index-case6' ,
213
+ definition : {
214
+ mappings : { dynamic : false }
215
+ }
216
+ }
217
+
218
+ #. Assert that the command returns the name of the index: ``"test-search-index-case6" ``.
219
+ #. Run ``coll0.listSearchIndexes() `` repeatedly every 5 seconds until the following condition is satisfied and store the value in a variable ``index ``:
220
+
221
+ - An index with the ``name `` of ``test-search-index-case6 `` is present and the index has a field ``queryable `` with a value of ``true ``.
222
+
223
+ #. Assert that ``index `` has a property ``latestDefinition `` whose value is ``{ 'mappings': { 'dynamic': false } } ``
Original file line number Diff line number Diff line change 55
55
},
56
56
"expectError" : {
57
57
"isError" : true ,
58
- "errorContains" : " Search index commands are only supported with Atlas"
58
+ "errorContains" : " Atlas"
59
59
}
60
60
}
61
61
],
102
102
},
103
103
"expectError" : {
104
104
"isError" : true ,
105
- "errorContains" : " Search index commands are only supported with Atlas"
105
+ "errorContains" : " Atlas"
106
106
}
107
107
}
108
108
],
Original file line number Diff line number Diff line change 30
30
expectError :
31
31
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
32
32
# that the driver constructs and sends the correct command.
33
+ # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
33
34
isError : true
34
- errorContains : Search index commands are only supported with Atlas
35
+ errorContains : Atlas
35
36
expectEvents :
36
37
- client : *client0
37
38
events :
@@ -50,13 +51,14 @@ tests:
50
51
expectError :
51
52
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
52
53
# that the driver constructs and sends the correct command.
54
+ # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
53
55
isError : true
54
- errorContains : Search index commands are only supported with Atlas
56
+ errorContains : Atlas
55
57
expectEvents :
56
58
- client : *client0
57
59
events :
58
60
- commandStartedEvent :
59
61
command :
60
62
createSearchIndexes : *collection0
61
63
indexes : [ { definition: *definition, name: 'test index' } ]
62
- $db : *database0
64
+ $db : *database0
Original file line number Diff line number Diff line change 49
49
},
50
50
"expectError" : {
51
51
"isError" : true ,
52
- "errorContains" : " Search index commands are only supported with Atlas"
52
+ "errorContains" : " Atlas"
53
53
}
54
54
}
55
55
],
89
89
},
90
90
"expectError" : {
91
91
"isError" : true ,
92
- "errorContains" : " Search index commands are only supported with Atlas"
92
+ "errorContains" : " Atlas"
93
93
}
94
94
}
95
95
],
138
138
},
139
139
"expectError" : {
140
140
"isError" : true ,
141
- "errorContains" : " Search index commands are only supported with Atlas"
141
+ "errorContains" : " Atlas"
142
142
}
143
143
}
144
144
],
Original file line number Diff line number Diff line change 30
30
expectError :
31
31
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
32
32
# that the driver constructs and sends the correct command.
33
+ # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
33
34
isError : true
34
- errorContains : Search index commands are only supported with Atlas
35
+ errorContains : Atlas
35
36
expectEvents :
36
37
- client : *client0
37
38
events :
51
52
expectError :
52
53
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
53
54
# that the driver constructs and sends the correct command.
55
+ # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
54
56
isError : true
55
- errorContains : Search index commands are only supported with Atlas
57
+ errorContains : Atlas
56
58
expectEvents :
57
59
- client : *client0
58
60
events :
@@ -71,13 +73,14 @@ tests:
71
73
expectError :
72
74
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
73
75
# that the driver constructs and sends the correct command.
76
+ # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
74
77
isError : true
75
- errorContains : Search index commands are only supported with Atlas
78
+ errorContains : Atlas
76
79
expectEvents :
77
80
- client : *client0
78
81
events :
79
82
- commandStartedEvent :
80
83
command :
81
84
createSearchIndexes : *collection0
82
85
indexes : [ { definition: *definition, name: 'test index' } ]
83
- $db : *database0
86
+ $db : *database0
Original file line number Diff line number Diff line change 49
49
},
50
50
"expectError" : {
51
51
"isError" : true ,
52
- "errorContains" : " Search index commands are only supported with Atlas"
52
+ "errorContains" : " Atlas"
53
53
}
54
54
}
55
55
],
Original file line number Diff line number Diff line change 30
30
expectError :
31
31
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
32
32
# that the driver constructs and sends the correct command.
33
+ # The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
33
34
isError : true
34
- errorContains : Search index commands are only supported with Atlas
35
+ errorContains : Atlas
35
36
expectEvents :
36
37
- client : *client0
37
38
events :
Original file line number Diff line number Diff line change 46
46
"object" : " collection0" ,
47
47
"expectError" : {
48
48
"isError" : true ,
49
- "errorContains" : " Search index commands are only supported with Atlas"
49
+ "errorContains" : " Atlas"
50
50
}
51
51
}
52
52
],
81
81
},
82
82
"expectError" : {
83
83
"isError" : true ,
84
- "errorContains" : " Search index commands are only supported with Atlas"
84
+ "errorContains" : " Atlas"
85
85
}
86
86
}
87
87
],
122
122
},
123
123
"expectError" : {
124
124
"isError" : true ,
125
- "errorContains" : " Search index commands are only supported with Atlas"
125
+ "errorContains" : " Atlas"
126
126
}
127
127
}
128
128
],
You can’t perform that action at this time.
0 commit comments