mongo 2.8.0 → 2.9.0.rc0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Rakefile +12 -0
  5. data/lib/mongo.rb +15 -1
  6. data/lib/mongo/address/ipv6.rb +0 -2
  7. data/lib/mongo/auth/scram/conversation.rb +0 -3
  8. data/lib/mongo/bulk_write/result_combiner.rb +12 -2
  9. data/lib/mongo/client.rb +59 -6
  10. data/lib/mongo/cluster.rb +19 -8
  11. data/lib/mongo/cluster/reapers/cursor_reaper.rb +0 -2
  12. data/lib/mongo/cluster/reapers/socket_reaper.rb +12 -9
  13. data/lib/mongo/collection.rb +1 -1
  14. data/lib/mongo/collection/view/aggregation.rb +5 -1
  15. data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
  16. data/lib/mongo/collection/view/change_stream.rb +30 -10
  17. data/lib/mongo/collection/view/iterable.rb +13 -6
  18. data/lib/mongo/collection/view/map_reduce.rb +12 -10
  19. data/lib/mongo/collection/view/readable.rb +19 -14
  20. data/lib/mongo/cursor.rb +12 -8
  21. data/lib/mongo/database.rb +10 -7
  22. data/lib/mongo/database/view.rb +18 -11
  23. data/lib/mongo/error.rb +2 -2
  24. data/lib/mongo/error/connection_check_out_timeout.rb +49 -0
  25. data/lib/mongo/error/operation_failure.rb +9 -9
  26. data/lib/mongo/error/parser.rb +25 -3
  27. data/lib/mongo/error/pool_closed_error.rb +43 -0
  28. data/lib/mongo/error/sdam_error_detection.rb +18 -0
  29. data/lib/mongo/grid/file/chunk.rb +0 -2
  30. data/lib/mongo/grid/fs_bucket.rb +26 -12
  31. data/lib/mongo/grid/stream/read.rb +36 -21
  32. data/lib/mongo/index/view.rb +11 -7
  33. data/lib/mongo/logger.rb +0 -2
  34. data/lib/mongo/monitoring.rb +31 -0
  35. data/lib/mongo/monitoring/cmap_log_subscriber.rb +53 -0
  36. data/lib/mongo/monitoring/event.rb +1 -0
  37. data/lib/mongo/monitoring/event/cmap.rb +25 -0
  38. data/lib/mongo/monitoring/event/cmap/base.rb +28 -0
  39. data/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +78 -0
  40. data/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb +56 -0
  41. data/lib/mongo/monitoring/event/cmap/connection_checked_in.rb +63 -0
  42. data/lib/mongo/monitoring/event/cmap/connection_checked_out.rb +64 -0
  43. data/lib/mongo/monitoring/event/cmap/connection_closed.rb +103 -0
  44. data/lib/mongo/monitoring/event/cmap/connection_created.rb +64 -0
  45. data/lib/mongo/monitoring/event/cmap/connection_ready.rb +64 -0
  46. data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +57 -0
  47. data/lib/mongo/monitoring/event/cmap/pool_closed.rb +57 -0
  48. data/lib/mongo/monitoring/event/cmap/pool_created.rb +63 -0
  49. data/lib/mongo/monitoring/event/command_started.rb +12 -3
  50. data/lib/mongo/monitoring/publishable.rb +10 -2
  51. data/lib/mongo/operation.rb +0 -1
  52. data/lib/mongo/operation/find/legacy/result.rb +1 -0
  53. data/lib/mongo/operation/list_collections/result.rb +7 -1
  54. data/lib/mongo/operation/result.rb +10 -1
  55. data/lib/mongo/operation/shared/executable.rb +15 -0
  56. data/lib/mongo/operation/shared/result/use_legacy_error_parser.rb +29 -0
  57. data/lib/mongo/operation/shared/specifiable.rb +0 -16
  58. data/lib/mongo/operation/update/legacy/result.rb +1 -0
  59. data/lib/mongo/protocol/compressed.rb +0 -2
  60. data/lib/mongo/protocol/msg.rb +25 -2
  61. data/lib/mongo/retryable.rb +171 -33
  62. data/lib/mongo/server.rb +26 -7
  63. data/lib/mongo/server/app_metadata.rb +0 -2
  64. data/lib/mongo/server/connectable.rb +8 -2
  65. data/lib/mongo/server/connection.rb +83 -13
  66. data/lib/mongo/server/connection_base.rb +1 -1
  67. data/lib/mongo/server/connection_pool.rb +439 -43
  68. data/lib/mongo/server/monitor/connection.rb +4 -1
  69. data/lib/mongo/session.rb +37 -5
  70. data/lib/mongo/session/session_pool.rb +2 -2
  71. data/lib/mongo/socket.rb +0 -2
  72. data/lib/mongo/socket/ssl.rb +0 -2
  73. data/lib/mongo/uri.rb +127 -66
  74. data/lib/mongo/uri/srv_protocol.rb +35 -13
  75. data/lib/mongo/version.rb +1 -1
  76. data/spec/README.md +190 -63
  77. data/spec/integration/change_stream_spec.rb +64 -0
  78. data/spec/integration/command_spec.rb +0 -7
  79. data/spec/integration/error_detection_spec.rb +39 -0
  80. data/spec/integration/read_concern.rb +83 -0
  81. data/spec/integration/retryable_writes_spec.rb +6 -50
  82. data/spec/integration/sdam_error_handling_spec.rb +60 -7
  83. data/spec/integration/ssl_uri_options_spec.rb +24 -0
  84. data/spec/integration/step_down_spec.rb +197 -0
  85. data/spec/lite_spec_helper.rb +4 -0
  86. data/spec/mongo/client_construction_spec.rb +42 -17
  87. data/spec/mongo/client_spec.rb +32 -1
  88. data/spec/mongo/cluster/socket_reaper_spec.rb +2 -2
  89. data/spec/mongo/cluster_spec.rb +36 -2
  90. data/spec/mongo/collection/view/aggregation_spec.rb +2 -0
  91. data/spec/mongo/collection/view/change_stream_spec.rb +28 -28
  92. data/spec/mongo/collection/view/readable_spec.rb +1 -1
  93. data/spec/mongo/collection/view_spec.rb +3 -1
  94. data/spec/mongo/cursor_spec.rb +5 -5
  95. data/spec/mongo/error/parser_spec.rb +61 -1
  96. data/spec/mongo/grid/stream/read_spec.rb +2 -2
  97. data/spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb +23 -0
  98. data/spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb +19 -0
  99. data/spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb +23 -0
  100. data/spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb +23 -0
  101. data/spec/mongo/monitoring/event/cmap/connection_closed_spec.rb +27 -0
  102. data/spec/mongo/monitoring/event/cmap/connection_created_spec.rb +24 -0
  103. data/spec/mongo/monitoring/event/cmap/connection_ready_spec.rb +24 -0
  104. data/spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb +19 -0
  105. data/spec/mongo/monitoring/event/cmap/pool_closed_spec.rb +19 -0
  106. data/spec/mongo/monitoring/event/cmap/pool_created_spec.rb +26 -0
  107. data/spec/mongo/operation/delete/bulk_spec.rb +1 -6
  108. data/spec/mongo/operation/delete/command_spec.rb +1 -1
  109. data/spec/mongo/operation/delete/op_msg_spec.rb +1 -1
  110. data/spec/mongo/operation/delete_spec.rb +4 -4
  111. data/spec/mongo/operation/insert/bulk_spec.rb +1 -1
  112. data/spec/mongo/operation/insert/command_spec.rb +1 -1
  113. data/spec/mongo/operation/insert/op_msg_spec.rb +1 -1
  114. data/spec/mongo/operation/update/bulk_spec.rb +1 -1
  115. data/spec/mongo/operation/update/command_spec.rb +2 -2
  116. data/spec/mongo/operation/update/op_msg_spec.rb +2 -2
  117. data/spec/mongo/protocol/msg_spec.rb +11 -0
  118. data/spec/mongo/retryable_spec.rb +78 -25
  119. data/spec/mongo/server/connection_pool_spec.rb +661 -126
  120. data/spec/mongo/server/connection_spec.rb +55 -7
  121. data/spec/mongo/server_spec.rb +5 -0
  122. data/spec/mongo/uri/srv_protocol_spec.rb +135 -2
  123. data/spec/mongo/uri_option_parsing_spec.rb +511 -0
  124. data/spec/mongo/uri_spec.rb +42 -6
  125. data/spec/spec_helper.rb +1 -84
  126. data/spec/spec_tests/cmap_spec.rb +50 -0
  127. data/spec/spec_tests/command_monitoring_spec.rb +7 -18
  128. data/spec/spec_tests/crud_spec.rb +3 -49
  129. data/spec/spec_tests/data/cmap/connection-must-have-id.yml +21 -0
  130. data/spec/spec_tests/data/cmap/connection-must-order-ids.yml +21 -0
  131. data/spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml +24 -0
  132. data/spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml +24 -0
  133. data/spec/spec_tests/data/cmap/pool-checkin-make-available.yml +21 -0
  134. data/spec/spec_tests/data/cmap/pool-checkin.yml +18 -0
  135. data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +13 -0
  136. data/spec/spec_tests/data/cmap/pool-checkout-error-closed.yml +28 -0
  137. data/spec/spec_tests/data/cmap/pool-checkout-multiple.yml +34 -0
  138. data/spec/spec_tests/data/cmap/pool-checkout-no-idle.yml +31 -0
  139. data/spec/spec_tests/data/cmap/pool-checkout-no-stale.yml +29 -0
  140. data/spec/spec_tests/data/cmap/pool-close-destroy-conns.yml +26 -0
  141. data/spec/spec_tests/data/cmap/pool-close.yml +11 -0
  142. data/spec/spec_tests/data/cmap/pool-create-max-size.yml +56 -0
  143. data/spec/spec_tests/data/cmap/pool-create-min-size.yml +27 -0
  144. data/spec/spec_tests/data/cmap/pool-create-with-options.yml +20 -0
  145. data/spec/spec_tests/data/cmap/pool-create.yml +12 -0
  146. data/spec/spec_tests/data/cmap/wait-queue-fairness.yml +94 -0
  147. data/spec/spec_tests/data/cmap/wait-queue-timeout.yml +41 -0
  148. data/spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml +157 -0
  149. data/spec/spec_tests/data/retryable_reads/aggregate.yml +87 -0
  150. data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +149 -0
  151. data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +61 -0
  152. data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +149 -0
  153. data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +65 -0
  154. data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +153 -0
  155. data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +61 -0
  156. data/spec/spec_tests/data/retryable_reads/count-serverErrors.yml +150 -0
  157. data/spec/spec_tests/data/retryable_reads/count.yml +64 -0
  158. data/spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml +150 -0
  159. data/spec/spec_tests/data/retryable_reads/countDocuments.yml +64 -0
  160. data/spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml +156 -0
  161. data/spec/spec_tests/data/retryable_reads/distinct.yml +71 -0
  162. data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors.yml +148 -0
  163. data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount.yml +62 -0
  164. data/spec/spec_tests/data/retryable_reads/find-serverErrors.yml +160 -0
  165. data/spec/spec_tests/data/retryable_reads/find.yml +86 -0
  166. data/spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml +154 -0
  167. data/spec/spec_tests/data/retryable_reads/findOne.yml +68 -0
  168. data/spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml +173 -0
  169. data/spec/spec_tests/data/retryable_reads/gridfs-download.yml +79 -0
  170. data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml +174 -0
  171. data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName.yml +79 -0
  172. data/spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml +143 -0
  173. data/spec/spec_tests/data/retryable_reads/listCollectionNames.yml +59 -0
  174. data/spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml +144 -0
  175. data/spec/spec_tests/data/retryable_reads/listCollectionObjects.yml +59 -0
  176. data/spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml +143 -0
  177. data/spec/spec_tests/data/retryable_reads/listCollections.yml +59 -0
  178. data/spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml +143 -0
  179. data/spec/spec_tests/data/retryable_reads/listDatabaseNames.yml +59 -0
  180. data/spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml +144 -0
  181. data/spec/spec_tests/data/retryable_reads/listDatabaseObjects.yml +59 -0
  182. data/spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml +144 -0
  183. data/spec/spec_tests/data/retryable_reads/listDatabases.yml +59 -0
  184. data/spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml +144 -0
  185. data/spec/spec_tests/data/retryable_reads/listIndexNames.yml +60 -0
  186. data/spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml +145 -0
  187. data/spec/spec_tests/data/retryable_reads/listIndexes.yml +60 -0
  188. data/spec/spec_tests/data/retryable_reads/mapReduce.yml +60 -0
  189. data/spec/spec_tests/data/retryable_writes/bulkWrite-serverErrors.yml +10 -7
  190. data/spec/spec_tests/data/retryable_writes/bulkWrite.yml +15 -22
  191. data/spec/spec_tests/data/retryable_writes/deleteMany.yml +22 -0
  192. data/spec/spec_tests/data/retryable_writes/deleteOne-serverErrors.yml +8 -7
  193. data/spec/spec_tests/data/retryable_writes/deleteOne.yml +5 -8
  194. data/spec/spec_tests/data/retryable_writes/findOneAndDelete-serverErrors.yml +8 -7
  195. data/spec/spec_tests/data/retryable_writes/findOneAndDelete.yml +5 -8
  196. data/spec/spec_tests/data/retryable_writes/findOneAndReplace-serverErrors.yml +8 -7
  197. data/spec/spec_tests/data/retryable_writes/findOneAndReplace.yml +5 -8
  198. data/spec/spec_tests/data/retryable_writes/findOneAndUpdate-serverErrors.yml +8 -7
  199. data/spec/spec_tests/data/retryable_writes/findOneAndUpdate.yml +5 -8
  200. data/spec/spec_tests/data/retryable_writes/insertMany-serverErrors.yml +8 -7
  201. data/spec/spec_tests/data/retryable_writes/insertMany.yml +5 -8
  202. data/spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml +10 -45
  203. data/spec/spec_tests/data/retryable_writes/insertOne.yml +5 -8
  204. data/spec/spec_tests/data/retryable_writes/replaceOne-serverErrors.yml +8 -7
  205. data/spec/spec_tests/data/retryable_writes/replaceOne.yml +5 -8
  206. data/spec/spec_tests/data/retryable_writes/updateMany.yml +27 -0
  207. data/spec/spec_tests/data/retryable_writes/updateOne-serverErrors.yml +8 -7
  208. data/spec/spec_tests/data/retryable_writes/updateOne.yml +5 -14
  209. data/spec/spec_tests/data/transactions/abort.yml +7 -2
  210. data/spec/spec_tests/data/transactions/bulk.yml +7 -2
  211. data/spec/spec_tests/data/transactions/causal-consistency.yml +11 -4
  212. data/spec/spec_tests/data/transactions/commit.yml +11 -4
  213. data/spec/spec_tests/data/transactions/count.yml +64 -0
  214. data/spec/spec_tests/data/transactions/delete.yml +7 -2
  215. data/spec/spec_tests/data/transactions/error-labels.yml +8 -2
  216. data/spec/spec_tests/data/transactions/errors.yml +7 -2
  217. data/spec/spec_tests/data/transactions/findOneAndDelete.yml +7 -2
  218. data/spec/spec_tests/data/transactions/findOneAndReplace.yml +7 -2
  219. data/spec/spec_tests/data/transactions/findOneAndUpdate.yml +7 -2
  220. data/spec/spec_tests/data/transactions/insert.yml +9 -2
  221. data/spec/spec_tests/data/transactions/isolation.yml +7 -2
  222. data/spec/spec_tests/data/transactions/read-concern.yml +15 -6
  223. data/spec/spec_tests/data/transactions/read-pref.yml +7 -2
  224. data/spec/spec_tests/data/transactions/reads.yml +8 -48
  225. data/spec/spec_tests/data/transactions/retryable-abort.yml +7 -2
  226. data/spec/spec_tests/data/transactions/retryable-commit.yml +7 -2
  227. data/spec/spec_tests/data/transactions/retryable-writes.yml +7 -2
  228. data/spec/spec_tests/data/transactions/run-command.yml +7 -2
  229. data/spec/spec_tests/data/transactions/transaction-options.yml +7 -2
  230. data/spec/spec_tests/data/transactions/update.yml +7 -2
  231. data/spec/spec_tests/data/transactions/write-concern.yml +7 -2
  232. data/spec/spec_tests/data/transactions_api/callback-aborts.yml +6 -1
  233. data/spec/spec_tests/data/transactions_api/callback-commits.yml +6 -1
  234. data/spec/spec_tests/data/transactions_api/callback-retry.yml +6 -1
  235. data/spec/spec_tests/data/transactions_api/commit-retry.yml +6 -1
  236. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +6 -3
  237. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +6 -1
  238. data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +6 -1
  239. data/spec/spec_tests/data/transactions_api/commit.yml +6 -1
  240. data/spec/spec_tests/data/transactions_api/transaction-options.yml +6 -1
  241. data/spec/spec_tests/retryable_reads_spec.rb +11 -0
  242. data/spec/spec_tests/retryable_writes_spec.rb +4 -69
  243. data/spec/spec_tests/transactions_api_spec.rb +42 -37
  244. data/spec/spec_tests/transactions_spec.rb +42 -33
  245. data/spec/support/authorization.rb +12 -0
  246. data/spec/support/change_streams/operation.rb +1 -1
  247. data/spec/support/client_registry.rb +20 -0
  248. data/spec/support/cluster_config.rb +16 -15
  249. data/spec/support/cluster_tools.rb +346 -0
  250. data/spec/support/cmap.rb +367 -0
  251. data/spec/support/cmap/verifier.rb +46 -0
  252. data/spec/support/command_monitoring.rb +4 -6
  253. data/spec/support/common_shortcuts.rb +6 -0
  254. data/spec/support/connection_string.rb +2 -2
  255. data/spec/support/crud.rb +171 -184
  256. data/spec/support/crud/operation.rb +43 -0
  257. data/spec/support/crud/outcome.rb +53 -0
  258. data/spec/support/crud/read.rb +102 -12
  259. data/spec/support/crud/requirement.rb +69 -0
  260. data/spec/support/crud/spec.rb +68 -0
  261. data/spec/support/crud/test.rb +141 -0
  262. data/spec/support/crud/verifier.rb +96 -18
  263. data/spec/support/crud/write.rb +18 -3
  264. data/spec/support/event_subscriber.rb +15 -0
  265. data/spec/support/primary_socket.rb +2 -2
  266. data/spec/support/spec_config.rb +89 -20
  267. data/spec/support/transactions.rb +2 -306
  268. data/spec/support/transactions/operation.rb +7 -7
  269. data/spec/support/transactions/spec.rb +28 -0
  270. data/spec/support/transactions/test.rb +191 -0
  271. data/spec/support/utils.rb +123 -0
  272. metadata +202 -9
  273. metadata.gz.sig +0 -0
  274. data/lib/mongo/server/connection_pool/queue.rb +0 -359
  275. data/spec/mongo/server/connection_pool/queue_spec.rb +0 -353
  276. data/spec/support/transactions/verifier.rb +0 -97
