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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +12 -0
- data/lib/mongo.rb +15 -1
- data/lib/mongo/address/ipv6.rb +0 -2
- data/lib/mongo/auth/scram/conversation.rb +0 -3
- data/lib/mongo/bulk_write/result_combiner.rb +12 -2
- data/lib/mongo/client.rb +59 -6
- data/lib/mongo/cluster.rb +19 -8
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +0 -2
- data/lib/mongo/cluster/reapers/socket_reaper.rb +12 -9
- data/lib/mongo/collection.rb +1 -1
- data/lib/mongo/collection/view/aggregation.rb +5 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +30 -10
- data/lib/mongo/collection/view/iterable.rb +13 -6
- data/lib/mongo/collection/view/map_reduce.rb +12 -10
- data/lib/mongo/collection/view/readable.rb +19 -14
- data/lib/mongo/cursor.rb +12 -8
- data/lib/mongo/database.rb +10 -7
- data/lib/mongo/database/view.rb +18 -11
- data/lib/mongo/error.rb +2 -2
- data/lib/mongo/error/connection_check_out_timeout.rb +49 -0
- data/lib/mongo/error/operation_failure.rb +9 -9
- data/lib/mongo/error/parser.rb +25 -3
- data/lib/mongo/error/pool_closed_error.rb +43 -0
- data/lib/mongo/error/sdam_error_detection.rb +18 -0
- data/lib/mongo/grid/file/chunk.rb +0 -2
- data/lib/mongo/grid/fs_bucket.rb +26 -12
- data/lib/mongo/grid/stream/read.rb +36 -21
- data/lib/mongo/index/view.rb +11 -7
- data/lib/mongo/logger.rb +0 -2
- data/lib/mongo/monitoring.rb +31 -0
- data/lib/mongo/monitoring/cmap_log_subscriber.rb +53 -0
- data/lib/mongo/monitoring/event.rb +1 -0
- data/lib/mongo/monitoring/event/cmap.rb +25 -0
- data/lib/mongo/monitoring/event/cmap/base.rb +28 -0
- data/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +78 -0
- data/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb +56 -0
- data/lib/mongo/monitoring/event/cmap/connection_checked_in.rb +63 -0
- data/lib/mongo/monitoring/event/cmap/connection_checked_out.rb +64 -0
- data/lib/mongo/monitoring/event/cmap/connection_closed.rb +103 -0
- data/lib/mongo/monitoring/event/cmap/connection_created.rb +64 -0
- data/lib/mongo/monitoring/event/cmap/connection_ready.rb +64 -0
- data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +57 -0
- data/lib/mongo/monitoring/event/cmap/pool_closed.rb +57 -0
- data/lib/mongo/monitoring/event/cmap/pool_created.rb +63 -0
- data/lib/mongo/monitoring/event/command_started.rb +12 -3
- data/lib/mongo/monitoring/publishable.rb +10 -2
- data/lib/mongo/operation.rb +0 -1
- data/lib/mongo/operation/find/legacy/result.rb +1 -0
- data/lib/mongo/operation/list_collections/result.rb +7 -1
- data/lib/mongo/operation/result.rb +10 -1
- data/lib/mongo/operation/shared/executable.rb +15 -0
- data/lib/mongo/operation/shared/result/use_legacy_error_parser.rb +29 -0
- data/lib/mongo/operation/shared/specifiable.rb +0 -16
- data/lib/mongo/operation/update/legacy/result.rb +1 -0
- data/lib/mongo/protocol/compressed.rb +0 -2
- data/lib/mongo/protocol/msg.rb +25 -2
- data/lib/mongo/retryable.rb +171 -33
- data/lib/mongo/server.rb +26 -7
- data/lib/mongo/server/app_metadata.rb +0 -2
- data/lib/mongo/server/connectable.rb +8 -2
- data/lib/mongo/server/connection.rb +83 -13
- data/lib/mongo/server/connection_base.rb +1 -1
- data/lib/mongo/server/connection_pool.rb +439 -43
- data/lib/mongo/server/monitor/connection.rb +4 -1
- data/lib/mongo/session.rb +37 -5
- data/lib/mongo/session/session_pool.rb +2 -2
- data/lib/mongo/socket.rb +0 -2
- data/lib/mongo/socket/ssl.rb +0 -2
- data/lib/mongo/uri.rb +127 -66
- data/lib/mongo/uri/srv_protocol.rb +35 -13
- data/lib/mongo/version.rb +1 -1
- data/spec/README.md +190 -63
- data/spec/integration/change_stream_spec.rb +64 -0
- data/spec/integration/command_spec.rb +0 -7
- data/spec/integration/error_detection_spec.rb +39 -0
- data/spec/integration/read_concern.rb +83 -0
- data/spec/integration/retryable_writes_spec.rb +6 -50
- data/spec/integration/sdam_error_handling_spec.rb +60 -7
- data/spec/integration/ssl_uri_options_spec.rb +24 -0
- data/spec/integration/step_down_spec.rb +197 -0
- data/spec/lite_spec_helper.rb +4 -0
- data/spec/mongo/client_construction_spec.rb +42 -17
- data/spec/mongo/client_spec.rb +32 -1
- data/spec/mongo/cluster/socket_reaper_spec.rb +2 -2
- data/spec/mongo/cluster_spec.rb +36 -2
- data/spec/mongo/collection/view/aggregation_spec.rb +2 -0
- data/spec/mongo/collection/view/change_stream_spec.rb +28 -28
- data/spec/mongo/collection/view/readable_spec.rb +1 -1
- data/spec/mongo/collection/view_spec.rb +3 -1
- data/spec/mongo/cursor_spec.rb +5 -5
- data/spec/mongo/error/parser_spec.rb +61 -1
- data/spec/mongo/grid/stream/read_spec.rb +2 -2
- data/spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb +23 -0
- data/spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb +19 -0
- data/spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb +23 -0
- data/spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb +23 -0
- data/spec/mongo/monitoring/event/cmap/connection_closed_spec.rb +27 -0
- data/spec/mongo/monitoring/event/cmap/connection_created_spec.rb +24 -0
- data/spec/mongo/monitoring/event/cmap/connection_ready_spec.rb +24 -0
- data/spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb +19 -0
- data/spec/mongo/monitoring/event/cmap/pool_closed_spec.rb +19 -0
- data/spec/mongo/monitoring/event/cmap/pool_created_spec.rb +26 -0
- data/spec/mongo/operation/delete/bulk_spec.rb +1 -6
- data/spec/mongo/operation/delete/command_spec.rb +1 -1
- data/spec/mongo/operation/delete/op_msg_spec.rb +1 -1
- data/spec/mongo/operation/delete_spec.rb +4 -4
- data/spec/mongo/operation/insert/bulk_spec.rb +1 -1
- data/spec/mongo/operation/insert/command_spec.rb +1 -1
- data/spec/mongo/operation/insert/op_msg_spec.rb +1 -1
- data/spec/mongo/operation/update/bulk_spec.rb +1 -1
- data/spec/mongo/operation/update/command_spec.rb +2 -2
- data/spec/mongo/operation/update/op_msg_spec.rb +2 -2
- data/spec/mongo/protocol/msg_spec.rb +11 -0
- data/spec/mongo/retryable_spec.rb +78 -25
- data/spec/mongo/server/connection_pool_spec.rb +661 -126
- data/spec/mongo/server/connection_spec.rb +55 -7
- data/spec/mongo/server_spec.rb +5 -0
- data/spec/mongo/uri/srv_protocol_spec.rb +135 -2
- data/spec/mongo/uri_option_parsing_spec.rb +511 -0
- data/spec/mongo/uri_spec.rb +42 -6
- data/spec/spec_helper.rb +1 -84
- data/spec/spec_tests/cmap_spec.rb +50 -0
- data/spec/spec_tests/command_monitoring_spec.rb +7 -18
- data/spec/spec_tests/crud_spec.rb +3 -49
- data/spec/spec_tests/data/cmap/connection-must-have-id.yml +21 -0
- data/spec/spec_tests/data/cmap/connection-must-order-ids.yml +21 -0
- data/spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml +24 -0
- data/spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml +24 -0
- data/spec/spec_tests/data/cmap/pool-checkin-make-available.yml +21 -0
- data/spec/spec_tests/data/cmap/pool-checkin.yml +18 -0
- data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +13 -0
- data/spec/spec_tests/data/cmap/pool-checkout-error-closed.yml +28 -0
- data/spec/spec_tests/data/cmap/pool-checkout-multiple.yml +34 -0
- data/spec/spec_tests/data/cmap/pool-checkout-no-idle.yml +31 -0
- data/spec/spec_tests/data/cmap/pool-checkout-no-stale.yml +29 -0
- data/spec/spec_tests/data/cmap/pool-close-destroy-conns.yml +26 -0
- data/spec/spec_tests/data/cmap/pool-close.yml +11 -0
- data/spec/spec_tests/data/cmap/pool-create-max-size.yml +56 -0
- data/spec/spec_tests/data/cmap/pool-create-min-size.yml +27 -0
- data/spec/spec_tests/data/cmap/pool-create-with-options.yml +20 -0
- data/spec/spec_tests/data/cmap/pool-create.yml +12 -0
- data/spec/spec_tests/data/cmap/wait-queue-fairness.yml +94 -0
- data/spec/spec_tests/data/cmap/wait-queue-timeout.yml +41 -0
- data/spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml +157 -0
- data/spec/spec_tests/data/retryable_reads/aggregate.yml +87 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +149 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +61 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +149 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +65 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +153 -0
- data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +61 -0
- data/spec/spec_tests/data/retryable_reads/count-serverErrors.yml +150 -0
- data/spec/spec_tests/data/retryable_reads/count.yml +64 -0
- data/spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml +150 -0
- data/spec/spec_tests/data/retryable_reads/countDocuments.yml +64 -0
- data/spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml +156 -0
- data/spec/spec_tests/data/retryable_reads/distinct.yml +71 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors.yml +148 -0
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount.yml +62 -0
- data/spec/spec_tests/data/retryable_reads/find-serverErrors.yml +160 -0
- data/spec/spec_tests/data/retryable_reads/find.yml +86 -0
- data/spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml +154 -0
- data/spec/spec_tests/data/retryable_reads/findOne.yml +68 -0
- data/spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml +173 -0
- data/spec/spec_tests/data/retryable_reads/gridfs-download.yml +79 -0
- data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml +174 -0
- data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName.yml +79 -0
- data/spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml +143 -0
- data/spec/spec_tests/data/retryable_reads/listCollectionNames.yml +59 -0
- data/spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml +144 -0
- data/spec/spec_tests/data/retryable_reads/listCollectionObjects.yml +59 -0
- data/spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml +143 -0
- data/spec/spec_tests/data/retryable_reads/listCollections.yml +59 -0
- data/spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml +143 -0
- data/spec/spec_tests/data/retryable_reads/listDatabaseNames.yml +59 -0
- data/spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml +144 -0
- data/spec/spec_tests/data/retryable_reads/listDatabaseObjects.yml +59 -0
- data/spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml +144 -0
- data/spec/spec_tests/data/retryable_reads/listDatabases.yml +59 -0
- data/spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml +144 -0
- data/spec/spec_tests/data/retryable_reads/listIndexNames.yml +60 -0
- data/spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml +145 -0
- data/spec/spec_tests/data/retryable_reads/listIndexes.yml +60 -0
- data/spec/spec_tests/data/retryable_reads/mapReduce.yml +60 -0
- data/spec/spec_tests/data/retryable_writes/bulkWrite-serverErrors.yml +10 -7
- data/spec/spec_tests/data/retryable_writes/bulkWrite.yml +15 -22
- data/spec/spec_tests/data/retryable_writes/deleteMany.yml +22 -0
- data/spec/spec_tests/data/retryable_writes/deleteOne-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_writes/deleteOne.yml +5 -8
- data/spec/spec_tests/data/retryable_writes/findOneAndDelete-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_writes/findOneAndDelete.yml +5 -8
- data/spec/spec_tests/data/retryable_writes/findOneAndReplace-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_writes/findOneAndReplace.yml +5 -8
- data/spec/spec_tests/data/retryable_writes/findOneAndUpdate-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_writes/findOneAndUpdate.yml +5 -8
- data/spec/spec_tests/data/retryable_writes/insertMany-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_writes/insertMany.yml +5 -8
- data/spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml +10 -45
- data/spec/spec_tests/data/retryable_writes/insertOne.yml +5 -8
- data/spec/spec_tests/data/retryable_writes/replaceOne-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_writes/replaceOne.yml +5 -8
- data/spec/spec_tests/data/retryable_writes/updateMany.yml +27 -0
- data/spec/spec_tests/data/retryable_writes/updateOne-serverErrors.yml +8 -7
- data/spec/spec_tests/data/retryable_writes/updateOne.yml +5 -14
- data/spec/spec_tests/data/transactions/abort.yml +7 -2
- data/spec/spec_tests/data/transactions/bulk.yml +7 -2
- data/spec/spec_tests/data/transactions/causal-consistency.yml +11 -4
- data/spec/spec_tests/data/transactions/commit.yml +11 -4
- data/spec/spec_tests/data/transactions/count.yml +64 -0
- data/spec/spec_tests/data/transactions/delete.yml +7 -2
- data/spec/spec_tests/data/transactions/error-labels.yml +8 -2
- data/spec/spec_tests/data/transactions/errors.yml +7 -2
- data/spec/spec_tests/data/transactions/findOneAndDelete.yml +7 -2
- data/spec/spec_tests/data/transactions/findOneAndReplace.yml +7 -2
- data/spec/spec_tests/data/transactions/findOneAndUpdate.yml +7 -2
- data/spec/spec_tests/data/transactions/insert.yml +9 -2
- data/spec/spec_tests/data/transactions/isolation.yml +7 -2
- data/spec/spec_tests/data/transactions/read-concern.yml +15 -6
- data/spec/spec_tests/data/transactions/read-pref.yml +7 -2
- data/spec/spec_tests/data/transactions/reads.yml +8 -48
- data/spec/spec_tests/data/transactions/retryable-abort.yml +7 -2
- data/spec/spec_tests/data/transactions/retryable-commit.yml +7 -2
- data/spec/spec_tests/data/transactions/retryable-writes.yml +7 -2
- data/spec/spec_tests/data/transactions/run-command.yml +7 -2
- data/spec/spec_tests/data/transactions/transaction-options.yml +7 -2
- data/spec/spec_tests/data/transactions/update.yml +7 -2
- data/spec/spec_tests/data/transactions/write-concern.yml +7 -2
- data/spec/spec_tests/data/transactions_api/callback-aborts.yml +6 -1
- data/spec/spec_tests/data/transactions_api/callback-commits.yml +6 -1
- data/spec/spec_tests/data/transactions_api/callback-retry.yml +6 -1
- data/spec/spec_tests/data/transactions_api/commit-retry.yml +6 -1
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +6 -3
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +6 -1
- data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +6 -1
- data/spec/spec_tests/data/transactions_api/commit.yml +6 -1
- data/spec/spec_tests/data/transactions_api/transaction-options.yml +6 -1
- data/spec/spec_tests/retryable_reads_spec.rb +11 -0
- data/spec/spec_tests/retryable_writes_spec.rb +4 -69
- data/spec/spec_tests/transactions_api_spec.rb +42 -37
- data/spec/spec_tests/transactions_spec.rb +42 -33
- data/spec/support/authorization.rb +12 -0
- data/spec/support/change_streams/operation.rb +1 -1
- data/spec/support/client_registry.rb +20 -0
- data/spec/support/cluster_config.rb +16 -15
- data/spec/support/cluster_tools.rb +346 -0
- data/spec/support/cmap.rb +367 -0
- data/spec/support/cmap/verifier.rb +46 -0
- data/spec/support/command_monitoring.rb +4 -6
- data/spec/support/common_shortcuts.rb +6 -0
- data/spec/support/connection_string.rb +2 -2
- data/spec/support/crud.rb +171 -184
- data/spec/support/crud/operation.rb +43 -0
- data/spec/support/crud/outcome.rb +53 -0
- data/spec/support/crud/read.rb +102 -12
- data/spec/support/crud/requirement.rb +69 -0
- data/spec/support/crud/spec.rb +68 -0
- data/spec/support/crud/test.rb +141 -0
- data/spec/support/crud/verifier.rb +96 -18
- data/spec/support/crud/write.rb +18 -3
- data/spec/support/event_subscriber.rb +15 -0
- data/spec/support/primary_socket.rb +2 -2
- data/spec/support/spec_config.rb +89 -20
- data/spec/support/transactions.rb +2 -306
- data/spec/support/transactions/operation.rb +7 -7
- data/spec/support/transactions/spec.rb +28 -0
- data/spec/support/transactions/test.rb +191 -0
- data/spec/support/utils.rb +123 -0
- metadata +202 -9
- metadata.gz.sig +0 -0
- data/lib/mongo/server/connection_pool/queue.rb +0 -359
- data/spec/mongo/server/connection_pool/queue_spec.rb +0 -353
- data/spec/support/transactions/verifier.rb +0 -97
@@ -22,7 +22,7 @@ describe Mongo::Error::Parser do
|
|
22
22
|
context 'when the document contains an errmsg' do
|
23
23
|
|
24
24
|
let(:document) do
|
25
|
-
{ 'errmsg' => 'no such command: notacommand', 'code'=>59 }
|
25
|
+
{ 'errmsg' => 'no such command: notacommand', 'code' => 59 }
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'returns the message' do
|
@@ -101,6 +101,26 @@ describe Mongo::Error::Parser do
|
|
101
101
|
described_class.new(document)
|
102
102
|
end
|
103
103
|
|
104
|
+
context 'when document contains code and ok: 1' do
|
105
|
+
let(:document) do
|
106
|
+
{ 'ok' => 1, 'errmsg' => 'not master', 'code' => 10107, 'codeName' => 'NotMaster' }
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'returns nil' do
|
110
|
+
expect(parser.code).to be nil
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'when document contains code and ok: 1.0' do
|
115
|
+
let(:document) do
|
116
|
+
{ 'ok' => 1.0, 'errmsg' => 'not master', 'code' => 10107, 'codeName' => 'NotMaster' }
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'returns nil' do
|
120
|
+
expect(parser.code).to be nil
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
104
124
|
context 'when document contains code' do
|
105
125
|
let(:document) do
|
106
126
|
{ 'ok' => 0, 'errmsg' => 'not master', 'code' => 10107, 'codeName' => 'NotMaster' }
|
@@ -109,6 +129,16 @@ describe Mongo::Error::Parser do
|
|
109
129
|
it 'returns the code' do
|
110
130
|
expect(parser.code).to eq(10107)
|
111
131
|
end
|
132
|
+
|
133
|
+
context 'with legacy option' do
|
134
|
+
let(:parser) do
|
135
|
+
described_class.new(document, nil, legacy: true)
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'returns nil' do
|
139
|
+
expect(parser.code).to be nil
|
140
|
+
end
|
141
|
+
end
|
112
142
|
end
|
113
143
|
|
114
144
|
context 'when document does not contain code' do
|
@@ -149,6 +179,26 @@ describe Mongo::Error::Parser do
|
|
149
179
|
described_class.new(document)
|
150
180
|
end
|
151
181
|
|
182
|
+
context 'when document contains code name and ok: 1' do
|
183
|
+
let(:document) do
|
184
|
+
{ 'ok' => 1, 'errmsg' => 'not master', 'code' => 10107, 'codeName' => 'NotMaster' }
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'returns nil' do
|
188
|
+
expect(parser.code_name).to be nil
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context 'when document contains code name and ok: 1.0' do
|
193
|
+
let(:document) do
|
194
|
+
{ 'ok' => 1.0, 'errmsg' => 'not master', 'code' => 10107, 'codeName' => 'NotMaster' }
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'returns nil' do
|
198
|
+
expect(parser.code_name).to be nil
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
152
202
|
context 'when document contains code name' do
|
153
203
|
let(:document) do
|
154
204
|
{ 'ok' => 0, 'errmsg' => 'not master', 'code' => 10107, 'codeName' => 'NotMaster' }
|
@@ -157,6 +207,16 @@ describe Mongo::Error::Parser do
|
|
157
207
|
it 'returns the code name' do
|
158
208
|
expect(parser.code_name).to eq('NotMaster')
|
159
209
|
end
|
210
|
+
|
211
|
+
context 'with legacy option' do
|
212
|
+
let(:parser) do
|
213
|
+
described_class.new(document, nil, legacy: true)
|
214
|
+
end
|
215
|
+
|
216
|
+
it 'returns nil' do
|
217
|
+
expect(parser.code_name).to be nil
|
218
|
+
end
|
219
|
+
end
|
160
220
|
end
|
161
221
|
|
162
222
|
context 'when document does not contain code name' do
|
@@ -238,10 +238,10 @@ describe Mongo::Grid::FSBucket::Stream::Read do
|
|
238
238
|
stream.close
|
239
239
|
end
|
240
240
|
|
241
|
-
it '
|
241
|
+
it 'does not raise an exception' do
|
242
242
|
expect {
|
243
243
|
stream.close
|
244
|
-
}.
|
244
|
+
}.not_to raise_error
|
245
245
|
end
|
246
246
|
end
|
247
247
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::ConnectionCheckOutFailed do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:reason) do
|
12
|
+
described_class::TIMEOUT
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:event) do
|
16
|
+
described_class.new(address, reason)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'renders correctly' do
|
20
|
+
expect(event.summary).to eq('#<ConnectionCheckOutFailed address=127.0.0.1:27017 reason=timeout>')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::ConnectionCheckOutStarted do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:event) do
|
12
|
+
described_class.new(address)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'renders correctly' do
|
16
|
+
expect(event.summary).to eq('#<ConnectionCheckOutStarted address=127.0.0.1:27017>')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::ConnectionCheckedIn do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:id) do
|
12
|
+
1
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:event) do
|
16
|
+
described_class.new(address, id)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'renders correctly' do
|
20
|
+
expect(event.summary).to eq('#<ConnectionCheckedIn address=127.0.0.1:27017 connection_id=1>')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::ConnectionCheckedOut do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:id) do
|
12
|
+
1
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:event) do
|
16
|
+
described_class.new(address, id)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'renders correctly' do
|
20
|
+
expect(event.summary).to eq('#<ConnectionCheckedOut address=127.0.0.1:27017 connection_id=1>')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::ConnectionClosed do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:reason) do
|
12
|
+
described_class::STALE
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:id) do
|
16
|
+
1
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:event) do
|
20
|
+
described_class.new(address, id, reason)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'renders correctly' do
|
24
|
+
expect(event.summary).to eq('#<ConnectionClosed address=127.0.0.1:27017 connection_id=1 reason=stale>')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::ConnectionCreated do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
let(:id) do
|
13
|
+
1
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:event) do
|
17
|
+
described_class.new(address, id)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'renders correctly' do
|
21
|
+
expect(event.summary).to eq('#<ConnectionCreated address=127.0.0.1:27017 connection_id=1>')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::ConnectionReady do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
let(:id) do
|
13
|
+
1
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:event) do
|
17
|
+
described_class.new(address, id)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'renders correctly' do
|
21
|
+
expect(event.summary).to eq('#<ConnectionReady address=127.0.0.1:27017 connection_id=1>')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::PoolCleared do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:event) do
|
12
|
+
described_class.new(address)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'renders correctly' do
|
16
|
+
expect(event.summary).to eq('#<PoolCleared address=127.0.0.1:27017>')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::PoolClosed do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:event) do
|
12
|
+
described_class.new(address)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'renders correctly' do
|
16
|
+
expect(event.summary).to eq('#<PoolClosed address=127.0.0.1:27017>')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'lite_spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Monitoring::Event::Cmap::PoolCreated do
|
4
|
+
|
5
|
+
describe '#summary' do
|
6
|
+
|
7
|
+
let(:address) do
|
8
|
+
Mongo::Address.new('127.0.0.1:27017')
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:options) do
|
12
|
+
{
|
13
|
+
wait_queue_timeout: 3,
|
14
|
+
min_pool_size: 5,
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:event) do
|
19
|
+
described_class.new(address, options)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'renders correctly' do
|
23
|
+
expect(event.summary).to eq('#<PoolCreated address=127.0.0.1:27017 options={:wait_queue_timeout=>3, :min_pool_size=>5}>')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -10,7 +10,6 @@ describe Mongo::Operation::Delete do
|
|
10
10
|
{ :deletes => documents,
|
11
11
|
:db_name => SpecConfig.instance.test_db,
|
12
12
|
:coll_name => TEST_COLL,
|
13
|
-
:write_concern => Mongo::WriteConcern.get(SpecConfig.instance.write_concern),
|
14
13
|
:ordered => true
|
15
14
|
}
|
16
15
|
end
|
@@ -48,7 +47,6 @@ describe Mongo::Operation::Delete do
|
|
48
47
|
{ :deletes => other_docs,
|
49
48
|
:db_name => SpecConfig.instance.test_db,
|
50
49
|
:coll_name => TEST_COLL,
|
51
|
-
:write_concern => Mongo::WriteConcern.get(SpecConfig.instance.write_concern),
|
52
50
|
:ordered => true
|
53
51
|
}
|
54
52
|
end
|
@@ -114,7 +112,6 @@ describe Mongo::Operation::Delete do
|
|
114
112
|
deletes: documents,
|
115
113
|
db_name: SpecConfig.instance.test_db,
|
116
114
|
coll_name: TEST_COLL,
|
117
|
-
write_concern: Mongo::WriteConcern.get(SpecConfig.instance.write_concern)
|
118
115
|
})
|
119
116
|
end
|
120
117
|
|
@@ -143,7 +140,6 @@ describe Mongo::Operation::Delete do
|
|
143
140
|
{ :deletes => documents,
|
144
141
|
:db_name => SpecConfig.instance.test_db,
|
145
142
|
:coll_name => TEST_COLL,
|
146
|
-
:write_concern => Mongo::WriteConcern.get(SpecConfig.instance.write_concern),
|
147
143
|
:ordered => true
|
148
144
|
}
|
149
145
|
end
|
@@ -157,7 +153,7 @@ describe Mongo::Operation::Delete do
|
|
157
153
|
context 'when write concern is acknowledged' do
|
158
154
|
|
159
155
|
let(:write_concern) do
|
160
|
-
Mongo::WriteConcern.get(
|
156
|
+
Mongo::WriteConcern.get(w: :majority)
|
161
157
|
end
|
162
158
|
|
163
159
|
it 'aborts after first error' do
|
@@ -192,7 +188,6 @@ describe Mongo::Operation::Delete do
|
|
192
188
|
{ :deletes => documents,
|
193
189
|
:db_name => SpecConfig.instance.test_db,
|
194
190
|
:coll_name => TEST_COLL,
|
195
|
-
:write_concern => Mongo::WriteConcern.get(SpecConfig.instance.write_concern),
|
196
191
|
:ordered => false
|
197
192
|
}
|
198
193
|
end
|
@@ -23,7 +23,7 @@ describe Mongo::Operation::Delete do
|
|
23
23
|
{ :deletes => [ document ],
|
24
24
|
:db_name => SpecConfig.instance.test_db,
|
25
25
|
:coll_name => TEST_COLL,
|
26
|
-
:write_concern => Mongo::WriteConcern.get(
|
26
|
+
:write_concern => Mongo::WriteConcern.get(w: :majority),
|
27
27
|
:ordered => true
|
28
28
|
}
|
29
29
|
end
|
@@ -59,7 +59,7 @@ describe Mongo::Operation::Delete do
|
|
59
59
|
{ :deletes => [ other_doc ],
|
60
60
|
:db_name => SpecConfig.instance.test_db,
|
61
61
|
:coll_name => TEST_COLL,
|
62
|
-
:write_concern => Mongo::WriteConcern.get(
|
62
|
+
:write_concern => Mongo::WriteConcern.get(w: :majority),
|
63
63
|
:ordered => true
|
64
64
|
}
|
65
65
|
end
|
@@ -92,7 +92,7 @@ describe Mongo::Operation::Delete do
|
|
92
92
|
deletes: [ document ],
|
93
93
|
db_name: SpecConfig.instance.test_db,
|
94
94
|
coll_name: TEST_COLL,
|
95
|
-
write_concern: Mongo::WriteConcern.get(
|
95
|
+
write_concern: Mongo::WriteConcern.get(w: :majority)
|
96
96
|
})
|
97
97
|
end
|
98
98
|
|
@@ -136,7 +136,7 @@ describe Mongo::Operation::Delete do
|
|
136
136
|
deletes: [ document ],
|
137
137
|
db_name: SpecConfig.instance.test_db,
|
138
138
|
coll_name: TEST_COLL,
|
139
|
-
write_concern: Mongo::WriteConcern.get(
|
139
|
+
write_concern: Mongo::WriteConcern.get(w: :majority)
|
140
140
|
})
|
141
141
|
end
|
142
142
|
|