mongo 2.13.0.rc1 → 2.13.3
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/lib/mongo/address.rb +1 -1
- data/lib/mongo/auth/aws/request.rb +27 -3
- data/lib/mongo/client.rb +48 -2
- data/lib/mongo/collection.rb +21 -12
- data/lib/mongo/database/view.rb +1 -1
- data/lib/mongo/database.rb +14 -2
- data/lib/mongo/error/invalid_server_auth_host.rb +22 -0
- data/lib/mongo/error/operation_failure.rb +5 -5
- data/lib/mongo/error.rb +2 -0
- data/lib/mongo/grid/fs_bucket.rb +37 -37
- data/lib/mongo/index/view.rb +3 -0
- data/lib/mongo/operation/collections_info/command.rb +5 -0
- data/lib/mongo/operation/collections_info/result.rb +16 -1
- data/lib/mongo/operation/parallel_scan/command.rb +1 -2
- data/lib/mongo/operation/shared/read_preference_supported.rb +38 -36
- data/lib/mongo/operation/shared/sessions_supported.rb +3 -2
- data/lib/mongo/protocol/message.rb +11 -2
- data/lib/mongo/protocol/msg.rb +22 -3
- data/lib/mongo/protocol/query.rb +47 -11
- data/lib/mongo/server/app_metadata.rb +27 -3
- data/lib/mongo/server/connection_base.rb +35 -11
- data/lib/mongo/server_selector/secondary_preferred.rb +2 -7
- data/lib/mongo/version.rb +1 -1
- data/spec/integration/bson_symbol_spec.rb +4 -2
- data/spec/integration/bulk_write_spec.rb +19 -0
- data/spec/integration/client_authentication_options_spec.rb +37 -0
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +9 -5
- data/spec/integration/sdam_error_handling_spec.rb +18 -1
- data/spec/integration/sdam_events_spec.rb +8 -7
- data/spec/integration/secondary_reads_spec.rb +102 -0
- data/spec/integration/size_limit_spec.rb +20 -6
- data/spec/lite_spec_helper.rb +1 -1
- data/spec/mongo/auth/aws/request_region_spec.rb +42 -0
- data/spec/mongo/auth/aws/request_spec.rb +32 -32
- data/spec/mongo/client_construction_spec.rb +123 -0
- data/spec/mongo/client_encryption_spec.rb +16 -10
- data/spec/mongo/crypt/data_key_context_spec.rb +1 -1
- data/spec/mongo/database_spec.rb +64 -0
- data/spec/mongo/index/view_spec.rb +150 -2
- data/spec/mongo/operation/read_preference_legacy_spec.rb +9 -19
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +3 -3
- data/spec/mongo/server/app_metadata_shared.rb +114 -8
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +6 -6
- data/spec/runners/transactions/operation.rb +13 -2
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/cluster_config.rb +221 -0
- data/spec/shared/lib/mrss/constraints.rb +346 -0
- data/spec/shared/lib/mrss/docker_runner.rb +265 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +191 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +115 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +152 -0
- data/spec/shared/lib/mrss/utils.rb +15 -0
- data/spec/shared/share/Dockerfile.erb +231 -0
- data/spec/shared/shlib/distro.sh +73 -0
- data/spec/shared/shlib/server.sh +290 -0
- data/spec/shared/shlib/set_env.sh +128 -0
- data/spec/support/client_registry.rb +8 -4
- data/spec/support/client_registry_macros.rb +14 -5
- data/spec/support/spec_config.rb +12 -0
- data/spec/support/spec_setup.rb +48 -38
- data.tar.gz.sig +3 -1
- metadata +1005 -974
- metadata.gz.sig +0 -0
- data/spec/integration/size_limit_spec.rb~12e1e9c4f... RUBY-2242 Fix zlib compression (#2021) +0 -98
metadata.gz.sig
CHANGED
Binary file
|
data/spec/integration/size_limit_spec.rb~12e1e9c4f... RUBY-2242 Fix zlib compression (#2021)
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'BSON & command size limits' do
|
4
|
-
let(:max_document_size) { 16*1024*1024 }
|
5
|
-
|
6
|
-
before do
|
7
|
-
authorized_collection.delete_many
|
8
|
-
end
|
9
|
-
|
10
|
-
# This test uses a large document that is significantly smaller than the
|
11
|
-
# size limit. It is a basic sanity check.
|
12
|
-
it 'allows user-provided documents to be 15MiB' do
|
13
|
-
document = { key: 'a' * 15*1024*1024, _id: 'foo' }
|
14
|
-
|
15
|
-
authorized_collection.insert_one(document)
|
16
|
-
end
|
17
|
-
|
18
|
-
# This test uses a large document that is significantly larger than the
|
19
|
-
# size limit. It is a basic sanity check.
|
20
|
-
it 'fails single write of oversized documents' do
|
21
|
-
document = { key: 'a' * 17*1024*1024, _id: 'foo' }
|
22
|
-
|
23
|
-
lambda do
|
24
|
-
authorized_collection.insert_one(document)
|
25
|
-
end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/)
|
26
|
-
end
|
27
|
-
|
28
|
-
# This test checks our bulk write splitting when documents are not close
|
29
|
-
# to the limit, but where splitting is definitely required.
|
30
|
-
it 'allows split bulk write of medium sized documents' do
|
31
|
-
# 8 documents of 4 MiB each = 32 MiB total data, should be split over
|
32
|
-
# either 2 or 3 bulk writes depending on how well the driver splits
|
33
|
-
documents = []
|
34
|
-
1.upto(8) do |index|
|
35
|
-
documents << { key: 'a' * 4*1024*1024, _id: "in#{index}" }
|
36
|
-
end
|
37
|
-
|
38
|
-
authorized_collection.insert_many(documents)
|
39
|
-
authorized_collection.count_documents({}).should == 8
|
40
|
-
end
|
41
|
-
|
42
|
-
# This test ensures that document which are too big definitely fail insertion.
|
43
|
-
it 'fails bulk write of oversized documents' do
|
44
|
-
documents = []
|
45
|
-
1.upto(3) do |index|
|
46
|
-
documents << { key: 'a' * 17*1024*1024, _id: "in#{index}" }
|
47
|
-
end
|
48
|
-
|
49
|
-
lambda do
|
50
|
-
authorized_collection.insert_many(documents)
|
51
|
-
end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/)
|
52
|
-
authorized_collection.count_documents({}).should == 0
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'allows user-provided documents to be exactly 16MiB' do
|
56
|
-
# The document must contain the _id field, otherwise the server will
|
57
|
-
# add it which will increase the size of the document as persisted by
|
58
|
-
# the server.
|
59
|
-
document = { key: 'a' * (max_document_size - 28), _id: 'foo' }
|
60
|
-
expect(document.to_bson.length).to eq(max_document_size)
|
61
|
-
|
62
|
-
authorized_collection.insert_one(document)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'fails on the server when a document larger than 16MiB is inserted' do
|
66
|
-
document = { key: 'a' * (max_document_size - 27), _id: 'foo' }
|
67
|
-
expect(document.to_bson.length).to eq(max_document_size+1)
|
68
|
-
|
69
|
-
lambda do
|
70
|
-
authorized_collection.insert_one(document)
|
71
|
-
end.should raise_error(Mongo::Error::OperationFailure, /object to insert too large/)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'fails in the driver when a document larger than 16MiB+16KiB is inserted' do
|
75
|
-
document = { key: 'a' * (max_document_size - 27 + 16*1024), _id: 'foo' }
|
76
|
-
expect(document.to_bson.length).to eq(max_document_size+16*1024+1)
|
77
|
-
|
78
|
-
lambda do
|
79
|
-
authorized_collection.insert_one(document)
|
80
|
-
end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'allows bulk writes of multiple documents of exactly 16 MiB each' do
|
84
|
-
if SpecConfig.instance.compressors
|
85
|
-
pending "RUBY-2234"
|
86
|
-
end
|
87
|
-
|
88
|
-
documents = []
|
89
|
-
1.upto(3) do |index|
|
90
|
-
document = { key: 'a' * (max_document_size - 28), _id: "in#{index}" }
|
91
|
-
expect(document.to_bson.length).to eq(max_document_size)
|
92
|
-
documents << document
|
93
|
-
end
|
94
|
-
|
95
|
-
authorized_collection.insert_many(documents)
|
96
|
-
authorized_collection.count_documents({}).should == 3
|
97
|
-
end
|
98
|
-
end
|