@@ -166,7 +166,7 @@ module Mongo
166
166
  private
167
167
 
168
168
  def start_transaction(session)
169
- session.start_transaction(snakeize_hash(arguments['options'])) ; nil
169
+ session.start_transaction(Utils.snakeize_hash(arguments['options'])) ; nil
170
170
  end
171
171
 
172
172
  def commit_transaction(session)
@@ -183,7 +183,7 @@ module Mongo
183
183
  end
184
184
 
185
185
  if @spec['arguments']['options']
186
- options = snakeize_hash(@spec['arguments']['options'])
186
+ options = Utils.snakeize_hash(@spec['arguments']['options'])
187
187
  else
188
188
  options = nil
189
189
  end
@@ -205,7 +205,7 @@ module Mongo
205
205
  command_value = cmd.delete(command_name)
206
206
  cmd = { command_name.to_sym => command_value }.merge(cmd)
207
207
 
208
- opts = snakeize_hash(options)
208
+ opts = Utils.snakeize_hash(options)
209
209
  opts[:read] = opts.delete(:read_preference)
210
210
  database.command(cmd, opts).documents.first
211
211
  end
@@ -415,19 +415,19 @@ module Mongo
415
415
  end
416
416
 
417
417
  def read_concern
418
- snakeize_hash(@spec['collectionOptions'] && @spec['collectionOptions']['readConcern'])
418
+ Utils.snakeize_hash(@spec['collectionOptions'] && @spec['collectionOptions']['readConcern'])
419
419
  end
