mongo 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mongo/address.rb +1 -1
- data/lib/mongo/address/ipv4.rb +8 -4
- data/lib/mongo/address/ipv6.rb +8 -4
- data/lib/mongo/address/unix.rb +2 -2
- data/lib/mongo/auth/user/view.rb +5 -1
- data/lib/mongo/bulk_write/bulk_writable.rb +5 -0
- data/lib/mongo/bulk_write/deletable.rb +0 -4
- data/lib/mongo/bulk_write/insertable.rb +0 -4
- data/lib/mongo/client.rb +30 -2
- data/lib/mongo/collection/view/aggregation.rb +17 -4
- data/lib/mongo/collection/view/map_reduce.rb +19 -2
- data/lib/mongo/database.rb +12 -0
- data/lib/mongo/database/view.rb +12 -0
- data/lib/mongo/grid/fs.rb +5 -5
- data/lib/mongo/loggable.rb +5 -3
- data/lib/mongo/logger.rb +21 -5
- data/lib/mongo/operation/aggregate.rb +18 -11
- data/lib/mongo/operation/aggregate/result.rb +16 -1
- data/lib/mongo/operation/map_reduce.rb +7 -9
- data/lib/mongo/operation/read/query.rb +1 -1
- data/lib/mongo/operation/read_preferrable.rb +11 -5
- data/lib/mongo/operation/result.rb +5 -1
- data/lib/mongo/operation/write.rb +1 -0
- data/lib/mongo/operation/write/command.rb +1 -0
- data/lib/mongo/operation/write/command/update_user.rb +43 -0
- data/lib/mongo/operation/write/update_user.rb +75 -0
- data/lib/mongo/protocol/reply.rb +12 -0
- data/lib/mongo/server/connection_pool/queue.rb +3 -3
- data/lib/mongo/socket.rb +22 -11
- data/lib/mongo/socket/ssl.rb +6 -3
- data/lib/mongo/version.rb +1 -1
- data/spec/mongo/auth/user/view_spec.rb +42 -0
- data/spec/mongo/client_spec.rb +19 -0
- data/spec/mongo/cluster_spec.rb +2 -1
- data/spec/mongo/collection/view/aggregation_spec.rb +34 -1
- data/spec/mongo/collection/view/map_reduce_spec.rb +92 -0
- data/spec/mongo/collection/view_spec.rb +14 -11
- data/spec/mongo/collection_spec.rb +13 -0
- data/spec/mongo/database_spec.rb +29 -0
- data/spec/mongo/grid/fs_spec.rb +32 -1
- data/spec/mongo/loggable_spec.rb +2 -1
- data/spec/mongo/operation/read/query_spec.rb +19 -0
- data/spec/mongo/operation/read_preferrable_spec.rb +192 -0
- data/spec/mongo/operation/write/update_user_spec.rb +46 -0
- data/spec/mongo/server/connection_pool/queue_spec.rb +4 -0
- data/spec/mongo/socket/ssl_spec.rb +21 -1
- data/spec/spec_helper.rb +4 -0
- data/spec/support/authorization.rb +6 -4
- data/spec/support/shared/operation.rb +12 -0
- metadata +9 -3
- metadata.gz.sig +0 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mongo::Operation::Write::UpdateUser do
|
4
|
+
|
5
|
+
describe '#execute' do
|
6
|
+
|
7
|
+
let(:user) do
|
8
|
+
Mongo::Auth::User.new(
|
9
|
+
user: 'durran',
|
10
|
+
password: 'password',
|
11
|
+
roles: [ Mongo::Auth::Roles::READ_WRITE ]
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:user_updated) do
|
16
|
+
Mongo::Auth::User.new(
|
17
|
+
user: 'durran',
|
18
|
+
password: '123',
|
19
|
+
roles: [ Mongo::Auth::Roles::READ ]
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:operation) do
|
24
|
+
described_class.new(user: user_updated, db_name: TEST_DB)
|
25
|
+
end
|
26
|
+
|
27
|
+
before do
|
28
|
+
root_authorized_client.database.users.create(user)
|
29
|
+
end
|
30
|
+
|
31
|
+
after do
|
32
|
+
root_authorized_client.database.users.remove('durran')
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when user update was successful' do
|
36
|
+
|
37
|
+
let!(:response) do
|
38
|
+
operation.execute(root_authorized_primary.context)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'updates the user in the database' do
|
42
|
+
expect(response).to be_successful
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -77,6 +77,10 @@ describe Mongo::Server::ConnectionPool::Queue do
|
|
77
77
|
it 'creates the queue with the minimum connections' do
|
78
78
|
expect(queue.size).to eq(2)
|
79
79
|
end
|
80
|
+
|
81
|
+
it 'does not use the same objects in the queue' do
|
82
|
+
expect(queue.dequeue).to_not equal(queue.dequeue)
|
83
|
+
end
|
80
84
|
end
|
81
85
|
|
82
86
|
context 'when no min size is provided' do
|
@@ -5,7 +5,7 @@ describe Mongo::Socket::SSL do
|
|
5
5
|
describe '#connect!', if: running_ssl? do
|
6
6
|
|
7
7
|
let(:socket) do
|
8
|
-
described_class.new(*DEFAULT_ADDRESS.split(":"), 5, Socket::PF_INET, options)
|
8
|
+
described_class.new(*DEFAULT_ADDRESS.split(":"), DEFAULT_ADDRESS.split(":")[0], 5, Socket::PF_INET, options)
|
9
9
|
end
|
10
10
|
|
11
11
|
context 'when a certificate is provided' do
|
@@ -43,5 +43,25 @@ describe Mongo::Socket::SSL do
|
|
43
43
|
}.to raise_error
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
context 'when a CA certificate is provided', if: running_ssl? && testing_locally? do
|
48
|
+
|
49
|
+
let(:options) do
|
50
|
+
{
|
51
|
+
:ssl => true,
|
52
|
+
:ssl_cert => CLIENT_PEM,
|
53
|
+
:ssl_key => CLIENT_PEM,
|
54
|
+
:ssl_ca_cert => CA_PEM
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
before do
|
59
|
+
socket.connect!
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'connects to the server' do
|
63
|
+
expect(socket).to be_alive
|
64
|
+
end
|
65
|
+
end
|
46
66
|
end
|
47
67
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -146,6 +146,10 @@ def list_command_enabled?
|
|
146
146
|
$list_command_enabled ||= $mongo_client.cluster.servers.first.features.list_indexes_enabled?
|
147
147
|
end
|
148
148
|
|
149
|
+
def testing_locally?
|
150
|
+
!(ENV['CI'] || ENV['JENKINS_HOME'])
|
151
|
+
end
|
152
|
+
|
149
153
|
def running_ssl?
|
150
154
|
SSL
|
151
155
|
end
|
@@ -53,7 +53,8 @@ SSL = ENV['SSL_ENABLED'] == 'true'
|
|
53
53
|
# Options for test suite clients.
|
54
54
|
#
|
55
55
|
# @since 2.0.3
|
56
|
-
TEST_OPTIONS = {
|
56
|
+
TEST_OPTIONS = { connect: CONNECT,
|
57
|
+
max_pool_size: 1,
|
57
58
|
write: WRITE_CONCERN,
|
58
59
|
ssl: SSL }
|
59
60
|
|
@@ -77,7 +78,8 @@ ROOT_USER = Mongo::Auth::User.new(
|
|
77
78
|
Mongo::Auth::Roles::USER_ADMIN_ANY_DATABASE,
|
78
79
|
Mongo::Auth::Roles::DATABASE_ADMIN_ANY_DATABASE,
|
79
80
|
Mongo::Auth::Roles::READ_WRITE_ANY_DATABASE,
|
80
|
-
Mongo::Auth::Roles::HOST_MANAGER
|
81
|
+
Mongo::Auth::Roles::HOST_MANAGER,
|
82
|
+
Mongo::Auth::Roles::CLUSTER_ADMIN
|
81
83
|
]
|
82
84
|
)
|
83
85
|
|
@@ -105,8 +107,8 @@ TEST_USER = Mongo::Auth::User.new(
|
|
105
107
|
# @since 2.0.
|
106
108
|
TEST_READ_WRITE_USER = Mongo::Auth::User.new(
|
107
109
|
database: TEST_DB,
|
108
|
-
user:
|
109
|
-
password:
|
110
|
+
user: TEST_USER.name,
|
111
|
+
password: TEST_USER.password,
|
110
112
|
roles: [ Mongo::Auth::Roles::READ_WRITE, Mongo::Auth::Roles::DATABASE_ADMIN ]
|
111
113
|
)
|
112
114
|
|
@@ -58,6 +58,18 @@ shared_context 'operation' do
|
|
58
58
|
allow(cxt).to receive(:slave_ok?) { false }
|
59
59
|
end
|
60
60
|
end
|
61
|
+
let(:secondary_context_slave) do
|
62
|
+
double('secondary_context').tap do |cxt|
|
63
|
+
allow(cxt).to receive(:with_connection).and_yield(connection)
|
64
|
+
allow(cxt).to receive(:server) { secondary_server }
|
65
|
+
allow(cxt).to receive(:mongos?) { false }
|
66
|
+
allow(cxt).to receive(:features) { features_2_6 }
|
67
|
+
allow(cxt).to receive(:secondary?) { true }
|
68
|
+
allow(cxt).to receive(:primary?) { false }
|
69
|
+
allow(cxt).to receive(:standalone?) { false }
|
70
|
+
allow(cxt).to receive(:slave_ok?) { true }
|
71
|
+
end
|
72
|
+
end
|
61
73
|
let(:primary_context_2_4_version) do
|
62
74
|
double('primary_context').tap do |cxt|
|
63
75
|
allow(cxt).to receive(:with_connection).and_yield(connection)
|
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.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
32
32
|
o2UXDbWtz5PqoFd8EgNJAn3+BG1pwC9S9pVFG3WPucfAx/bE8iq/vvchHei5Y/Vo
|
33
33
|
aAz5f/hY4zFeYWvGDBHYEXE1rTN2hhMSyJscPcFbmz0=
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date: 2015-
|
35
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bson
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- lib/mongo/operation/write/command/insert.rb
|
184
184
|
- lib/mongo/operation/write/command/remove_user.rb
|
185
185
|
- lib/mongo/operation/write/command/update.rb
|
186
|
+
- lib/mongo/operation/write/command/update_user.rb
|
186
187
|
- lib/mongo/operation/write/command/writable.rb
|
187
188
|
- lib/mongo/operation/write/create_index.rb
|
188
189
|
- lib/mongo/operation/write/create_user.rb
|
@@ -195,6 +196,7 @@ files:
|
|
195
196
|
- lib/mongo/operation/write/remove_user.rb
|
196
197
|
- lib/mongo/operation/write/update.rb
|
197
198
|
- lib/mongo/operation/write/update/result.rb
|
199
|
+
- lib/mongo/operation/write/update_user.rb
|
198
200
|
- lib/mongo/options.rb
|
199
201
|
- lib/mongo/options/mapper.rb
|
200
202
|
- lib/mongo/protocol.rb
|
@@ -289,6 +291,7 @@ files:
|
|
289
291
|
- spec/mongo/operation/read/get_more_spec.rb
|
290
292
|
- spec/mongo/operation/read/indexes_spec.rb
|
291
293
|
- spec/mongo/operation/read/query_spec.rb
|
294
|
+
- spec/mongo/operation/read_preferrable_spec.rb
|
292
295
|
- spec/mongo/operation/result_spec.rb
|
293
296
|
- spec/mongo/operation/specifiable_spec.rb
|
294
297
|
- spec/mongo/operation/write/bulk/bulk_delete_spec.rb
|
@@ -305,6 +308,7 @@ files:
|
|
305
308
|
- spec/mongo/operation/write/remove_user_spec.rb
|
306
309
|
- spec/mongo/operation/write/response_spec.rb
|
307
310
|
- spec/mongo/operation/write/update_spec.rb
|
311
|
+
- spec/mongo/operation/write/update_user_spec.rb
|
308
312
|
- spec/mongo/protocol/delete_spec.rb
|
309
313
|
- spec/mongo/protocol/get_more_spec.rb
|
310
314
|
- spec/mongo/protocol/insert_spec.rb
|
@@ -457,7 +461,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
457
461
|
version: '0'
|
458
462
|
requirements: []
|
459
463
|
rubyforge_project: mongo
|
460
|
-
rubygems_version: 2.4.
|
464
|
+
rubygems_version: 2.4.7
|
461
465
|
signing_key:
|
462
466
|
specification_version: 4
|
463
467
|
summary: Ruby driver for MongoDB
|
@@ -511,6 +515,7 @@ test_files:
|
|
511
515
|
- spec/mongo/operation/read/get_more_spec.rb
|
512
516
|
- spec/mongo/operation/read/indexes_spec.rb
|
513
517
|
- spec/mongo/operation/read/query_spec.rb
|
518
|
+
- spec/mongo/operation/read_preferrable_spec.rb
|
514
519
|
- spec/mongo/operation/result_spec.rb
|
515
520
|
- spec/mongo/operation/specifiable_spec.rb
|
516
521
|
- spec/mongo/operation/write/bulk/bulk_delete_spec.rb
|
@@ -527,6 +532,7 @@ test_files:
|
|
527
532
|
- spec/mongo/operation/write/remove_user_spec.rb
|
528
533
|
- spec/mongo/operation/write/response_spec.rb
|
529
534
|
- spec/mongo/operation/write/update_spec.rb
|
535
|
+
- spec/mongo/operation/write/update_user_spec.rb
|
530
536
|
- spec/mongo/protocol/delete_spec.rb
|
531
537
|
- spec/mongo/protocol/get_more_spec.rb
|
532
538
|
- spec/mongo/protocol/insert_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|