mongo 2.12.0.rc0 → 2.12.1
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/README.md +2 -1
- data/lib/mongo/client.rb +23 -9
- data/lib/mongo/client_encryption.rb +1 -1
- data/lib/mongo/cluster.rb +6 -2
- data/lib/mongo/crypt/auto_decryption_context.rb +3 -5
- data/lib/mongo/crypt/auto_encrypter.rb +17 -7
- data/lib/mongo/crypt/binding.rb +446 -379
- data/lib/mongo/crypt/context.rb +4 -4
- data/lib/mongo/crypt/encryption_io.rb +16 -10
- data/lib/mongo/crypt/explicit_encrypter.rb +3 -3
- data/lib/mongo/crypt/explicit_encryption_context.rb +1 -1
- data/lib/mongo/crypt/handle.rb +26 -4
- data/lib/mongo/crypt/hooks.rb +1 -1
- data/lib/mongo/database.rb +11 -1
- data/lib/mongo/error/bulk_write_error.rb +16 -14
- data/lib/mongo/error/notable.rb +0 -15
- data/lib/mongo/error/parser.rb +1 -1
- data/lib/mongo/grid/file/info.rb +1 -1
- data/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +1 -1
- data/lib/mongo/operation/insert/command.rb +3 -2
- data/lib/mongo/operation/insert/legacy.rb +2 -1
- data/lib/mongo/operation/insert/op_msg.rb +1 -1
- data/lib/mongo/operation/shared/executable.rb +9 -9
- data/lib/mongo/operation/shared/op_msg_or_command.rb +2 -2
- data/lib/mongo/operation/shared/read_preference_supported.rb +68 -19
- data/lib/mongo/operation/shared/response_handling.rb +1 -1
- data/lib/mongo/operation/shared/sessions_supported.rb +44 -3
- data/lib/mongo/protocol/bit_vector.rb +2 -1
- data/lib/mongo/protocol/message.rb +22 -7
- data/lib/mongo/protocol/msg.rb +2 -5
- data/lib/mongo/protocol/serializers.rb +32 -11
- data/lib/mongo/retryable.rb +1 -1
- data/lib/mongo/server/connection.rb +1 -1
- data/lib/mongo/server/connection_base.rb +9 -4
- data/lib/mongo/server/connection_pool/populator.rb +1 -1
- data/lib/mongo/session.rb +1 -1
- data/lib/mongo/srv/monitor.rb +73 -42
- data/lib/mongo/srv/result.rb +0 -1
- data/lib/mongo/uri.rb +1 -1
- data/lib/mongo/uri/srv_protocol.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +0 -2
- data/spec/README.md +106 -12
- data/spec/integration/client_construction_spec.rb +29 -5
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +6 -4
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +19 -17
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +5 -4
- data/spec/integration/client_side_encryption/auto_encryption_old_wire_version_spec.rb +11 -8
- data/spec/integration/client_side_encryption/auto_encryption_reconnect_spec.rb +14 -9
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +46 -45
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +11 -7
- data/spec/integration/client_side_encryption/bypass_mongocryptd_spawn_spec.rb +13 -9
- data/spec/integration/client_side_encryption/client_close_spec.rb +10 -6
- data/spec/integration/client_side_encryption/corpus_spec.rb +19 -14
- data/spec/integration/client_side_encryption/data_key_spec.rb +10 -8
- data/spec/integration/client_side_encryption/external_key_vault_spec.rb +12 -8
- data/spec/integration/client_side_encryption/views_spec.rb +6 -4
- data/spec/integration/client_update_spec.rb +36 -2
- data/spec/integration/crud_spec.rb +89 -0
- data/spec/integration/read_preference_spec.rb +26 -0
- data/spec/integration/srv_monitoring_spec.rb +2 -2
- data/spec/kerberos/kerberos_spec.rb +87 -0
- data/spec/lite_spec_helper.rb +4 -8
- data/spec/mongo/bulk_write/result_spec.rb +11 -7
- data/spec/mongo/client_encryption_spec.rb +3 -6
- data/spec/mongo/crypt/auto_encrypter_spec.rb +8 -3
- data/spec/mongo/crypt/handle_spec.rb +38 -4
- data/spec/mongo/error/bulk_write_error_spec.rb +49 -0
- data/spec/mongo/error/notable_spec.rb +59 -0
- data/spec/mongo/operation/find/legacy_spec.rb +1 -0
- data/spec/mongo/operation/read_preference_legacy_spec.rb +351 -0
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +194 -0
- data/spec/mongo/srv/monitor_spec.rb +88 -69
- data/spec/runners/transactions.rb +5 -7
- data/spec/spec_tests/client_side_encryption_spec.rb +0 -5
- data/spec/spec_tests/data/client_side_encryption/bulk.yml +3 -0
- data/spec/spec_tests/data/client_side_encryption/replaceOne.yml +4 -1
- data/spec/spec_tests/data/client_side_encryption/updateOne.yml +3 -0
- data/spec/support/cluster_tools.rb +6 -1
- data/spec/support/crypt.rb +14 -0
- data/spec/support/lite_constraints.rb +3 -1
- data/spec/support/spec_config.rb +10 -0
- data/spec/support/utils.rb +9 -1
- metadata +15 -14
- metadata.gz.sig +0 -0
- data/lib/mongo/cluster/srv_monitor.rb +0 -127
- data/lib/mongo/srv/warning_result.rb +0 -35
- data/spec/enterprise_auth/kerberos_spec.rb +0 -58
- data/spec/mongo/cluster/srv_monitor_spec.rb +0 -214
- data/spec/mongo/operation/read_preference_spec.rb +0 -245
@@ -1,82 +1,101 @@
|
|
1
1
|
require 'lite_spec_helper'
|
2
2
|
|
3
|
-
describe Mongo::
|
3
|
+
describe Mongo::Srv::Monitor do
|
4
4
|
describe '#scan!' do
|
5
5
|
let(:hostname) do
|
6
|
-
'test1.test.build.10gen.cc
|
6
|
+
'test1.test.build.10gen.cc'
|
7
7
|
end
|
8
8
|
|
9
9
|
let(:hosts) do
|
10
10
|
[
|
11
|
-
'localhost.test.build.10gen.cc
|
12
|
-
'localhost.test.build.10gen.cc
|
11
|
+
'localhost.test.build.10gen.cc:27017',
|
12
|
+
'localhost.test.build.10gen.cc:27018',
|
13
13
|
]
|
14
14
|
end
|
15
15
|
|
16
|
-
let(:
|
17
|
-
double('
|
18
|
-
allow(
|
19
|
-
allow(
|
20
|
-
allow(
|
21
|
-
allow(
|
16
|
+
let(:result) do
|
17
|
+
double('result').tap do |result|
|
18
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
19
|
+
allow(result).to receive(:address_strs).and_return(hosts)
|
20
|
+
allow(result).to receive(:empty?).and_return(false)
|
21
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
let(:uri_resolver) do
|
26
|
+
double('uri resolver').tap do |resolver|
|
27
|
+
expect(resolver).to receive(:get_records).and_return(result)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:srv_uri) do
|
32
|
+
Mongo::URI.get("mongodb+srv://this.is.not.used")
|
33
|
+
end
|
25
34
|
|
26
35
|
let(:cluster) do
|
27
|
-
Mongo::Cluster.new(
|
36
|
+
Mongo::Cluster.new(hosts, Mongo::Monitoring.new, monitoring_io: false)
|
28
37
|
end
|
29
38
|
|
30
|
-
let(:
|
31
|
-
described_class.new(cluster,
|
39
|
+
let(:monitor) do
|
40
|
+
described_class.new(cluster, srv_uri: srv_uri)
|
32
41
|
end
|
33
42
|
|
34
43
|
before do
|
35
|
-
|
44
|
+
# monitor instantiation triggers cluster instantiation which
|
45
|
+
# performs real SRV lookups for the hostname.
|
46
|
+
# The next lookup (the one performed when cluster is already set up)
|
47
|
+
# is using our doubles.
|
48
|
+
RSpec::Mocks.with_temporary_scope do
|
49
|
+
allow(uri_resolver).to receive(:get_txt_options_string)
|
50
|
+
expect(Mongo::Srv::Resolver).to receive(:new).ordered.and_return(uri_resolver)
|
51
|
+
allow(resolver).to receive(:get_txt_options_string)
|
52
|
+
expect(Mongo::Srv::Resolver).to receive(:new).ordered.and_return(resolver)
|
53
|
+
monitor.send(:scan!)
|
54
|
+
end
|
36
55
|
end
|
37
56
|
|
38
57
|
context 'when a new DNS record is added' do
|
39
58
|
let(:new_hosts) do
|
40
|
-
hosts + ['
|
59
|
+
hosts + ['localhost.test.build.10gen.cc:27019']
|
41
60
|
end
|
42
61
|
|
43
|
-
let(:
|
44
|
-
double('
|
45
|
-
allow(
|
46
|
-
allow(
|
47
|
-
allow(
|
48
|
-
allow(
|
62
|
+
let(:new_result) do
|
63
|
+
double('result').tap do |result|
|
64
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
65
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
66
|
+
allow(result).to receive(:empty?).and_return(false)
|
67
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
49
68
|
end
|
50
69
|
end
|
51
70
|
|
52
71
|
let(:resolver) do
|
53
|
-
double('resolver').tap do |resolver|
|
54
|
-
|
72
|
+
double('monitor resolver').tap do |resolver|
|
73
|
+
expect(resolver).to receive(:get_records).and_return(new_result)
|
55
74
|
end
|
56
75
|
end
|
57
76
|
|
58
77
|
it 'adds the new host to the cluster' do
|
59
|
-
expect(cluster.
|
78
|
+
expect(cluster.servers_list.map(&:address).map(&:to_s).sort).to eq(new_hosts.sort)
|
60
79
|
end
|
61
80
|
end
|
62
81
|
|
63
82
|
context 'when a DNS record is removed' do
|
64
83
|
let(:new_hosts) do
|
65
|
-
hosts - ['test1.test.build.10gen.cc
|
84
|
+
hosts - ['test1.test.build.10gen.cc:27018']
|
66
85
|
end
|
67
86
|
|
68
|
-
let(:
|
69
|
-
double('
|
70
|
-
allow(
|
71
|
-
allow(
|
72
|
-
allow(
|
73
|
-
allow(
|
87
|
+
let(:new_result) do
|
88
|
+
double('result').tap do |result|
|
89
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
90
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
91
|
+
allow(result).to receive(:empty?).and_return(false)
|
92
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
74
93
|
end
|
75
94
|
end
|
76
95
|
|
77
96
|
let(:resolver) do
|
78
97
|
double('resolver').tap do |resolver|
|
79
|
-
allow(resolver).to receive(:get_records).and_return(
|
98
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
80
99
|
end
|
81
100
|
end
|
82
101
|
|
@@ -87,21 +106,21 @@ describe Mongo::SRV::Monitor do
|
|
87
106
|
|
88
107
|
context 'when a single DNS record is replaced' do
|
89
108
|
let(:new_hosts) do
|
90
|
-
hosts - ['test1.test.build.10gen.cc
|
109
|
+
hosts - ['test1.test.build.10gen.cc:27018'] + ['test1.test.build.10gen.cc:27019']
|
91
110
|
end
|
92
111
|
|
93
|
-
let(:
|
94
|
-
double('
|
95
|
-
allow(
|
96
|
-
allow(
|
97
|
-
allow(
|
98
|
-
allow(
|
112
|
+
let(:new_result) do
|
113
|
+
double('result').tap do |result|
|
114
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
115
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
116
|
+
allow(result).to receive(:empty?).and_return(false)
|
117
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
99
118
|
end
|
100
119
|
end
|
101
120
|
|
102
121
|
let(:resolver) do
|
103
122
|
double('resolver').tap do |resolver|
|
104
|
-
allow(resolver).to receive(:get_records).and_return(
|
123
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
105
124
|
end
|
106
125
|
end
|
107
126
|
|
@@ -110,23 +129,23 @@ describe Mongo::SRV::Monitor do
|
|
110
129
|
end
|
111
130
|
end
|
112
131
|
|
113
|
-
context 'when all DNS
|
132
|
+
context 'when all DNS result are replaced with a single record' do
|
114
133
|
let(:new_hosts) do
|
115
|
-
['test1.test.build.10gen.cc
|
134
|
+
['test1.test.build.10gen.cc:27019']
|
116
135
|
end
|
117
136
|
|
118
|
-
let(:
|
119
|
-
double('
|
120
|
-
allow(
|
121
|
-
allow(
|
122
|
-
allow(
|
123
|
-
allow(
|
137
|
+
let(:new_result) do
|
138
|
+
double('result').tap do |result|
|
139
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
140
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
141
|
+
allow(result).to receive(:empty?).and_return(false)
|
142
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
124
143
|
end
|
125
144
|
end
|
126
145
|
|
127
146
|
let(:resolver) do
|
128
147
|
double('resolver').tap do |resolver|
|
129
|
-
|
148
|
+
expect(resolver).to receive(:get_records).and_return(new_result)
|
130
149
|
end
|
131
150
|
end
|
132
151
|
|
@@ -135,26 +154,26 @@ describe Mongo::SRV::Monitor do
|
|
135
154
|
end
|
136
155
|
end
|
137
156
|
|
138
|
-
context 'when all DNS
|
157
|
+
context 'when all DNS result are replaced with multiple result' do
|
139
158
|
let(:new_hosts) do
|
140
159
|
[
|
141
|
-
'test1.test.build.10gen.cc
|
142
|
-
'test1.test.build.10gen.cc
|
160
|
+
'test1.test.build.10gen.cc:27019',
|
161
|
+
'test1.test.build.10gen.cc:27020',
|
143
162
|
]
|
144
163
|
end
|
145
164
|
|
146
|
-
let(:
|
147
|
-
double('
|
148
|
-
allow(
|
149
|
-
allow(
|
150
|
-
allow(
|
151
|
-
allow(
|
165
|
+
let(:new_result) do
|
166
|
+
double('result').tap do |result|
|
167
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
168
|
+
allow(result).to receive(:address_strs).and_return(new_hosts)
|
169
|
+
allow(result).to receive(:empty?).and_return(false)
|
170
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
152
171
|
end
|
153
172
|
end
|
154
173
|
|
155
174
|
let(:resolver) do
|
156
175
|
double('resolver').tap do |resolver|
|
157
|
-
allow(resolver).to receive(:get_records).and_return(
|
176
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
158
177
|
end
|
159
178
|
end
|
160
179
|
|
@@ -166,7 +185,7 @@ describe Mongo::SRV::Monitor do
|
|
166
185
|
context 'when the DNS lookup times out' do
|
167
186
|
let(:resolver) do
|
168
187
|
double('resolver').tap do |resolver|
|
169
|
-
|
188
|
+
expect(resolver).to receive(:get_records).and_raise(Resolv::ResolvTimeout)
|
170
189
|
end
|
171
190
|
end
|
172
191
|
|
@@ -187,19 +206,19 @@ describe Mongo::SRV::Monitor do
|
|
187
206
|
end
|
188
207
|
end
|
189
208
|
|
190
|
-
context 'when no DNS
|
191
|
-
let(:
|
192
|
-
double('
|
193
|
-
allow(
|
194
|
-
allow(
|
195
|
-
allow(
|
196
|
-
allow(
|
209
|
+
context 'when no DNS result are returned' do
|
210
|
+
let(:new_result) do
|
211
|
+
double('result').tap do |result|
|
212
|
+
allow(result).to receive(:hostname).and_return(hostname)
|
213
|
+
allow(result).to receive(:address_strs).and_return([])
|
214
|
+
allow(result).to receive(:empty?).and_return(true)
|
215
|
+
allow(result).to receive(:min_ttl).and_return(nil)
|
197
216
|
end
|
198
217
|
end
|
199
218
|
|
200
219
|
let(:resolver) do
|
201
220
|
double('resolver').tap do |resolver|
|
202
|
-
allow(resolver).to receive(:get_records).and_return(
|
221
|
+
allow(resolver).to receive(:get_records).and_return(new_result)
|
203
222
|
end
|
204
223
|
end
|
205
224
|
|
@@ -208,4 +227,4 @@ describe Mongo::SRV::Monitor do
|
|
208
227
|
end
|
209
228
|
end
|
210
229
|
end
|
211
|
-
end
|
230
|
+
end
|
@@ -30,14 +30,12 @@ def define_transactions_spec_tests(test_paths)
|
|
30
30
|
spec.tests.each do |test|
|
31
31
|
|
32
32
|
before do
|
33
|
-
if
|
34
|
-
if
|
33
|
+
if ClusterConfig.instance.topology == :sharded
|
34
|
+
if test.multiple_mongoses? && SpecConfig.instance.addresses.length == 1
|
35
35
|
skip "Test requires multiple mongoses"
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
# sharded transactions fail when run against a multi-mongos cluster
|
40
|
-
if SpecConfig.instance.addresses.length > 1
|
36
|
+
elsif !test.multiple_mongoses? && SpecConfig.instance.addresses.length > 1
|
37
|
+
# Many transaction spec tests that do not specifically deal with
|
38
|
+
# sharded transactions fail when run against a multi-mongos cluster
|
41
39
|
skip "Test does not specify multiple mongoses"
|
42
40
|
end
|
43
41
|
end
|
@@ -4,10 +4,5 @@ describe 'Client-Side Encryption' do
|
|
4
4
|
require_libmongocrypt
|
5
5
|
require_enterprise
|
6
6
|
|
7
|
-
before do
|
8
|
-
unless ClusterConfig.instance.single_server?
|
9
|
-
skip "SPEC-2147: tests only work on single server"
|
10
|
-
end
|
11
|
-
end
|
12
7
|
define_transactions_spec_tests(CLIENT_SIDE_ENCRYPTION_TESTS)
|
13
8
|
end
|
@@ -68,6 +68,9 @@ tests:
|
|
68
68
|
updates:
|
69
69
|
- q: { encrypted_string: { $eq: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==', 'subType': '06'}} }}
|
70
70
|
u: {$set: { encrypted_string: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==', 'subType': '06'}} }}
|
71
|
+
# DRIVERS-976: mongocryptd adds upsert and multi fields to all update commands, so these fields should be added to spec tests
|
72
|
+
upsert: false
|
73
|
+
multi: false
|
71
74
|
ordered: true
|
72
75
|
command_name: update
|
73
76
|
- command_started_event:
|
@@ -52,10 +52,13 @@ tests:
|
|
52
52
|
updates:
|
53
53
|
- q: { encrypted_string: { $eq: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==', 'subType': '06'}} } }
|
54
54
|
u: { encrypted_string: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==', 'subType': '06'}}, random: { $$type: "binData" } }
|
55
|
+
# DRIVERS-976: mongocryptd adds upsert and multi fields to all update commands, so these fields should be added to spec tests
|
56
|
+
upsert: false
|
57
|
+
multi: false
|
55
58
|
ordered: true
|
56
59
|
command_name: update
|
57
60
|
outcome:
|
58
61
|
collection:
|
59
62
|
# Outcome is checked using a separate MongoClient without auto encryption.
|
60
63
|
data:
|
61
|
-
- { _id: 1, encrypted_string: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==', 'subType': '06'}}, random: { $$type: "binData" } }
|
64
|
+
- { _id: 1, encrypted_string: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==', 'subType': '06'}}, random: { $$type: "binData" } }
|
@@ -52,6 +52,9 @@ tests:
|
|
52
52
|
updates:
|
53
53
|
- q: { encrypted_string: { $eq: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==', 'subType': '06'}} } }
|
54
54
|
u: { $set: {encrypted_string: {'$binary': {'base64': 'AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==', 'subType': '06'}}, random: { $$type: "binData" } } }
|
55
|
+
# DRIVERS-976: mongocryptd adds upsert and multi fields to all update commands, so these fields should be added to spec tests
|
56
|
+
upsert: false
|
57
|
+
multi: false
|
55
58
|
ordered: true
|
56
59
|
command_name: update
|
57
60
|
outcome:
|
@@ -304,7 +304,12 @@ class ClusterTools
|
|
304
304
|
def set_rs_config(config)
|
305
305
|
config = config.dup
|
306
306
|
config['version'] += 1
|
307
|
-
|
307
|
+
cmd = {replSetReconfig: config}
|
308
|
+
if ClusterConfig.instance.fcv_ish >= '4.4'
|
309
|
+
# Workaround for https://jira.mongodb.org/browse/SERVER-46894
|
310
|
+
cmd[:force] = true
|
311
|
+
end
|
312
|
+
result = admin_client.database.command(cmd)
|
308
313
|
doc = result.reply.documents.first
|
309
314
|
if doc['ok'] != 1
|
310
315
|
raise 'Failed to reconfigure RS'
|
data/spec/support/crypt.rb
CHANGED
@@ -52,6 +52,20 @@ module Crypt
|
|
52
52
|
|
53
53
|
# Example value to encrypt
|
54
54
|
let(:ssn) { '123-456-7890' }
|
55
|
+
|
56
|
+
let(:key_vault_collection) do
|
57
|
+
authorized_client.with(
|
58
|
+
database: key_vault_db,
|
59
|
+
write_concern: { w: :majority }
|
60
|
+
)[key_vault_coll]
|
61
|
+
end
|
62
|
+
|
63
|
+
let(:extra_options) do
|
64
|
+
{
|
65
|
+
mongocryptd_spawn_args: ["--port=#{SpecConfig.instance.mongocryptd_port}"],
|
66
|
+
mongocryptd_uri: "mongodb://localhost:#{SpecConfig.instance.mongocryptd_port}",
|
67
|
+
}
|
68
|
+
end
|
55
69
|
end
|
56
70
|
|
57
71
|
# For tests that require local KMS to be configured
|
@@ -47,7 +47,9 @@ module LiteConstraints
|
|
47
47
|
|
48
48
|
def require_mongo_kerberos
|
49
49
|
before(:all) do
|
50
|
-
|
50
|
+
unless %w(1 yes true).include?(ENV['MONGO_RUBY_DRIVER_KERBEROS']&.downcase)
|
51
|
+
skip 'Set MONGO_RUBY_DRIVER_KERBEROS=1 in environment to run Kerberos unit tests'
|
52
|
+
end
|
51
53
|
require 'mongo_kerberos'
|
52
54
|
end
|
53
55
|
end
|
data/spec/support/spec_config.rb
CHANGED
@@ -328,6 +328,16 @@ EOT
|
|
328
328
|
ENV['MONGO_RUBY_DRIVER_AWS_ARN']
|
329
329
|
end
|
330
330
|
|
331
|
+
def mongocryptd_port
|
332
|
+
if ENV['MONGO_RUBY_DRIVER_MONGOCRYPTD_PORT'] &&
|
333
|
+
!ENV['MONGO_RUBY_DRIVER_MONGOCRYPTD_PORT'].empty?
|
334
|
+
then
|
335
|
+
ENV['MONGO_RUBY_DRIVER_MONGOCRYPTD_PORT'].to_i
|
336
|
+
else
|
337
|
+
27020
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
331
341
|
# Option hashes
|
332
342
|
|
333
343
|
def auth_options
|
data/spec/support/utils.rb
CHANGED
@@ -89,6 +89,13 @@ module Utils
|
|
89
89
|
if name == 'autoEncryptOpts'
|
90
90
|
opts.merge!(
|
91
91
|
auto_encryption_options: convert_auto_encryption_client_options(value)
|
92
|
+
.merge(
|
93
|
+
# Spawn mongocryptd on non-default port for sharded cluster tests
|
94
|
+
extra_options: {
|
95
|
+
mongocryptd_spawn_args: ["--port=#{SpecConfig.instance.mongocryptd_port}"],
|
96
|
+
mongocryptd_uri: "mongodb://localhost:#{SpecConfig.instance.mongocryptd_port}",
|
97
|
+
}
|
98
|
+
)
|
92
99
|
)
|
93
100
|
else
|
94
101
|
uri.send(:add_uri_option, name, value.to_s, opts)
|
@@ -329,7 +336,8 @@ module Utils
|
|
329
336
|
|
330
337
|
actual.is_a?(expected_class) || actual.key?(expected_key)
|
331
338
|
elsif expected.is_a?(Hash) && actual.is_a?(Hash)
|
332
|
-
same_keys = (expected.keys - actual.keys).empty?
|
339
|
+
same_keys = (expected.keys - actual.keys).empty? &&
|
340
|
+
(actual.keys - expected.keys).empty?
|
333
341
|
|
334
342
|
same_values = expected.keys.all? do |key|
|
335
343
|
match_with_type?(expected[key], actual[key])
|
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.12.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
gpvfPNWMwyBDlHaNS3GfO6cRRxBOvEG05GUCsvtTY4Bpe8yjE64wg1ymb47LMOnv
|
32
32
|
Qb1lGORmf/opg45mluKUYl7pQNZHD0d3
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2020-
|
34
|
+
date: 2020-04-22 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bson
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 5.0.0
|
56
56
|
description: A Ruby driver for MongoDB
|
57
|
-
email:
|
57
|
+
email:
|
58
58
|
executables:
|
59
59
|
- mongo_console
|
60
60
|
extensions: []
|
@@ -107,7 +107,6 @@ files:
|
|
107
107
|
- lib/mongo/cluster/reapers/cursor_reaper.rb
|
108
108
|
- lib/mongo/cluster/reapers/socket_reaper.rb
|
109
109
|
- lib/mongo/cluster/sdam_flow.rb
|
110
|
-
- lib/mongo/cluster/srv_monitor.rb
|
111
110
|
- lib/mongo/cluster/topology.rb
|
112
111
|
- lib/mongo/cluster/topology/base.rb
|
113
112
|
- lib/mongo/cluster/topology/no_replica_set_options.rb
|
@@ -457,7 +456,6 @@ files:
|
|
457
456
|
- lib/mongo/srv/monitor.rb
|
458
457
|
- lib/mongo/srv/resolver.rb
|
459
458
|
- lib/mongo/srv/result.rb
|
460
|
-
- lib/mongo/srv/warning_result.rb
|
461
459
|
- lib/mongo/timeout.rb
|
462
460
|
- lib/mongo/uri.rb
|
463
461
|
- lib/mongo/uri/srv_protocol.rb
|
@@ -471,7 +469,6 @@ files:
|
|
471
469
|
- spec/USERS.md
|
472
470
|
- spec/atlas/atlas_connectivity_spec.rb
|
473
471
|
- spec/atlas/operations_spec.rb
|
474
|
-
- spec/enterprise_auth/kerberos_spec.rb
|
475
472
|
- spec/integration/auth_spec.rb
|
476
473
|
- spec/integration/bson_symbol_spec.rb
|
477
474
|
- spec/integration/bulk_insert_spec.rb
|
@@ -530,6 +527,7 @@ files:
|
|
530
527
|
- spec/integration/step_down_spec.rb
|
531
528
|
- spec/integration/time_zone_querying_spec.rb
|
532
529
|
- spec/integration/transactions_examples_spec.rb
|
530
|
+
- spec/kerberos/kerberos_spec.rb
|
533
531
|
- spec/lite_spec_helper.rb
|
534
532
|
- spec/mongo/address/ipv4_spec.rb
|
535
533
|
- spec/mongo/address/ipv6_spec.rb
|
@@ -561,7 +559,6 @@ files:
|
|
561
559
|
- spec/mongo/cluster/cursor_reaper_spec.rb
|
562
560
|
- spec/mongo/cluster/periodic_executor_spec.rb
|
563
561
|
- spec/mongo/cluster/socket_reaper_spec.rb
|
564
|
-
- spec/mongo/cluster/srv_monitor_spec.rb
|
565
562
|
- spec/mongo/cluster/topology/replica_set_spec.rb
|
566
563
|
- spec/mongo/cluster/topology/sharded_spec.rb
|
567
564
|
- spec/mongo/cluster/topology/single_spec.rb
|
@@ -606,9 +603,11 @@ files:
|
|
606
603
|
- spec/mongo/cursor_spec.rb
|
607
604
|
- spec/mongo/database_spec.rb
|
608
605
|
- spec/mongo/dbref_spec.rb
|
606
|
+
- spec/mongo/error/bulk_write_error_spec.rb
|
609
607
|
- spec/mongo/error/crypt_error_spec.rb
|
610
608
|
- spec/mongo/error/max_bson_size_spec.rb
|
611
609
|
- spec/mongo/error/no_server_available_spec.rb
|
610
|
+
- spec/mongo/error/notable_spec.rb
|
612
611
|
- spec/mongo/error/operation_failure_spec.rb
|
613
612
|
- spec/mongo/error/parser_spec.rb
|
614
613
|
- spec/mongo/event/publisher_spec.rb
|
@@ -670,7 +669,8 @@ files:
|
|
670
669
|
- spec/mongo/operation/kill_cursors_spec.rb
|
671
670
|
- spec/mongo/operation/limited_spec.rb
|
672
671
|
- spec/mongo/operation/map_reduce_spec.rb
|
673
|
-
- spec/mongo/operation/
|
672
|
+
- spec/mongo/operation/read_preference_legacy_spec.rb
|
673
|
+
- spec/mongo/operation/read_preference_op_msg_spec.rb
|
674
674
|
- spec/mongo/operation/remove_user_spec.rb
|
675
675
|
- spec/mongo/operation/result_spec.rb
|
676
676
|
- spec/mongo/operation/specifiable_spec.rb
|
@@ -1273,7 +1273,6 @@ metadata:
|
|
1273
1273
|
changelog_uri: https://github.com/mongodb/mongo-ruby-driver/releases
|
1274
1274
|
documentation_uri: https://docs.mongodb.com/ruby-driver/
|
1275
1275
|
homepage_uri: https://docs.mongodb.com/ruby-driver/
|
1276
|
-
mailing_list_uri: https://groups.google.com/group/mongodb-user
|
1277
1276
|
source_code_uri: https://github.com/mongodb/mongo-ruby-driver
|
1278
1277
|
post_install_message:
|
1279
1278
|
rdoc_options: []
|
@@ -1286,15 +1285,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1286
1285
|
version: '2.3'
|
1287
1286
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1288
1287
|
requirements:
|
1289
|
-
- - "
|
1288
|
+
- - ">="
|
1290
1289
|
- !ruby/object:Gem::Version
|
1291
|
-
version:
|
1290
|
+
version: '0'
|
1292
1291
|
requirements: []
|
1293
1292
|
rubygems_version: 3.1.2
|
1294
1293
|
signing_key:
|
1295
1294
|
specification_version: 4
|
1296
1295
|
summary: Ruby driver for MongoDB
|
1297
1296
|
test_files:
|
1297
|
+
- spec/kerberos/kerberos_spec.rb
|
1298
1298
|
- spec/spec_helper.rb
|
1299
1299
|
- spec/integration/read_preference_spec.rb
|
1300
1300
|
- spec/integration/sdam_events_spec.rb
|
@@ -1356,7 +1356,6 @@ test_files:
|
|
1356
1356
|
- spec/integration/server_selector_spec.rb
|
1357
1357
|
- spec/lite_spec_helper.rb
|
1358
1358
|
- spec/README.md
|
1359
|
-
- spec/enterprise_auth/kerberos_spec.rb
|
1360
1359
|
- spec/USERS.md
|
1361
1360
|
- spec/support/client_registry_macros.rb
|
1362
1361
|
- spec/support/common_shortcuts.rb
|
@@ -1422,7 +1421,6 @@ test_files:
|
|
1422
1421
|
- spec/support/event_subscriber.rb
|
1423
1422
|
- spec/support/crypt.rb
|
1424
1423
|
- spec/support/cluster_config.rb
|
1425
|
-
- spec/mongo/operation/read_preference_spec.rb
|
1426
1424
|
- spec/mongo/operation/collections_info_spec.rb
|
1427
1425
|
- spec/mongo/operation/delete_spec.rb
|
1428
1426
|
- spec/mongo/operation/drop_index_spec.rb
|
@@ -1441,9 +1439,11 @@ test_files:
|
|
1441
1439
|
- spec/mongo/operation/create_index_spec.rb
|
1442
1440
|
- spec/mongo/operation/update_spec.rb
|
1443
1441
|
- spec/mongo/operation/remove_user_spec.rb
|
1442
|
+
- spec/mongo/operation/read_preference_legacy_spec.rb
|
1444
1443
|
- spec/mongo/operation/specifiable_spec.rb
|
1445
1444
|
- spec/mongo/operation/result_spec.rb
|
1446
1445
|
- spec/mongo/operation/command_spec.rb
|
1446
|
+
- spec/mongo/operation/read_preference_op_msg_spec.rb
|
1447
1447
|
- spec/mongo/operation/get_more_spec.rb
|
1448
1448
|
- spec/mongo/operation/insert_spec.rb
|
1449
1449
|
- spec/mongo/operation/limited_spec.rb
|
@@ -1464,7 +1464,6 @@ test_files:
|
|
1464
1464
|
- spec/mongo/cluster/topology/unknown_spec.rb
|
1465
1465
|
- spec/mongo/cluster/cursor_reaper_spec.rb
|
1466
1466
|
- spec/mongo/cluster/periodic_executor_spec.rb
|
1467
|
-
- spec/mongo/cluster/srv_monitor_spec.rb
|
1468
1467
|
- spec/mongo/cluster/topology_spec.rb
|
1469
1468
|
- spec/mongo/cluster/socket_reaper_spec.rb
|
1470
1469
|
- spec/mongo/server_selector/primary_preferred_spec.rb
|
@@ -1593,6 +1592,8 @@ test_files:
|
|
1593
1592
|
- spec/mongo/monitoring/event/topology_closed_spec.rb
|
1594
1593
|
- spec/mongo/uri/srv_protocol_spec.rb
|
1595
1594
|
- spec/mongo/error/no_server_available_spec.rb
|
1595
|
+
- spec/mongo/error/bulk_write_error_spec.rb
|
1596
|
+
- spec/mongo/error/notable_spec.rb
|
1596
1597
|
- spec/mongo/error/parser_spec.rb
|
1597
1598
|
- spec/mongo/error/max_bson_size_spec.rb
|
1598
1599
|
- spec/mongo/error/crypt_error_spec.rb
|