420
420
 
421
421
  def write_concern
422
- snakeize_hash(@spec['collectionOptions'] && @spec['collectionOptions']['writeConcern'])
422
+ Utils.snakeize_hash(@spec['collectionOptions'] && @spec['collectionOptions']['writeConcern'])
423
423
  end
424
424
 
425
425
  def read_preference
426
- snakeize_hash(arguments['readPreference'])
426
+ Utils.snakeize_hash(arguments['readPreference'])
427
427
  end
428
428
 
429
429
  def collection_read_preference
430
- snakeize_hash(@spec['collectionOptions'] && @spec['collectionOptions']['readPreference'])
430
+ Utils.snakeize_hash(@spec['collectionOptions'] && @spec['collectionOptions']['readPreference'])
431
431
  end
432
432
  end
433
433
  end
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2014-2019 MongoDB, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Mongo
16
+ module Transactions
17
+
18
+ class Spec < Mongo::CRUD::Spec
19
+ def tests
20
+ @tests.map do |test|
21
+ lambda do
22
+ Mongo::Transactions::TransactionsTest.new(@data, test, self)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,191 @@
1
+ # Copyright (C) 2014-2019 MongoDB, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Mongo
16
+ module Transactions
17
+
18
+ # Represents a single transaction test.
19
+ #
20
+ # @since 2.6.0
21
+ class TransactionsTest
22
+
23
+ # The test description.
24
+ #
25
+ # @return [ String ] description The test description.
26
+ #
27
+ # @since 2.6.0
28
+ attr_reader :description
29
+
30
+ # The expected command monitoring events
31
+ #
32
+ # @since 2.6.0
33
+ attr_reader :expectations
34
+
35
+ attr_reader :expected_results
36
+ attr_reader :skip_reason
37
+
38
+ attr_reader :results
39
+
40
+ # Instantiate the new CRUDTest.
41
+ #
42
+ # @example Create the test.
43
+ # TransactionTest.new(data, test)
44
+ #
45
+ # @param [ Array<Hash> ] data The documents the collection
46
+ # must have before the test runs.
47
+ # @param [ Hash ] test The test specification.
48
+ # @param [ Hash ] spec The top level YAML specification.
49
+ #
50
+ # @since 2.6.0
51
+ def initialize(data, test, spec)
52
+ test = IceNine.deep_freeze(test)
53
+ @spec = spec
54
+ @data = data
55
+ @description = test['description']
56
+ @client_options = Utils.convert_client_options(test['clientOptions'] || {})
57
+ @session_options = Utils.snakeize_hash(test['sessionOptions'] || {})
58
+ @fail_point = test['failPoint']
59
+ @operations = test['operations']
60
+ @expectations = test['expectations']
61
+ @skip_reason = test['skipReason']
62
+ if test['outcome']
63
+ @outcome = Mongo::CRUD::Outcome.new(test['outcome'])
64
+ end
65
+ @expected_results = @operations.map do |o|
66
+ result = o['result']
67
+ next result unless result.class == Hash
68
+
69
+ # Change maps of result ids to arrays of ids
70
+ result.dup.tap do |r|
71
+ r.each do |k, v|
72
+ next unless ['insertedIds', 'upsertedIds'].include?(k)
73
+ r[k] = v.to_a.sort_by(&:first).map(&:last)
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ attr_reader :outcome
80
+
81
+ def support_client
82
+ @support_client ||= ClientRegistry.instance.global_client('root_authorized').use(@spec.database_name)
83
+ end
84
+
85
+ def admin_support_client
86
+ @admin_support_client ||= support_client.use('admin')
87
+ end
88
+
89
+ def test_client
90
+ @test_client ||= ClientRegistry.instance.global_client('authorized_without_retry_writes').with(
91
+ @client_options.merge(
92
+ database: @spec.database_name,
93
+ app_name: 'this is used solely to force the new client to create its own cluster'))
94
+ end
95
+
96
+ def event_subscriber
97
+ @event_subscriber ||= EventSubscriber.new
98
+ end
99
+
100
+ # Run the test.
101
+ #
102
+ # @example Run the test.
103
+ # test.run
104
+ #
105
+ # @return [ Result ] The result of running the test.
106
+ #
107
+ # @since 2.6.0
108
+ def run
109
+ test_client.subscribe(Mongo::Monitoring::COMMAND, event_subscriber)
110
+
111
+ $distinct_ran ||= if @ops.any? { |op| op.name == 'distinct' }
112
+ if ClusterConfig.instance.mongos?
113
+ client = ClientRegistry.instance.global_client('basic')
114
+ client.cluster.next_primary
115
+ client.cluster.servers.each do |server|
116
+ direct_client = ClientRegistry.instance.new_local_client(
117
+ [server.address.to_s],
118
+ SpecConfig.instance.test_options.merge(
119
+ connect: :sharded
120
+ ).merge(SpecConfig.instance.auth_options))
121
+ direct_client['test'].distinct('foo').to_a
122
+ end
123
+ end
124
+ end
125
+
126
+ results = @ops.map do |op|
127
+ op.execute(@collection)
128
+ end
129
+
130
+ session0_id = @session0.session_id
131
+ session1_id = @session1.session_id
132
+
133
+ @session0.end_session
134
+ @session1.end_session
135
+
136
+ actual_events = Utils.yamlify_command_events(event_subscriber.started_events)
137
+ actual_events.each do |e|
138
+
139
+ # Replace the session id placeholders with the actual session ids.
140
+ payload = e['command_started_event']
141
+ payload['command']['lsid'] = 'session0' if payload['command']['lsid'] == session0_id
142
+ payload['command']['lsid'] = 'session1' if payload['command']['lsid'] == session1_id
143
+
144
+ end
145
+
146
+ if @fail_point
147
+ admin_support_client.command(configureFailPoint: 'failCommand', mode: 'off')
148
+ end
149
+
150
+ @results = {
151
+ results: results,
152
+ contents: @collection.with(read_concern: { level: 'local' }).find.to_a,
153
+ events: actual_events,
154
+ }
155
+ end
156
+
157
+ def setup_test
158
+ begin
159
+ admin_support_client.command(killAllSessions: [])
160
+ rescue Mongo::Error
161
+ end
162
+
163
+ coll = support_client[@spec.collection_name]
164
+ coll.drop
165
+ coll.with(write: { w: :majority }).drop
166
+ support_client.command(create: @spec.collection_name, writeConcern: { w: :majority })
167
+
168
+ coll.with(write: { w: :majority }).insert_many(@data) unless @data.empty?
169
+ admin_support_client.command(@fail_point) if @fail_point
170
+
171
+ @collection = test_client[@spec.collection_name]
172
+
173
+ @session0 = test_client.start_session(@session_options[:session0] || {})
174
+ @session1 = test_client.start_session(@session_options[:session1] || {})
175
+
176
+ @ops = @operations.map do |op|
177
+ Operation.new(op, @session0, @session1)
178
+ end
179
+ end
180
+
181
+ def teardown_test
182
+ if @admin_support_client
183
+ @admin_support_client.close
184
+ end
185
+ if @test_client
186
+ @test_client.close
187
+ end
188
+ end
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,123 @@
1
+ module Utils
2
+
3
+ # Converts a 'camelCase' string or symbol to a :under_score symbol.
4
+ def underscore(str)
5
+ str = str.to_s
6
+ str = str[0].downcase + str[1...str.length].gsub(/([A-Z])/) { |m| "_#{m.downcase}" }
7
+ str.to_sym
8
+ end
9
+ module_function :underscore
10
+
11
+ # Creates a copy of a hash where all keys and string values are converted to snake-case symbols.
12
+ # For example, `{ 'fooBar' => { 'baz' => 'bingBing', :x => 1 } }` converts to
13
+ # `{ :foo_bar => { :baz => :bing_bing, :x => 1 } }`.
14
+ def snakeize_hash(value)
15
+ return underscore(value) if value.is_a?(String)
16
+ return value unless value.is_a?(Hash)
17
+
18
+ value.reduce({}) do |hash, kv|
19
+ hash.tap do |h|
20
+ h[underscore(kv.first)] = snakeize_hash(kv.last)
21
+ end
22
+ end
23
+ end
24
+ module_function :snakeize_hash
25
+
26
+ # Converts camel case clientOptions, as used in spec tests,
27
+ # to Ruby driver underscore options.
28
+ def convert_client_options(spec_test_options)
29
+ spec_test_options.reduce({}) do |opts, kv|
30
+ case kv.first
31
+ when 'readConcernLevel'
32
+ kv = [:read_concern, { 'level' => kv.last }]
33
+ when 'readPreference'
34
+ kv = [:read, { 'mode' => kv.last }]
35
+ when 'w'
36
+ kv = [:write, { w: kv.last }]
37
+ else
38
+ kv[0] = underscore(kv[0])
39
+ end
40
+
41
+ opts.tap { |o| o[kv.first] = kv.last }
42
+ end
43
+ end
44
+ module_function :convert_client_options
45
+
46
+ def order_hash(hash)
47
+ Hash[hash.to_a.sort]
48
+ end
49
+ module_function :order_hash
50
+
51
+ # Transforms an array of CommandStarted events to an array of hashes
52
+ # matching event specification in YAML spec files
53
+ def yamlify_command_events(events)
54
+ events = events.map do |e|
55
+ command = e.command.dup
56
+
57
+ # Convert txnNumber field from a BSON integer to an extended JSON int64
58
+ if command['txnNumber']
59
+ command['txnNumber'] = {
60
+ '$numberLong' => command['txnNumber'].instance_variable_get(:@integer).to_s
61
+ }
62
+ end
63
+
64
+ # Fake $code for map/reduce commands
65
+ %w(map reduce).each do |key|
66
+ if command[key].is_a?(String)
67
+ command[key] = {'$code' => command[key]}
68
+ end
69
+ end
70
+
71
+ # The spec files don't include these fields, so we delete them.
72
+ command.delete('$readPreference')
73
+ command.delete('bypassDocumentValidation')
74
+ command.delete('$clusterTime')
75
+
76
+ if command['readConcern']
77
+ # The spec test use an afterClusterTime value of 42 to indicate that we need to assert
78
+ # that the field exists in the actual read concern rather than comparing the value, so
79
+ # we replace any afterClusterTime value with 42.
80
+ if command['readConcern']['afterClusterTime']
81
+ command['readConcern']['afterClusterTime'] = 42
82
+ end
83
+
84
+ # Convert the readConcern level from a symbol to a string.
85
+ if command['readConcern']['level']
86
+ command['readConcern']['level'] = command['readConcern']['level'].to_s
87
+ end
88
+ end
89
+
90
+ # The spec tests use 42 as a placeholder value for any getMore cursorId.
91
+ command['getMore'] = { '$numberLong' => '42' } if command['getMore']
92
+
93
+ # Remove fields if empty
94
+ #command.delete('filter') if command['filter'] && command['filter'].empty?
95
+ command.delete('query') if command['query'] && command['query'].empty?
96
+
97
+ if filter = command['filter']
98
+ # Since the Ruby driver does not implement extended JSON, hack
99
+ # the types here manually.
100
+ # Note that this code mutates the command.
101
+ %w(_id files_id).each do |key|
102
+ if filter[key] && filter[key].is_a?(BSON::ObjectId)
103
+ filter[key] = {'$oid' => filter[key].to_s}
104
+ end
105
+ end
106
+ end
107
+
108
+ {
109
+ 'command_started_event' => order_hash(
110
+ 'command' => order_hash(command),
111
+ 'command_name' => e.command_name.to_s,
112
+ 'database_name' => e.database_name,
113
+ )
114
+ }
115
+ end
116
+
117
+ # Remove any events from authentication commands.
118
+ events.reject! { |e| e['command_started_event']['command_name'].start_with?('sasl') }
119
+
120
+ events
121
+ end
122
+ module_function :yamlify_command_events
123
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.0.rc0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -31,7 +31,7 @@ cert_chain:
31
31
  bMYVwXXhV8czdzgkQB/ZPWHSbEWXnmkze1mzvqWBCPOVXYrcnL9cnEl/RoxtS1hr
