mongo 2.14.1 → 2.15.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +4 -1
- data/Rakefile +8 -15
- data/lib/mongo/auth/aws/conversation.rb +1 -4
- data/lib/mongo/auth/base.rb +13 -7
- data/lib/mongo/auth/conversation_base.rb +32 -0
- data/lib/mongo/auth/cr/conversation.rb +6 -29
- data/lib/mongo/auth/gssapi/conversation.rb +4 -15
- data/lib/mongo/auth/ldap/conversation.rb +3 -14
- data/lib/mongo/auth/sasl_conversation_base.rb +1 -13
- data/lib/mongo/auth/scram_conversation_base.rb +7 -34
- data/lib/mongo/auth/user/view.rb +16 -9
- data/lib/mongo/auth/x509/conversation.rb +4 -25
- data/lib/mongo/bulk_write.rb +21 -18
- data/lib/mongo/client.rb +82 -6
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +6 -2
- data/lib/mongo/cluster.rb +19 -2
- data/lib/mongo/collection/view/aggregation.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +7 -17
- data/lib/mongo/collection/view/map_reduce.rb +2 -2
- data/lib/mongo/collection/view/readable.rb +42 -20
- data/lib/mongo/collection/view/writable.rb +14 -14
- data/lib/mongo/collection.rb +6 -6
- data/lib/mongo/cursor.rb +2 -12
- data/lib/mongo/database/view.rb +1 -1
- data/lib/mongo/database.rb +8 -3
- data/lib/mongo/error/bulk_write_error.rb +17 -3
- data/lib/mongo/error/internal_driver_error.rb +22 -0
- data/lib/mongo/error/operation_failure.rb +21 -2
- data/lib/mongo/error/parser.rb +65 -12
- data/lib/mongo/error/server_api_conflict.rb +23 -0
- data/lib/mongo/error/server_api_not_supported.rb +24 -0
- data/lib/mongo/error/unmet_dependency.rb +21 -0
- data/lib/mongo/error.rb +9 -1
- data/lib/mongo/index/view.rb +21 -11
- data/lib/mongo/monitoring/event/server_heartbeat_failed.rb +27 -16
- data/lib/mongo/monitoring/event/server_heartbeat_succeeded.rb +26 -15
- data/lib/mongo/monitoring.rb +13 -4
- data/lib/mongo/operation/collections_info/command.rb +2 -2
- data/lib/mongo/operation/collections_info.rb +18 -1
- data/lib/mongo/operation/context.rb +99 -0
- data/lib/mongo/operation/indexes.rb +15 -1
- data/lib/mongo/operation/insert/command.rb +2 -2
- data/lib/mongo/operation/insert/legacy.rb +2 -2
- data/lib/mongo/operation/insert/op_msg.rb +2 -2
- data/lib/mongo/operation/list_collections/result.rb +4 -1
- data/lib/mongo/operation/parallel_scan/command.rb +2 -1
- data/lib/mongo/operation/result.rb +2 -0
- data/lib/mongo/operation/shared/executable.rb +24 -14
- data/lib/mongo/operation/shared/executable_no_validate.rb +2 -2
- data/lib/mongo/operation/shared/op_msg_or_command.rb +1 -7
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +1 -7
- data/lib/mongo/operation/shared/polymorphic_operation.rb +39 -0
- data/lib/mongo/operation/shared/read_preference_supported.rb +36 -38
- data/lib/mongo/operation/shared/response_handling.rb +23 -23
- data/lib/mongo/operation/shared/sessions_supported.rb +15 -5
- data/lib/mongo/operation/shared/write.rb +8 -18
- data/lib/mongo/operation.rb +2 -2
- data/lib/mongo/protocol/compressed.rb +51 -5
- data/lib/mongo/protocol/message.rb +20 -2
- data/lib/mongo/protocol/msg.rb +38 -13
- data/lib/mongo/protocol/query.rb +11 -11
- data/lib/mongo/query_cache.rb +30 -0
- data/lib/mongo/retryable.rb +1 -1
- data/lib/mongo/server/app_metadata.rb +52 -18
- data/lib/mongo/server/connection.rb +5 -0
- data/lib/mongo/server/connection_base.rb +13 -10
- data/lib/mongo/server/connection_pool.rb +6 -2
- data/lib/mongo/server/description/features.rb +9 -8
- data/lib/mongo/server/description.rb +4 -0
- data/lib/mongo/server/monitor/app_metadata.rb +1 -1
- data/lib/mongo/server/monitor/connection.rb +9 -10
- data/lib/mongo/server/monitor.rb +20 -1
- data/lib/mongo/server/pending_connection.rb +24 -6
- data/lib/mongo/server/push_monitor.rb +11 -1
- data/lib/mongo/server.rb +7 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +7 -2
- data/lib/mongo/session/session_pool.rb +4 -2
- data/lib/mongo/session.rb +2 -2
- data/lib/mongo/socket/ssl.rb +8 -0
- data/lib/mongo/socket.rb +29 -4
- data/lib/mongo/uri/options_mapper.rb +38 -0
- data/lib/mongo/utils.rb +15 -0
- data/lib/mongo/version.rb +1 -1
- data/lib/mongo.rb +23 -0
- data/spec/README.md +24 -1
- data/spec/integration/auth_spec.rb +25 -15
- data/spec/integration/bulk_write_error_message_spec.rb +41 -0
- data/spec/integration/change_stream_spec.rb +4 -4
- data/spec/integration/command_monitoring_spec.rb +2 -2
- data/spec/integration/connection_spec.rb +2 -0
- data/spec/integration/docs_examples_spec.rb +8 -1
- data/spec/integration/fork_reconnect_spec.rb +4 -1
- data/spec/integration/ocsp_verifier_spec.rb +13 -7
- data/spec/integration/operation_failure_code_spec.rb +1 -1
- data/spec/integration/operation_failure_message_spec.rb +90 -0
- data/spec/integration/query_cache_spec.rb +0 -45
- data/spec/integration/reconnect_spec.rb +1 -1
- data/spec/integration/snappy_compression_spec.rb +25 -0
- data/spec/integration/srv_monitoring_spec.rb +1 -1
- data/spec/integration/transactions_examples_spec.rb +6 -0
- data/spec/integration/zlib_compression_spec.rb +1 -1
- data/spec/integration/zstd_compression_spec.rb +26 -0
- data/spec/lite_spec_helper.rb +7 -1
- data/spec/mongo/address_spec.rb +15 -11
- data/spec/mongo/auth/ldap/conversation_spec.rb +1 -1
- data/spec/mongo/auth/ldap_spec.rb +5 -1
- data/spec/mongo/auth/scram_negotiation_spec.rb +1 -1
- data/spec/mongo/auth/scram_spec.rb +1 -1
- data/spec/mongo/auth/x509/conversation_spec.rb +3 -3
- data/spec/mongo/client_construction_spec.rb +207 -33
- data/spec/mongo/client_spec.rb +17 -0
- data/spec/mongo/cluster_spec.rb +1 -0
- data/spec/mongo/collection/view/explainable_spec.rb +1 -1
- data/spec/mongo/collection/view/readable_spec.rb +33 -19
- data/spec/mongo/collection_crud_spec.rb +4357 -0
- data/spec/mongo/collection_ddl_spec.rb +534 -0
- data/spec/mongo/collection_spec.rb +5 -4859
- data/spec/mongo/database_spec.rb +66 -4
- data/spec/mongo/error/bulk_write_error_spec.rb +3 -3
- data/spec/mongo/error/parser_spec.rb +37 -6
- data/spec/mongo/index/view_spec.rb +4 -0
- data/spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb +1 -1
- data/spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb +1 -1
- data/spec/mongo/operation/aggregate_spec.rb +2 -1
- data/spec/mongo/operation/collections_info_spec.rb +4 -1
- data/spec/mongo/operation/command_spec.rb +6 -3
- data/spec/mongo/operation/create_index_spec.rb +6 -3
- data/spec/mongo/operation/create_user_spec.rb +6 -3
- data/spec/mongo/operation/delete/bulk_spec.rb +9 -6
- data/spec/mongo/operation/delete_spec.rb +11 -7
- data/spec/mongo/operation/drop_index_spec.rb +6 -2
- data/spec/mongo/operation/find/legacy_spec.rb +3 -1
- data/spec/mongo/operation/get_more_spec.rb +3 -1
- data/spec/mongo/operation/indexes_spec.rb +5 -1
- data/spec/mongo/operation/insert/bulk_spec.rb +10 -7
- data/spec/mongo/operation/insert_spec.rb +15 -12
- data/spec/mongo/operation/map_reduce_spec.rb +5 -2
- data/spec/mongo/operation/read_preference_legacy_spec.rb +19 -9
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +3 -3
- data/spec/mongo/operation/remove_user_spec.rb +6 -3
- data/spec/mongo/operation/result_spec.rb +1 -1
- data/spec/mongo/operation/update/bulk_spec.rb +9 -6
- data/spec/mongo/operation/update_spec.rb +10 -7
- data/spec/mongo/operation/update_user_spec.rb +4 -1
- data/spec/mongo/protocol/compressed_spec.rb +26 -12
- data/spec/mongo/query_cache_middleware_spec.rb +55 -0
- data/spec/mongo/retryable_spec.rb +3 -2
- data/spec/mongo/server/app_metadata_shared.rb +7 -33
- data/spec/mongo/server/app_metadata_spec.rb +2 -0
- data/spec/mongo/server/connection_pool/populator_spec.rb +3 -1
- data/spec/mongo/server/connection_pool_spec.rb +1 -1
- data/spec/mongo/server/connection_spec.rb +24 -17
- data/spec/mongo/server/monitor/connection_spec.rb +17 -7
- data/spec/mongo/server/monitor_spec.rb +9 -1
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +6 -6
- data/spec/mongo/server_spec.rb +15 -2
- data/spec/mongo/socket/ssl_spec.rb +40 -0
- data/spec/mongo/socket_spec.rb +2 -2
- data/spec/mongo/tls_context_hooks_spec.rb +37 -0
- data/spec/runners/connection_string.rb +0 -4
- data/spec/runners/crud/requirement.rb +40 -3
- data/spec/runners/crud/verifier.rb +8 -0
- data/spec/runners/transactions/operation.rb +1 -1
- data/spec/runners/transactions/test.rb +1 -0
- data/spec/runners/unified/assertions.rb +249 -0
- data/spec/runners/unified/change_stream_operations.rb +26 -0
- data/spec/runners/unified/crud_operations.rb +199 -0
- data/spec/runners/unified/ddl_operations.rb +96 -0
- data/spec/runners/unified/entity_map.rb +39 -0
- data/spec/runners/unified/error.rb +25 -0
- data/spec/runners/unified/event_subscriber.rb +91 -0
- data/spec/runners/unified/exceptions.rb +21 -0
- data/spec/runners/unified/grid_fs_operations.rb +55 -0
- data/spec/runners/unified/support_operations.rb +250 -0
- data/spec/runners/unified/test.rb +393 -0
- data/spec/runners/unified/test_group.rb +28 -0
- data/spec/runners/unified/using_hash.rb +31 -0
- data/spec/runners/unified.rb +96 -0
- data/spec/shared/lib/mrss/cluster_config.rb +0 -3
- data/spec/shared/lib/mrss/docker_runner.rb +0 -3
- data/spec/shared/lib/mrss/lite_constraints.rb +0 -16
- data/spec/shared/lib/mrss/server_version_registry.rb +0 -3
- data/spec/shared/lib/mrss/spec_organizer.rb +0 -3
- data/spec/shared/shlib/server.sh +1 -1
- data/spec/spec_helper.rb +4 -1
- data/spec/spec_tests/crud_unified_spec.rb +10 -0
- data/spec/spec_tests/data/change_streams/change-streams.yml +0 -1
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount.yml +267 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-4.9.yml +60 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount.yml → estimatedDocumentCount-pre4.9.yml} +2 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-4.9.yml +146 -0
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-serverErrors.yml → estimatedDocumentCount-serverErrors-pre4.9.yml} +2 -0
- data/spec/spec_tests/data/retryable_reads/listIndexNames.yml +1 -1
- data/spec/spec_tests/data/unified/valid-fail/operation-failure.yml +31 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-change-streams.yml +220 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-command-monitoring.yml +102 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-crud.yml +184 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-gridfs.yml +155 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-reads.yml +193 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-writes.yml +210 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-sessions.yml +215 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-convenient-api.yml +235 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-mongos-pin-auto.yml +169 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +170 -0
- data/spec/spec_tests/data/uri_options/compression-options.yml +1 -1
- data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +416 -0
- data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +409 -0
- data/spec/spec_tests/data/versioned_api/runcommand-helper-no-api-version-declared.yml +67 -0
- data/spec/spec_tests/data/versioned_api/test-commands-deprecation-errors.yml +47 -0
- data/spec/spec_tests/data/versioned_api/test-commands-strict-mode.yml +44 -0
- data/spec/spec_tests/data/versioned_api/transaction-handling.yml +180 -0
- data/spec/spec_tests/unified_spec.rb +15 -0
- data/spec/spec_tests/uri_options_spec.rb +16 -0
- data/spec/spec_tests/versioned_api_spec.rb +10 -0
- data/spec/support/client_registry.rb +4 -8
- data/spec/support/client_registry_macros.rb +4 -4
- data/spec/support/common_shortcuts.rb +15 -1
- data/spec/support/shared/session.rb +2 -2
- data/spec/support/spec_config.rb +42 -11
- data/spec/support/utils.rb +64 -3
- data.tar.gz.sig +0 -0
- metadata +1005 -915
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/shared/collections_info_or_list_collections.rb +0 -58
- data/lib/mongo/operation/shared/op_msg_or_list_indexes_command.rb +0 -47
- data/spec/integration/secondary_reads_spec.rb +0 -102
- data/spec/support/cluster_config.rb +0 -207
@@ -0,0 +1,409 @@
|
|
1
|
+
description: "CRUD Api Version 1"
|
2
|
+
|
3
|
+
schemaVersion: "1.1"
|
4
|
+
|
5
|
+
runOnRequirements:
|
6
|
+
- minServerVersion: "4.9"
|
7
|
+
|
8
|
+
createEntities:
|
9
|
+
- client:
|
10
|
+
id: &client client
|
11
|
+
observeEvents:
|
12
|
+
- commandStartedEvent
|
13
|
+
serverApi:
|
14
|
+
version: "1"
|
15
|
+
# Deprecation errors is set to true to ensure that drivers don't use any
|
16
|
+
# deprecated server API in their logic.
|
17
|
+
deprecationErrors: true
|
18
|
+
- database:
|
19
|
+
id: &database database
|
20
|
+
client: *client
|
21
|
+
databaseName: &databaseName versioned-api-tests
|
22
|
+
- database:
|
23
|
+
id: &adminDatabase adminDatabase
|
24
|
+
client: *client
|
25
|
+
databaseName: &adminDatabaseName admin
|
26
|
+
- collection:
|
27
|
+
id: &collection collection
|
28
|
+
database: *database
|
29
|
+
collectionName: &collectionName test
|
30
|
+
|
31
|
+
_yamlAnchors:
|
32
|
+
versions:
|
33
|
+
- &expectedApiVersion
|
34
|
+
apiVersion: "1"
|
35
|
+
apiStrict: { $$unsetOrMatches: false }
|
36
|
+
apiDeprecationErrors: true
|
37
|
+
|
38
|
+
initialData:
|
39
|
+
- collectionName: *collectionName
|
40
|
+
databaseName: *databaseName
|
41
|
+
documents:
|
42
|
+
- { _id: 1, x: 11 }
|
43
|
+
- { _id: 2, x: 22 }
|
44
|
+
- { _id: 3, x: 33 }
|
45
|
+
- { _id: 4, x: 44 }
|
46
|
+
- { _id: 5, x: 55 }
|
47
|
+
|
48
|
+
tests:
|
49
|
+
- description: "aggregate on collection appends declared API version"
|
50
|
+
operations:
|
51
|
+
- name: aggregate
|
52
|
+
object: *collection
|
53
|
+
arguments:
|
54
|
+
pipeline: &pipeline
|
55
|
+
- $sort: { x : 1 }
|
56
|
+
- $match: { _id: { $gt: 1 } }
|
57
|
+
expectEvents:
|
58
|
+
- client: *client
|
59
|
+
events:
|
60
|
+
- commandStartedEvent:
|
61
|
+
command:
|
62
|
+
aggregate: *collectionName
|
63
|
+
pipeline: *pipeline
|
64
|
+
<<: *expectedApiVersion
|
65
|
+
|
66
|
+
- description: "aggregate on database appends declared API version"
|
67
|
+
operations:
|
68
|
+
- name: aggregate
|
69
|
+
object: *adminDatabase
|
70
|
+
arguments:
|
71
|
+
pipeline: &pipeline
|
72
|
+
- $listLocalSessions: {}
|
73
|
+
- $limit: 1
|
74
|
+
expectEvents:
|
75
|
+
- client: *client
|
76
|
+
events:
|
77
|
+
- commandStartedEvent:
|
78
|
+
command:
|
79
|
+
aggregate: 1
|
80
|
+
pipeline: *pipeline
|
81
|
+
<<: *expectedApiVersion
|
82
|
+
|
83
|
+
- description: "bulkWrite appends declared API version"
|
84
|
+
operations:
|
85
|
+
- name: bulkWrite
|
86
|
+
object: *collection
|
87
|
+
arguments:
|
88
|
+
requests:
|
89
|
+
- insertOne:
|
90
|
+
document: { _id: 6, x: 66 }
|
91
|
+
- updateOne:
|
92
|
+
filter: { _id: 2 }
|
93
|
+
update: { $inc: { x: 1 } }
|
94
|
+
- deleteMany:
|
95
|
+
filter: { x: { $nin: [ 24, 34 ] } }
|
96
|
+
- updateMany:
|
97
|
+
filter: { _id: { $gt: 1 } }
|
98
|
+
update: { $inc: { x: 1 } }
|
99
|
+
- deleteOne:
|
100
|
+
filter: { _id: 7 }
|
101
|
+
- replaceOne:
|
102
|
+
filter: { _id: 4 }
|
103
|
+
replacement: { _id: 4, x: 44 }
|
104
|
+
upsert: true
|
105
|
+
ordered: true
|
106
|
+
expectEvents:
|
107
|
+
- client: *client
|
108
|
+
events:
|
109
|
+
- commandStartedEvent:
|
110
|
+
command:
|
111
|
+
insert: *collectionName
|
112
|
+
documents:
|
113
|
+
- { _id: 6, x: 66 }
|
114
|
+
<<: *expectedApiVersion
|
115
|
+
- commandStartedEvent:
|
116
|
+
command:
|
117
|
+
update: *collectionName
|
118
|
+
updates:
|
119
|
+
- q: { _id: 2 }
|
120
|
+
u: { $inc: { x: 1 } }
|
121
|
+
multi: { $$unsetOrMatches: false }
|
122
|
+
upsert: { $$unsetOrMatches: false }
|
123
|
+
<<: *expectedApiVersion
|
124
|
+
- commandStartedEvent:
|
125
|
+
command:
|
126
|
+
delete: *collectionName
|
127
|
+
deletes:
|
128
|
+
- { q: { x: { $nin: [ 24, 34 ] } }, limit: 0 }
|
129
|
+
<<: *expectedApiVersion
|
130
|
+
- commandStartedEvent:
|
131
|
+
command:
|
132
|
+
update: *collectionName
|
133
|
+
updates:
|
134
|
+
- q: { _id: { $gt: 1 } }
|
135
|
+
u: { $inc: { x: 1 } }
|
136
|
+
multi: true
|
137
|
+
upsert: { $$unsetOrMatches: false }
|
138
|
+
<<: *expectedApiVersion
|
139
|
+
- commandStartedEvent:
|
140
|
+
command:
|
141
|
+
delete: *collectionName
|
142
|
+
deletes:
|
143
|
+
- { q: { _id: 7 }, limit: 1 }
|
144
|
+
<<: *expectedApiVersion
|
145
|
+
- commandStartedEvent:
|
146
|
+
command:
|
147
|
+
update: *collectionName
|
148
|
+
updates:
|
149
|
+
- q: { _id: 4 }
|
150
|
+
u: { _id: 4, x: 44 }
|
151
|
+
multi: { $$unsetOrMatches: false }
|
152
|
+
upsert: true
|
153
|
+
<<: *expectedApiVersion
|
154
|
+
|
155
|
+
- description: "countDocuments appends declared API version"
|
156
|
+
operations:
|
157
|
+
- name: countDocuments
|
158
|
+
object: *collection
|
159
|
+
arguments:
|
160
|
+
filter: &filter
|
161
|
+
x : { $gt: 11 }
|
162
|
+
expectEvents:
|
163
|
+
- client: *client
|
164
|
+
events:
|
165
|
+
- commandStartedEvent:
|
166
|
+
command:
|
167
|
+
aggregate: *collectionName
|
168
|
+
pipeline:
|
169
|
+
- { $match: *filter }
|
170
|
+
- { $group: { _id: 1, n: { $sum: 1 } } }
|
171
|
+
<<: *expectedApiVersion
|
172
|
+
|
173
|
+
- description: "deleteMany appends declared API version"
|
174
|
+
operations:
|
175
|
+
- name: deleteMany
|
176
|
+
object: *collection
|
177
|
+
arguments:
|
178
|
+
filter: { x: { $nin: [ 24, 34 ] } }
|
179
|
+
expectEvents:
|
180
|
+
- client: *client
|
181
|
+
events:
|
182
|
+
- commandStartedEvent:
|
183
|
+
command:
|
184
|
+
delete: *collectionName
|
185
|
+
deletes:
|
186
|
+
- { q: { x: { $nin: [ 24, 34 ] } }, limit: 0 }
|
187
|
+
<<: *expectedApiVersion
|
188
|
+
|
189
|
+
- description: "deleteOne appends declared API version"
|
190
|
+
operations:
|
191
|
+
- name: deleteOne
|
192
|
+
object: *collection
|
193
|
+
arguments:
|
194
|
+
filter: { _id: 7 }
|
195
|
+
expectEvents:
|
196
|
+
- client: *client
|
197
|
+
events:
|
198
|
+
- commandStartedEvent:
|
199
|
+
command:
|
200
|
+
delete: *collectionName
|
201
|
+
deletes:
|
202
|
+
- { q: { _id: 7 }, limit: 1 }
|
203
|
+
<<: *expectedApiVersion
|
204
|
+
|
205
|
+
- description: "distinct appends declared API version"
|
206
|
+
operations:
|
207
|
+
- name: distinct
|
208
|
+
object: *collection
|
209
|
+
arguments:
|
210
|
+
fieldName: x
|
211
|
+
filter: {}
|
212
|
+
expectEvents:
|
213
|
+
- client: *client
|
214
|
+
events:
|
215
|
+
- commandStartedEvent:
|
216
|
+
command:
|
217
|
+
distinct: *collectionName
|
218
|
+
key: x
|
219
|
+
<<: *expectedApiVersion
|
220
|
+
|
221
|
+
- description: "estimatedDocumentCount appends declared API version on 4.9.0 or greater"
|
222
|
+
operations:
|
223
|
+
- name: estimatedDocumentCount
|
224
|
+
object: *collection
|
225
|
+
arguments: {}
|
226
|
+
expectEvents:
|
227
|
+
- client: *client
|
228
|
+
events:
|
229
|
+
- commandStartedEvent:
|
230
|
+
command:
|
231
|
+
aggregate: *collectionName
|
232
|
+
pipeline: &pipeline
|
233
|
+
- $collStats: { count: {} }
|
234
|
+
- $group: { _id: 1, n: { $sum: $count }}
|
235
|
+
<<: *expectedApiVersion
|
236
|
+
|
237
|
+
- description: "find command with declared API version appends to the command, but getMore does not"
|
238
|
+
operations:
|
239
|
+
- name: find
|
240
|
+
object: *collection
|
241
|
+
arguments:
|
242
|
+
filter: {}
|
243
|
+
sort: { _id: 1 }
|
244
|
+
batchSize: 3
|
245
|
+
expectResult:
|
246
|
+
- { _id: 1, x: 11 }
|
247
|
+
- { _id: 2, x: 22 }
|
248
|
+
- { _id: 3, x: 33 }
|
249
|
+
- { _id: 4, x: 44 }
|
250
|
+
- { _id: 5, x: 55 }
|
251
|
+
expectEvents:
|
252
|
+
- client: *client
|
253
|
+
events:
|
254
|
+
- commandStartedEvent:
|
255
|
+
command:
|
256
|
+
find: *collectionName
|
257
|
+
<<: *expectedApiVersion
|
258
|
+
- commandStartedEvent:
|
259
|
+
command:
|
260
|
+
getMore: { $$type: [ int, long ] }
|
261
|
+
apiVersion: { $$exists: false }
|
262
|
+
apiStrict: { $$exists: false }
|
263
|
+
apiDeprecationErrors: { $$exists: false }
|
264
|
+
|
265
|
+
- description: "findOneAndDelete appends declared API version"
|
266
|
+
operations:
|
267
|
+
- name: findOneAndDelete
|
268
|
+
object: *collection
|
269
|
+
arguments:
|
270
|
+
filter: &filter { _id: 1 }
|
271
|
+
expectEvents:
|
272
|
+
- client: *client
|
273
|
+
events:
|
274
|
+
- commandStartedEvent:
|
275
|
+
command:
|
276
|
+
findAndModify: *collectionName
|
277
|
+
query: *filter
|
278
|
+
remove: true
|
279
|
+
<<: *expectedApiVersion
|
280
|
+
|
281
|
+
- description: "findOneAndReplace appends declared API version"
|
282
|
+
operations:
|
283
|
+
- name: findOneAndReplace
|
284
|
+
object: *collection
|
285
|
+
arguments:
|
286
|
+
filter: &filter { _id: 1 }
|
287
|
+
replacement: &replacement { x: 33 }
|
288
|
+
expectEvents:
|
289
|
+
- client: *client
|
290
|
+
events:
|
291
|
+
- commandStartedEvent:
|
292
|
+
command:
|
293
|
+
findAndModify: *collectionName
|
294
|
+
query: *filter
|
295
|
+
update: *replacement
|
296
|
+
<<: *expectedApiVersion
|
297
|
+
|
298
|
+
- description: "findOneAndUpdate appends declared API version"
|
299
|
+
operations:
|
300
|
+
- name: findOneAndUpdate
|
301
|
+
object: collection
|
302
|
+
arguments:
|
303
|
+
filter: &filter { _id: 1 }
|
304
|
+
update: &update { $inc: { x: 1 } }
|
305
|
+
expectEvents:
|
306
|
+
- client: *client
|
307
|
+
events:
|
308
|
+
- commandStartedEvent:
|
309
|
+
command:
|
310
|
+
findAndModify: *collectionName
|
311
|
+
query: *filter
|
312
|
+
update: *update
|
313
|
+
<<: *expectedApiVersion
|
314
|
+
|
315
|
+
- description: "insertMany appends declared API version"
|
316
|
+
operations:
|
317
|
+
- name: insertMany
|
318
|
+
object: *collection
|
319
|
+
arguments:
|
320
|
+
documents:
|
321
|
+
- { _id: 6, x: 66 }
|
322
|
+
- { _id: 7, x: 77 }
|
323
|
+
expectEvents:
|
324
|
+
- client: *client
|
325
|
+
events:
|
326
|
+
- commandStartedEvent:
|
327
|
+
command:
|
328
|
+
insert: *collectionName
|
329
|
+
documents:
|
330
|
+
- { _id: 6, x: 66 }
|
331
|
+
- { _id: 7, x: 77 }
|
332
|
+
<<: *expectedApiVersion
|
333
|
+
|
334
|
+
- description: "insertOne appends declared API version"
|
335
|
+
operations:
|
336
|
+
- name: insertOne
|
337
|
+
object: *collection
|
338
|
+
arguments:
|
339
|
+
document: { _id: 6, x: 66 }
|
340
|
+
expectEvents:
|
341
|
+
- client: *client
|
342
|
+
events:
|
343
|
+
- commandStartedEvent:
|
344
|
+
command:
|
345
|
+
insert: *collectionName
|
346
|
+
documents:
|
347
|
+
- { _id: 6, x: 66 }
|
348
|
+
<<: *expectedApiVersion
|
349
|
+
|
350
|
+
- description: "replaceOne appends declared API version"
|
351
|
+
operations:
|
352
|
+
- name: replaceOne
|
353
|
+
object: *collection
|
354
|
+
arguments:
|
355
|
+
filter: { _id: 4 }
|
356
|
+
replacement: { _id: 4, x: 44 }
|
357
|
+
upsert: true
|
358
|
+
expectEvents:
|
359
|
+
- client: *client
|
360
|
+
events:
|
361
|
+
- commandStartedEvent:
|
362
|
+
command:
|
363
|
+
update: *collectionName
|
364
|
+
updates:
|
365
|
+
- q: { _id: 4 }
|
366
|
+
u: { _id: 4, x: 44 }
|
367
|
+
multi: { $$unsetOrMatches: false }
|
368
|
+
upsert: true
|
369
|
+
<<: *expectedApiVersion
|
370
|
+
|
371
|
+
- description: "updateMany appends declared API version"
|
372
|
+
operations:
|
373
|
+
- name: updateMany
|
374
|
+
object: *collection
|
375
|
+
arguments:
|
376
|
+
filter: { _id: { $gt: 1 } }
|
377
|
+
update: { $inc: { x: 1 } }
|
378
|
+
expectEvents:
|
379
|
+
- client: *client
|
380
|
+
events:
|
381
|
+
- commandStartedEvent:
|
382
|
+
command:
|
383
|
+
update: *collectionName
|
384
|
+
updates:
|
385
|
+
- q: { _id: { $gt: 1 } }
|
386
|
+
u: { $inc: { x: 1 } }
|
387
|
+
multi: true
|
388
|
+
upsert: { $$unsetOrMatches: false }
|
389
|
+
<<: *expectedApiVersion
|
390
|
+
|
391
|
+
- description: "updateOne appends declared API version"
|
392
|
+
operations:
|
393
|
+
- name: updateOne
|
394
|
+
object: *collection
|
395
|
+
arguments:
|
396
|
+
filter: { _id: 2 }
|
397
|
+
update: { $inc: { x: 1 } }
|
398
|
+
expectEvents:
|
399
|
+
- client: *client
|
400
|
+
events:
|
401
|
+
- commandStartedEvent:
|
402
|
+
command:
|
403
|
+
update: *collectionName
|
404
|
+
updates:
|
405
|
+
- q: { _id: 2 }
|
406
|
+
u: { $inc: { x: 1 } }
|
407
|
+
multi: { $$unsetOrMatches: false }
|
408
|
+
upsert: { $$unsetOrMatches: false }
|
409
|
+
<<: *expectedApiVersion
|
@@ -0,0 +1,67 @@
|
|
1
|
+
description: "RunCommand helper: No API version declared"
|
2
|
+
|
3
|
+
schemaVersion: "1.1"
|
4
|
+
|
5
|
+
runOnRequirements:
|
6
|
+
- minServerVersion: "4.9"
|
7
|
+
serverParameters:
|
8
|
+
requireApiVersion: false
|
9
|
+
|
10
|
+
createEntities:
|
11
|
+
- client:
|
12
|
+
id: &client client
|
13
|
+
observeEvents:
|
14
|
+
- commandStartedEvent
|
15
|
+
- database:
|
16
|
+
id: &database database
|
17
|
+
client: *client
|
18
|
+
databaseName: &databaseName versioned-api-tests
|
19
|
+
|
20
|
+
tests:
|
21
|
+
- description: "runCommand does not inspect or change the command document"
|
22
|
+
operations:
|
23
|
+
- name: runCommand
|
24
|
+
object: *database
|
25
|
+
arguments:
|
26
|
+
commandName: ping
|
27
|
+
command:
|
28
|
+
ping: 1
|
29
|
+
apiVersion: "server_will_never_support_this_api_version"
|
30
|
+
expectError:
|
31
|
+
isError: true
|
32
|
+
isClientError: false
|
33
|
+
expectEvents:
|
34
|
+
- client: *client
|
35
|
+
events:
|
36
|
+
- commandStartedEvent:
|
37
|
+
command:
|
38
|
+
ping: 1
|
39
|
+
apiVersion: "server_will_never_support_this_api_version"
|
40
|
+
apiStrict: { $$exists: false }
|
41
|
+
apiDeprecationErrors: { $$exists: false }
|
42
|
+
commandName: ping
|
43
|
+
databaseName: *databaseName
|
44
|
+
|
45
|
+
- description: "runCommand does not prevent sending invalid API version declarations"
|
46
|
+
operations:
|
47
|
+
- name: runCommand
|
48
|
+
object: *database
|
49
|
+
arguments:
|
50
|
+
commandName: ping
|
51
|
+
command:
|
52
|
+
ping: 1
|
53
|
+
apiStrict: true
|
54
|
+
expectError:
|
55
|
+
isError: true
|
56
|
+
isClientError: false
|
57
|
+
expectEvents:
|
58
|
+
- client: *client
|
59
|
+
events:
|
60
|
+
- commandStartedEvent:
|
61
|
+
command:
|
62
|
+
ping: 1
|
63
|
+
apiVersion: { $$exists: false }
|
64
|
+
apiStrict: true
|
65
|
+
apiDeprecationErrors: { $$exists: false }
|
66
|
+
commandName: ping
|
67
|
+
databaseName: *databaseName
|
@@ -0,0 +1,47 @@
|
|
1
|
+
description: "Test commands: deprecation errors"
|
2
|
+
|
3
|
+
schemaVersion: "1.1"
|
4
|
+
|
5
|
+
runOnRequirements:
|
6
|
+
- minServerVersion: "4.9"
|
7
|
+
serverParameters:
|
8
|
+
enableTestCommands: true
|
9
|
+
acceptAPIVersion2: true
|
10
|
+
requireApiVersion: false
|
11
|
+
|
12
|
+
createEntities:
|
13
|
+
- client:
|
14
|
+
id: &client client
|
15
|
+
observeEvents:
|
16
|
+
- commandStartedEvent
|
17
|
+
# This client is configured without a declared API version, as we cannot
|
18
|
+
# declare an unknown API version.
|
19
|
+
- database:
|
20
|
+
id: &database database
|
21
|
+
client: *client
|
22
|
+
databaseName: &databaseName versioned-api-tests
|
23
|
+
|
24
|
+
tests:
|
25
|
+
- description: "Running a command that is deprecated raises a deprecation error"
|
26
|
+
operations:
|
27
|
+
- name: runCommand
|
28
|
+
object: *database
|
29
|
+
arguments:
|
30
|
+
commandName: testDeprecationInVersion2
|
31
|
+
command:
|
32
|
+
testDeprecationInVersion2: 1
|
33
|
+
apiVersion: "2"
|
34
|
+
apiDeprecationErrors: true
|
35
|
+
expectError:
|
36
|
+
isError: true
|
37
|
+
errorContains: "command testDeprecationInVersion2 is deprecated in API Version 2"
|
38
|
+
errorCodeName: "APIDeprecationError"
|
39
|
+
expectEvents:
|
40
|
+
- client: *client
|
41
|
+
events:
|
42
|
+
- commandStartedEvent:
|
43
|
+
command:
|
44
|
+
testDeprecationInVersion2: 1
|
45
|
+
apiVersion: "2"
|
46
|
+
apiStrict: { $$exists: false }
|
47
|
+
apiDeprecationErrors: true
|
@@ -0,0 +1,44 @@
|
|
1
|
+
description: "Test commands: strict mode"
|
2
|
+
|
3
|
+
schemaVersion: "1.1"
|
4
|
+
|
5
|
+
runOnRequirements:
|
6
|
+
- minServerVersion: "4.9"
|
7
|
+
serverParameters:
|
8
|
+
enableTestCommands: true
|
9
|
+
|
10
|
+
createEntities:
|
11
|
+
- client:
|
12
|
+
id: &client client
|
13
|
+
observeEvents:
|
14
|
+
- commandStartedEvent
|
15
|
+
serverApi:
|
16
|
+
version: "1"
|
17
|
+
strict: true
|
18
|
+
- database:
|
19
|
+
id: &database database
|
20
|
+
client: *client
|
21
|
+
databaseName: &databaseName versioned-api-tests
|
22
|
+
|
23
|
+
tests:
|
24
|
+
- description: "Running a command that is not part of the versioned API results in an error"
|
25
|
+
operations:
|
26
|
+
- name: runCommand
|
27
|
+
object: *database
|
28
|
+
arguments:
|
29
|
+
commandName: testVersion2
|
30
|
+
command:
|
31
|
+
testVersion2: 1
|
32
|
+
expectError:
|
33
|
+
isError: true
|
34
|
+
errorContains: "command testVersion2 is not in API Version 1"
|
35
|
+
errorCodeName: "APIStrictError"
|
36
|
+
expectEvents:
|
37
|
+
- client: *client
|
38
|
+
events:
|
39
|
+
- commandStartedEvent:
|
40
|
+
command:
|
41
|
+
testVersion2: 1
|
42
|
+
apiVersion: "1"
|
43
|
+
apiStrict: true
|
44
|
+
apiDeprecationErrors: { $$unsetOrMatches: false }
|