32
32
  Db6Ac6mCUSYfYHBWpWqxjc45n70i5Xi1
33
33
  -----END CERTIFICATE-----
34
- date: 2019-03-21 00:00:00.000000000 Z
34
+ date: 2019-05-23 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bson
@@ -142,6 +142,7 @@ files:
142
142
  - lib/mongo/error/bulk_write_error.rb
143
143
  - lib/mongo/error/change_stream_resumable.rb
144
144
  - lib/mongo/error/closed_stream.rb
145
+ - lib/mongo/error/connection_check_out_timeout.rb
145
146
  - lib/mongo/error/extra_file_chunk.rb
146
147
  - lib/mongo/error/failed_stringprep_validation.rb
147
148
  - lib/mongo/error/file_not_found.rb
@@ -180,6 +181,7 @@ files:
180
181
  - lib/mongo/error/no_srv_records.rb
181
182
  - lib/mongo/error/operation_failure.rb
182
183
  - lib/mongo/error/parser.rb
184
+ - lib/mongo/error/pool_closed_error.rb
183
185
  - lib/mongo/error/sdam_error_detection.rb
184
186
  - lib/mongo/error/session_ended.rb
185
187
  - lib/mongo/error/socket_error.rb
@@ -214,8 +216,21 @@ files:
214
216
  - lib/mongo/loggable.rb
215
217
  - lib/mongo/logger.rb
216
218
  - lib/mongo/monitoring.rb
219
+ - lib/mongo/monitoring/cmap_log_subscriber.rb
217
220
  - lib/mongo/monitoring/command_log_subscriber.rb
218
221
  - lib/mongo/monitoring/event.rb
222
+ - lib/mongo/monitoring/event/cmap.rb
223
+ - lib/mongo/monitoring/event/cmap/base.rb
224
+ - lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb
225
+ - lib/mongo/monitoring/event/cmap/connection_check_out_started.rb
226
+ - lib/mongo/monitoring/event/cmap/connection_checked_in.rb
227
+ - lib/mongo/monitoring/event/cmap/connection_checked_out.rb
228
+ - lib/mongo/monitoring/event/cmap/connection_closed.rb
229
+ - lib/mongo/monitoring/event/cmap/connection_created.rb
230
+ - lib/mongo/monitoring/event/cmap/connection_ready.rb
231
+ - lib/mongo/monitoring/event/cmap/pool_cleared.rb
232
+ - lib/mongo/monitoring/event/cmap/pool_closed.rb
233
+ - lib/mongo/monitoring/event/cmap/pool_created.rb
219
234
  - lib/mongo/monitoring/event/command_failed.rb
220
235
  - lib/mongo/monitoring/event/command_started.rb
221
236
  - lib/mongo/monitoring/event/command_succeeded.rb
@@ -340,6 +355,7 @@ files:
340
355
  - lib/mongo/operation/shared/polymorphic_result.rb
341
356
  - lib/mongo/operation/shared/read_preference_supported.rb
342
357
  - lib/mongo/operation/shared/result/aggregatable.rb
358
+ - lib/mongo/operation/shared/result/use_legacy_error_parser.rb
343
359
  - lib/mongo/operation/shared/sessions_supported.rb
344
360
  - lib/mongo/operation/shared/specifiable.rb
345
361
  - lib/mongo/operation/shared/write.rb
@@ -383,7 +399,6 @@ files:
383
399
  - lib/mongo/server/connection.rb
384
400
  - lib/mongo/server/connection_base.rb
385
401
  - lib/mongo/server/connection_pool.rb
386
- - lib/mongo/server/connection_pool/queue.rb
387
402
  - lib/mongo/server/context.rb
388
403
  - lib/mongo/server/description.rb
389
404
  - lib/mongo/server/description/features.rb
@@ -429,8 +444,10 @@ files:
429
444
  - spec/integration/connection_spec.rb
430
445
  - spec/integration/cursor_reaping_spec.rb
431
446
  - spec/integration/docs_examples_spec.rb
447
+ - spec/integration/error_detection_spec.rb
432
448
  - spec/integration/heartbeat_events_spec.rb
433
449
  - spec/integration/operation_failure_code_spec.rb
450
+ - spec/integration/read_concern.rb
434
451
  - spec/integration/reconnect_spec.rb
435
452
  - spec/integration/retryable_writes_spec.rb
436
453
  - spec/integration/sdam_error_handling_spec.rb
@@ -438,6 +455,8 @@ files:
438
455
  - spec/integration/server_description_spec.rb
439
456
  - spec/integration/server_selector_spec.rb
440
457
  - spec/integration/shell_examples_spec.rb
458
+ - spec/integration/ssl_uri_options_spec.rb
459
+ - spec/integration/step_down_spec.rb
441
460
  - spec/integration/time_zone_querying_spec.rb
442
461
  - spec/integration/transactions_examples_spec.rb
443
462
  - spec/lite_spec_helper.rb
@@ -509,6 +528,16 @@ files:
509
528
  - spec/mongo/lint_spec.rb
510
529
  - spec/mongo/logger_spec.rb
511
530
  - spec/mongo/monitoring/command_log_subscriber_spec.rb
531
+ - spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb
532
+ - spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb
533
+ - spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb
534
+ - spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb
535
+ - spec/mongo/monitoring/event/cmap/connection_closed_spec.rb
536
+ - spec/mongo/monitoring/event/cmap/connection_created_spec.rb
537
+ - spec/mongo/monitoring/event/cmap/connection_ready_spec.rb
538
+ - spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb
539
+ - spec/mongo/monitoring/event/cmap/pool_closed_spec.rb
540
+ - spec/mongo/monitoring/event/cmap/pool_created_spec.rb
512
541
  - spec/mongo/monitoring/event/command_failed_spec.rb
513
542
  - spec/mongo/monitoring/event/command_started_spec.rb
514
543
  - spec/mongo/monitoring/event/command_succeeded_spec.rb
@@ -567,7 +596,6 @@ files:
567
596
  - spec/mongo/retryable_spec.rb
568
597
  - spec/mongo/server/app_metadata_spec.rb
569
598
  - spec/mongo/server/connection_auth_spec.rb
570
- - spec/mongo/server/connection_pool/queue_spec.rb
571
599
  - spec/mongo/server/connection_pool_spec.rb
572
600
  - spec/mongo/server/connection_spec.rb
573
601
  - spec/mongo/server/description/features_spec.rb
@@ -593,17 +621,38 @@ files:
593
621
  - spec/mongo/socket/unix_spec.rb
594
622
  - spec/mongo/socket_spec.rb
595
623
  - spec/mongo/uri/srv_protocol_spec.rb
624
+ - spec/mongo/uri_option_parsing_spec.rb
596
625
  - spec/mongo/uri_spec.rb
597
626
  - spec/mongo/write_concern/acknowledged_spec.rb
598
627
  - spec/mongo/write_concern/unacknowledged_spec.rb
599
628
  - spec/mongo/write_concern_spec.rb
600
629
  - spec/spec_helper.rb
601
630
  - spec/spec_tests/change_streams_spec.rb
631
+ - spec/spec_tests/cmap_spec.rb
602
632
  - spec/spec_tests/command_monitoring_spec.rb
603
633
  - spec/spec_tests/connection_string_spec.rb
604
634
  - spec/spec_tests/crud_spec.rb
605
635
  - spec/spec_tests/data/change_streams/change-streams-errors.yml
606
636
  - spec/spec_tests/data/change_streams/change-streams.yml
637
+ - spec/spec_tests/data/cmap/connection-must-have-id.yml
638
+ - spec/spec_tests/data/cmap/connection-must-order-ids.yml
639
+ - spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml
640
+ - spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml
641
+ - spec/spec_tests/data/cmap/pool-checkin-make-available.yml
642
+ - spec/spec_tests/data/cmap/pool-checkin.yml
643
+ - spec/spec_tests/data/cmap/pool-checkout-connection.yml
644
+ - spec/spec_tests/data/cmap/pool-checkout-error-closed.yml
645
+ - spec/spec_tests/data/cmap/pool-checkout-multiple.yml
646
+ - spec/spec_tests/data/cmap/pool-checkout-no-idle.yml
647
+ - spec/spec_tests/data/cmap/pool-checkout-no-stale.yml
648
+ - spec/spec_tests/data/cmap/pool-close-destroy-conns.yml
649
+ - spec/spec_tests/data/cmap/pool-close.yml
650
+ - spec/spec_tests/data/cmap/pool-create-max-size.yml
651
+ - spec/spec_tests/data/cmap/pool-create-min-size.yml
652
+ - spec/spec_tests/data/cmap/pool-create-with-options.yml
653
+ - spec/spec_tests/data/cmap/pool-create.yml
654
+ - spec/spec_tests/data/cmap/wait-queue-fairness.yml
655
+ - spec/spec_tests/data/cmap/wait-queue-timeout.yml
607
656
  - spec/spec_tests/data/command_monitoring/bulkWrite.yml
608
657
  - spec/spec_tests/data/command_monitoring/command.yml
609
658
  - spec/spec_tests/data/command_monitoring/deleteMany.yml
@@ -721,8 +770,50 @@ files:
721
770
  - spec/spec_tests/data/max_staleness/Single/Incompatible.yml
722
771
  - spec/spec_tests/data/max_staleness/Single/SmallMaxStaleness.yml
723
772
  - spec/spec_tests/data/max_staleness/Unknown/SmallMaxStaleness.yml
773
+ - spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml
774
+ - spec/spec_tests/data/retryable_reads/aggregate.yml
775
+ - spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml
776
+ - spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml
777
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml
778
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml
779
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml
780
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml
781
+ - spec/spec_tests/data/retryable_reads/count-serverErrors.yml
782
+ - spec/spec_tests/data/retryable_reads/count.yml
783
+ - spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml
784
+ - spec/spec_tests/data/retryable_reads/countDocuments.yml
785
+ - spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml
786
+ - spec/spec_tests/data/retryable_reads/distinct.yml
787
+ - spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors.yml
788
+ - spec/spec_tests/data/retryable_reads/estimatedDocumentCount.yml
789
+ - spec/spec_tests/data/retryable_reads/find-serverErrors.yml
790
+ - spec/spec_tests/data/retryable_reads/find.yml
791
+ - spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml
792
+ - spec/spec_tests/data/retryable_reads/findOne.yml
793
+ - spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml
794
+ - spec/spec_tests/data/retryable_reads/gridfs-download.yml
795
+ - spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml
796
+ - spec/spec_tests/data/retryable_reads/gridfs-downloadByName.yml
797
+ - spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml
798
+ - spec/spec_tests/data/retryable_reads/listCollectionNames.yml
799
+ - spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml
800
+ - spec/spec_tests/data/retryable_reads/listCollectionObjects.yml
801
+ - spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml
802
+ - spec/spec_tests/data/retryable_reads/listCollections.yml
803
+ - spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml
804
+ - spec/spec_tests/data/retryable_reads/listDatabaseNames.yml
805
+ - spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml
806
+ - spec/spec_tests/data/retryable_reads/listDatabaseObjects.yml
807
+ - spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml
808
+ - spec/spec_tests/data/retryable_reads/listDatabases.yml
809
+ - spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml
810
+ - spec/spec_tests/data/retryable_reads/listIndexNames.yml
811
+ - spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml
812
+ - spec/spec_tests/data/retryable_reads/listIndexes.yml
813
+ - spec/spec_tests/data/retryable_reads/mapReduce.yml
724
814
  - spec/spec_tests/data/retryable_writes/bulkWrite-serverErrors.yml
725
815
  - spec/spec_tests/data/retryable_writes/bulkWrite.yml
816
+ - spec/spec_tests/data/retryable_writes/deleteMany.yml
726
817
  - spec/spec_tests/data/retryable_writes/deleteOne-serverErrors.yml
727
818
  - spec/spec_tests/data/retryable_writes/deleteOne.yml
728
819
  - spec/spec_tests/data/retryable_writes/findOneAndDelete-serverErrors.yml
@@ -737,6 +828,7 @@ files:
737
828
  - spec/spec_tests/data/retryable_writes/insertOne.yml
738
829
  - spec/spec_tests/data/retryable_writes/replaceOne-serverErrors.yml
739
830
  - spec/spec_tests/data/retryable_writes/replaceOne.yml
831
+ - spec/spec_tests/data/retryable_writes/updateMany.yml
740
832
  - spec/spec_tests/data/retryable_writes/updateOne-serverErrors.yml
741
833
  - spec/spec_tests/data/retryable_writes/updateOne.yml
742
834
  - spec/spec_tests/data/sdam/rs/compatible.yml
@@ -869,6 +961,7 @@ files:
869
961
  - spec/spec_tests/data/transactions/bulk.yml
870
962
  - spec/spec_tests/data/transactions/causal-consistency.yml
871
963
  - spec/spec_tests/data/transactions/commit.yml
964
+ - spec/spec_tests/data/transactions/count.yml
872
965
  - spec/spec_tests/data/transactions/delete.yml
873
966
  - spec/spec_tests/data/transactions/error-labels.yml
874
967
  - spec/spec_tests/data/transactions/errors.yml
@@ -906,6 +999,7 @@ files:
906
999
  - spec/spec_tests/dns_seedlist_discovery_spec.rb
907
1000
  - spec/spec_tests/gridfs_spec.rb
908
1001
  - spec/spec_tests/max_staleness_spec.rb
1002
+ - spec/spec_tests/retryable_reads_spec.rb
909
1003
  - spec/spec_tests/retryable_writes_spec.rb
910
1004
  - spec/spec_tests/sdam_monitoring_spec.rb
911
1005
  - spec/spec_tests/sdam_spec.rb
@@ -928,12 +1022,20 @@ files:
928
1022
  - spec/support/client_registry.rb
929
1023
  - spec/support/client_registry_macros.rb
930
1024
  - spec/support/cluster_config.rb
1025
+ - spec/support/cluster_tools.rb
1026
+ - spec/support/cmap.rb
1027
+ - spec/support/cmap/verifier.rb
931
1028
  - spec/support/command_monitoring.rb
932
1029
  - spec/support/common_shortcuts.rb
933
1030
  - spec/support/connection_string.rb
934
1031
  - spec/support/constraints.rb
935
1032
  - spec/support/crud.rb
1033
+ - spec/support/crud/operation.rb
1034
+ - spec/support/crud/outcome.rb
936
1035
  - spec/support/crud/read.rb
1036
+ - spec/support/crud/requirement.rb
1037
+ - spec/support/crud/spec.rb
1038
+ - spec/support/crud/test.rb
937
1039
  - spec/support/crud/verifier.rb
938
1040
  - spec/support/crud/write.rb
939
1041
  - spec/support/event_subscriber.rb
@@ -955,7 +1057,9 @@ files:
955
1057
  - spec/support/spec_setup.rb
956
1058
  - spec/support/transactions.rb
957
1059
  - spec/support/transactions/operation.rb
958
- - spec/support/transactions/verifier.rb
1060
+ - spec/support/transactions/spec.rb
1061
+ - spec/support/transactions/test.rb
1062
+ - spec/support/utils.rb
959
1063
  homepage: http://www.mongodb.org
960
1064
  licenses:
961
1065
  - Apache-2.0
@@ -971,9 +1075,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
971
1075
  version: '0'
972
1076
  required_rubygems_version: !ruby/object:Gem::Requirement
973
1077
  requirements:
974
- - - ">="
1078
+ - - ">"
975
1079
  - !ruby/object:Gem::Version
976
- version: '0'
1080
+ version: 1.3.1
977
1081
  requirements: []
978
1082
  rubygems_version: 3.0.1
979
1083
  signing_key:
@@ -992,6 +1096,7 @@ test_files:
992
1096
  - spec/support/certificates/client_key.pem
993
1097
  - spec/support/certificates/crl.pem
994
1098
  - spec/support/certificates/client_cert.pem
1099
+ - spec/support/utils.rb
995
1100
  - spec/support/cluster_config.rb
996
1101
  - spec/support/client_registry.rb
997
1102
  - spec/support/sdam_formatter_integration.rb
@@ -999,12 +1104,19 @@ test_files:
999
1104
  - spec/support/connection_string.rb
1000
1105
  - spec/support/sdam_monitoring.rb
1001
1106
  - spec/support/json_ext_formatter.rb
1107
+ - spec/support/cmap/verifier.rb
1002
1108
  - spec/support/shared/protocol.rb
1003
1109
  - spec/support/shared/server_selector.rb
1004
1110
  - spec/support/shared/session.rb
1111
+ - spec/support/cmap.rb
1005
1112
  - spec/support/authorization.rb
1006
1113
  - spec/support/crud/read.rb
1114
+ - spec/support/crud/spec.rb
1115
+ - spec/support/crud/operation.rb
1116
+ - spec/support/crud/test.rb
1007
1117
  - spec/support/crud/verifier.rb
1118
+ - spec/support/crud/requirement.rb
1119
+ - spec/support/crud/outcome.rb
1008
1120
  - spec/support/crud/write.rb
1009
1121
  - spec/support/common_shortcuts.rb
1010
1122
  - spec/support/monitoring_ext.rb
@@ -1018,14 +1130,20 @@ test_files:
1018
1130
  - spec/support/event_subscriber.rb
1019
1131
  - spec/support/crud.rb
1020
1132
  - spec/support/transactions.rb
1133
+ - spec/support/cluster_tools.rb
1134
+ - spec/support/transactions/spec.rb
1021
1135
  - spec/support/transactions/operation.rb
1022
- - spec/support/transactions/verifier.rb
1136
+ - spec/support/transactions/test.rb
1023
1137
  - spec/support/spec_setup.rb
1024
1138
  - spec/support/lite_constraints.rb
1025
1139
  - spec/README.md
1140
+ - spec/integration/ssl_uri_options_spec.rb
1141
+ - spec/integration/step_down_spec.rb
1142
+ - spec/integration/read_concern.rb
1026
1143
  - spec/integration/server_description_spec.rb
1027
1144
  - spec/integration/connection_spec.rb
1028
1145
  - spec/integration/operation_failure_code_spec.rb
1146
+ - spec/integration/error_detection_spec.rb
1029
1147
  - spec/integration/connect_single_rs_name_spec.rb
1030
1148
  - spec/integration/sdam_events_spec.rb
1031
1149
  - spec/integration/shell_examples_spec.rb
@@ -1057,7 +1175,6 @@ test_files:
1057
1175
  - spec/mongo/server/connection_auth_spec.rb
1058
1176
  - spec/mongo/server/description/features_spec.rb
1059
1177
  - spec/mongo/server/description_spec.rb
1060
- - spec/mongo/server/connection_pool/queue_spec.rb
1061
1178
  - spec/mongo/server/connection_pool_spec.rb
1062
1179
  - spec/mongo/server/description_query_methods_spec.rb
1063
1180
  - spec/mongo/session_spec.rb
@@ -1081,6 +1198,7 @@ test_files:
1081
1198
  - spec/mongo/error/parser_spec.rb
1082
1199
  - spec/mongo/retryable_spec.rb
1083
1200
  - spec/mongo/write_concern_spec.rb
1201
+ - spec/mongo/uri_option_parsing_spec.rb
1084
1202
  - spec/mongo/lint_spec.rb
1085
1203
  - spec/mongo/dbref_spec.rb
1086
1204
  - spec/mongo/options/redacted_spec.rb
@@ -1096,6 +1214,16 @@ test_files:
1096
1214
  - spec/mongo/monitoring/event/command_started_spec.rb
1097
1215
  - spec/mongo/monitoring/event/server_heartbeat_failed_spec.rb
1098
1216
  - spec/mongo/monitoring/event/topology_changed_spec.rb
1217
+ - spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb
1218
+ - spec/mongo/monitoring/event/cmap/connection_created_spec.rb
1219
+ - spec/mongo/monitoring/event/cmap/pool_created_spec.rb
1220
+ - spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb
1221
+ - spec/mongo/monitoring/event/cmap/connection_ready_spec.rb
1222
+ - spec/mongo/monitoring/event/cmap/connection_closed_spec.rb
1223
+ - spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb
1224
+ - spec/mongo/monitoring/event/cmap/pool_closed_spec.rb
1225
+ - spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb
1226
+ - spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb
1099
1227
  - spec/mongo/monitoring/event/server_closed_spec.rb
1100
1228
  - spec/mongo/monitoring/event/topology_closed_spec.rb
1101
1229
  - spec/mongo/monitoring/event/server_heartbeat_succeeded_spec.rb
@@ -1309,6 +1437,7 @@ test_files:
1309
1437
  - spec/spec_tests/data/retryable_writes/deleteOne-serverErrors.yml
1310
1438
  - spec/spec_tests/data/retryable_writes/findOneAndDelete.yml
1311
1439
  - spec/spec_tests/data/retryable_writes/replaceOne-serverErrors.yml
1440
+ - spec/spec_tests/data/retryable_writes/deleteMany.yml
1312
1441
  - spec/spec_tests/data/retryable_writes/findOneAndUpdate-serverErrors.yml
1313
1442
  - spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml
1314
1443
  - spec/spec_tests/data/retryable_writes/bulkWrite.yml
@@ -1321,9 +1450,29 @@ test_files:
1321
1450
  - spec/spec_tests/data/retryable_writes/replaceOne.yml
1322
1451
  - spec/spec_tests/data/retryable_writes/findOneAndUpdate.yml
1323
1452
  - spec/spec_tests/data/retryable_writes/findOneAndReplace-serverErrors.yml
1453
+ - spec/spec_tests/data/retryable_writes/updateMany.yml
1324
1454
  - spec/spec_tests/data/retryable_writes/updateOne-serverErrors.yml
1325
1455
  - spec/spec_tests/data/retryable_writes/deleteOne.yml
1326
1456
  - spec/spec_tests/data/retryable_writes/insertMany.yml
1457
+ - spec/spec_tests/data/cmap/pool-checkout-connection.yml
1458
+ - spec/spec_tests/data/cmap/pool-create.yml
1459
+ - spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml
1460
+ - spec/spec_tests/data/cmap/pool-checkout-error-closed.yml
1461
+ - spec/spec_tests/data/cmap/pool-checkout-no-idle.yml
1462
+ - spec/spec_tests/data/cmap/pool-close-destroy-conns.yml
1463
+ - spec/spec_tests/data/cmap/connection-must-have-id.yml
1464
+ - spec/spec_tests/data/cmap/connection-must-order-ids.yml
1465
+ - spec/spec_tests/data/cmap/pool-checkout-multiple.yml
1466
+ - spec/spec_tests/data/cmap/pool-checkin.yml
1467
+ - spec/spec_tests/data/cmap/pool-checkout-no-stale.yml
1468
+ - spec/spec_tests/data/cmap/pool-create-with-options.yml
1469
+ - spec/spec_tests/data/cmap/pool-close.yml
1470
+ - spec/spec_tests/data/cmap/pool-checkin-make-available.yml
1471
+ - spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml
1472
+ - spec/spec_tests/data/cmap/wait-queue-timeout.yml
1473
+ - spec/spec_tests/data/cmap/pool-create-min-size.yml
1474
+ - spec/spec_tests/data/cmap/wait-queue-fairness.yml
1475
+ - spec/spec_tests/data/cmap/pool-create-max-size.yml
1327
1476
  - spec/spec_tests/data/sdam_monitoring/standalone.yml
1328
1477
  - spec/spec_tests/data/sdam_monitoring/replica_set_with_no_primary.yml
1329
1478
  - spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_and_secondary.yml
@@ -1381,6 +1530,47 @@ test_files:
1381
1530
  - spec/spec_tests/data/crud/read/aggregate.yml
1382
1531
  - spec/spec_tests/data/crud/read/count-collation.yml
1383
1532
  - spec/spec_tests/data/crud/read/aggregate-collation.yml
1533
+ - spec/spec_tests/data/retryable_reads/listCollections.yml
1534
+ - spec/spec_tests/data/retryable_reads/estimatedDocumentCount.yml
1535
+ - spec/spec_tests/data/retryable_reads/listCollectionObjects.yml
1536
+ - spec/spec_tests/data/retryable_reads/listIndexes.yml
1537
+ - spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml
1538
+ - spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml
1539
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml
1540
+ - spec/spec_tests/data/retryable_reads/gridfs-downloadByName.yml
1541
+ - spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml
1542
+ - spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml
1543
+ - spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml
1544
+ - spec/spec_tests/data/retryable_reads/findOne.yml
1545
+ - spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml
1546
+ - spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml
1547
+ - spec/spec_tests/data/retryable_reads/distinct.yml
1548
+ - spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors.yml
1549
+ - spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml
1550
+ - spec/spec_tests/data/retryable_reads/listCollectionNames.yml
1551
+ - spec/spec_tests/data/retryable_reads/find.yml
1552
+ - spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml
1553
+ - spec/spec_tests/data/retryable_reads/listDatabaseObjects.yml
1554
+ - spec/spec_tests/data/retryable_reads/listDatabases.yml
1555
+ - spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml
1556
+ - spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml
1557
+ - spec/spec_tests/data/retryable_reads/listIndexNames.yml
1558
+ - spec/spec_tests/data/retryable_reads/mapReduce.yml
1559
+ - spec/spec_tests/data/retryable_reads/count-serverErrors.yml
1560
+ - spec/spec_tests/data/retryable_reads/countDocuments.yml
1561
+ - spec/spec_tests/data/retryable_reads/count.yml
1562
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml
1563
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml
1564
+ - spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml
1565
+ - spec/spec_tests/data/retryable_reads/gridfs-download.yml
1566
+ - spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml
1567
+ - spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml
1568
+ - spec/spec_tests/data/retryable_reads/find-serverErrors.yml
1569
+ - spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml
1570
+ - spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml
1571
+ - spec/spec_tests/data/retryable_reads/aggregate.yml
1572
+ - spec/spec_tests/data/retryable_reads/listDatabaseNames.yml
1573
+ - spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml
1384
1574
  - spec/spec_tests/data/sdam/single/direct_connection_slave.yml
1385
1575
  - spec/spec_tests/data/sdam/single/not_ok_response.yml
1386
1576
  - spec/spec_tests/data/sdam/single/too_old.yml
@@ -1497,6 +1687,7 @@ test_files:
1497
1687
  - spec/spec_tests/data/transactions/read-concern.yml
1498
1688
  - spec/spec_tests/data/transactions/bulk.yml
1499
1689
  - spec/spec_tests/data/transactions/reads.yml
1690
+ - spec/spec_tests/data/transactions/count.yml
1500
1691
  - spec/spec_tests/data/transactions/findOneAndReplace.yml
1501
1692
  - spec/spec_tests/data/transactions/findOneAndUpdate.yml
1502
1693
  - spec/spec_tests/data/transactions/abort.yml
@@ -1518,6 +1709,8 @@ test_files:
1518
1709
  - spec/spec_tests/transactions_api_spec.rb
1519
1710
  - spec/spec_tests/server_selection_spec.rb
1520
1711
  - spec/spec_tests/command_monitoring_spec.rb
1712
+ - spec/spec_tests/cmap_spec.rb
1713
+ - spec/spec_tests/retryable_reads_spec.rb
1521
1714
  - spec/spec_tests/gridfs_spec.rb
1522
1715
  - spec/spec_tests/sdam_monitoring_spec.rb
1523
1716
  - spec/spec_tests/transactions_spec.rb