mongo 2.0.2 → 2.0.3
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 +70 -11
- data/lib/mongo/address/ipv4.rb +23 -22
- data/lib/mongo/address/ipv6.rb +23 -22
- data/lib/mongo/address/unix.rb +18 -18
- data/lib/mongo/auth.rb +0 -1
- data/lib/mongo/auth/cr.rb +21 -2
- data/lib/mongo/auth/cr/conversation.rb +7 -4
- data/lib/mongo/auth/ldap.rb +14 -1
- data/lib/mongo/auth/scram.rb +15 -1
- data/lib/mongo/auth/scram/conversation.rb +3 -3
- data/lib/mongo/auth/user.rb +1 -1
- data/lib/mongo/auth/x509.rb +15 -1
- data/lib/mongo/cluster.rb +22 -8
- data/lib/mongo/cluster/topology.rb +7 -6
- data/lib/mongo/cluster/topology/replica_set.rb +5 -5
- data/lib/mongo/cluster/topology/sharded.rb +5 -5
- data/lib/mongo/cluster/topology/{standalone.rb → single.rb} +26 -22
- data/lib/mongo/cluster/topology/unknown.rb +6 -5
- data/lib/mongo/collection.rb +6 -1
- data/lib/mongo/collection/view.rb +1 -0
- data/lib/mongo/collection/view/readable.rb +5 -0
- data/lib/mongo/error.rb +4 -0
- data/lib/mongo/error/invalid_document.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +36 -0
- data/lib/mongo/error/invalid_uri.rb +37 -0
- data/lib/mongo/error/invalid_uri_option.rb +38 -0
- data/lib/mongo/error/no_server_available.rb +37 -0
- data/lib/mongo/operation/read_preferrable.rb +20 -4
- data/lib/mongo/protocol/query.rb +14 -1
- data/lib/mongo/server.rb +12 -0
- data/lib/mongo/server/connectable.rb +5 -1
- data/lib/mongo/server/connection.rb +1 -1
- data/lib/mongo/server/context.rb +2 -1
- data/lib/mongo/server_selector.rb +0 -19
- data/lib/mongo/server_selector/selectable.rb +4 -22
- data/lib/mongo/uri.rb +9 -55
- data/lib/mongo/version.rb +1 -1
- data/spec/mongo/address/ipv4_spec.rb +27 -6
- data/spec/mongo/address/ipv6_spec.rb +27 -6
- data/spec/mongo/address/unix_spec.rb +15 -4
- data/spec/mongo/auth/cr_spec.rb +2 -2
- data/spec/mongo/auth/ldap_spec.rb +2 -2
- data/spec/mongo/auth/scram_spec.rb +2 -2
- data/spec/mongo/auth/x509_spec.rb +2 -2
- data/spec/mongo/client_spec.rb +8 -0
- data/spec/mongo/cluster/topology/replica_set_spec.rb +6 -6
- data/spec/mongo/cluster/topology/sharded_spec.rb +5 -5
- data/spec/mongo/cluster/topology/{standalone_spec.rb → single_spec.rb} +7 -7
- data/spec/mongo/cluster/topology_spec.rb +31 -5
- data/spec/mongo/cluster_spec.rb +103 -21
- data/spec/mongo/collection/view/readable_spec.rb +18 -7
- data/spec/mongo/collection/view_spec.rb +13 -0
- data/spec/mongo/collection_spec.rb +7 -0
- data/spec/mongo/database_spec.rb +2 -2
- data/spec/mongo/protocol/query_spec.rb +29 -0
- data/spec/mongo/server/connection_pool_spec.rb +4 -4
- data/spec/mongo/server/connection_spec.rb +46 -10
- data/spec/mongo/server/monitor_spec.rb +2 -2
- data/spec/mongo/server_discovery_and_monitoring_spec.rb +23 -0
- data/spec/mongo/server_selection_rtt_spec.rb +2 -1
- data/spec/mongo/server_selection_spec.rb +6 -15
- data/spec/mongo/server_selector/nearest_spec.rb +1 -1
- data/spec/mongo/server_selector_spec.rb +53 -2
- data/spec/mongo/server_spec.rb +9 -9
- data/spec/mongo/socket/ssl_spec.rb +1 -1
- data/spec/mongo/uri_spec.rb +2 -2
- data/spec/spec_helper.rb +34 -5
- data/spec/support/authorization.rb +32 -46
- data/spec/support/server_discovery_and_monitoring.rb +1 -1
- data/spec/support/server_selection.rb +1 -25
- data/spec/support/shared/operation.rb +3 -0
- data/spec/support/shared/server_selector.rb +1 -1
- metadata +10 -7
- metadata.gz.sig +0 -0
- data/lib/mongo/auth/executable.rb +0 -52
data/spec/mongo/server_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe Mongo::Server do
|
|
13
13
|
describe '#==' do
|
14
14
|
|
15
15
|
let(:server) do
|
16
|
-
described_class.new(address, listeners)
|
16
|
+
described_class.new(address, listeners, TEST_OPTIONS)
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'when the other is not a server' do
|
@@ -32,7 +32,7 @@ describe Mongo::Server do
|
|
32
32
|
context 'when the addresses match' do
|
33
33
|
|
34
34
|
let(:other) do
|
35
|
-
described_class.new(address, listeners)
|
35
|
+
described_class.new(address, listeners, TEST_OPTIONS)
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'returns true' do
|
@@ -47,7 +47,7 @@ describe Mongo::Server do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
let(:other) do
|
50
|
-
described_class.new(other_address, listeners)
|
50
|
+
described_class.new(other_address, listeners, TEST_OPTIONS)
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'returns false' do
|
@@ -60,7 +60,7 @@ describe Mongo::Server do
|
|
60
60
|
describe '#context' do
|
61
61
|
|
62
62
|
let(:server) do
|
63
|
-
described_class.new(address, listeners)
|
63
|
+
described_class.new(address, listeners, TEST_OPTIONS)
|
64
64
|
end
|
65
65
|
|
66
66
|
let(:context) do
|
@@ -75,7 +75,7 @@ describe Mongo::Server do
|
|
75
75
|
describe '#disconnect!' do
|
76
76
|
|
77
77
|
let(:server) do
|
78
|
-
described_class.new(address, listeners)
|
78
|
+
described_class.new(address, listeners, TEST_OPTIONS)
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'stops the monitor instance' do
|
@@ -87,7 +87,7 @@ describe Mongo::Server do
|
|
87
87
|
describe '#initialize' do
|
88
88
|
|
89
89
|
let(:server) do
|
90
|
-
described_class.new(address, listeners, :heartbeat_frequency => 5)
|
90
|
+
described_class.new(address, listeners, TEST_OPTIONS.merge(:heartbeat_frequency => 5))
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'sets the address host' do
|
@@ -99,14 +99,14 @@ describe Mongo::Server do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'sets the options' do
|
102
|
-
expect(server.options).to eq(:heartbeat_frequency => 5)
|
102
|
+
expect(server.options).to eq(TEST_OPTIONS.merge(:heartbeat_frequency => 5))
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
describe '#pool' do
|
107
107
|
|
108
108
|
let(:server) do
|
109
|
-
described_class.new(address, listeners)
|
109
|
+
described_class.new(address, listeners, TEST_OPTIONS)
|
110
110
|
end
|
111
111
|
|
112
112
|
let(:pool) do
|
@@ -121,7 +121,7 @@ describe Mongo::Server do
|
|
121
121
|
describe '#scan!' do
|
122
122
|
|
123
123
|
let(:server) do
|
124
|
-
described_class.new(address, listeners)
|
124
|
+
described_class.new(address, listeners, TEST_OPTIONS)
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'forces a scan on the monitor' 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(
|
8
|
+
described_class.new(*DEFAULT_ADDRESS.split(":"), 5, Socket::PF_INET, options)
|
9
9
|
end
|
10
10
|
|
11
11
|
context 'when a certificate is provided' do
|
data/spec/mongo/uri_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Mongo::URI do
|
|
8
8
|
context 'string is not uri' do
|
9
9
|
let(:string) { 'tyler' }
|
10
10
|
it 'raises an error' do
|
11
|
-
expect { uri }.to raise_error(Mongo::
|
11
|
+
expect { uri }.to raise_error(Mongo::Error::InvalidURI)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -510,7 +510,7 @@ describe Mongo::URI do
|
|
510
510
|
it 'raises an exception' do
|
511
511
|
expect {
|
512
512
|
uri.options
|
513
|
-
}.to raise_error(Mongo::
|
513
|
+
}.to raise_error(Mongo::Error::InvalidURIOption)
|
514
514
|
end
|
515
515
|
end
|
516
516
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -48,14 +48,14 @@ RSpec.configure do |config|
|
|
48
48
|
begin
|
49
49
|
# Adds the test user to the test database with permissions on all
|
50
50
|
# databases that will be used in the test suite.
|
51
|
-
|
51
|
+
ADMIN_AUTHORIZED_TEST_CLIENT.database.users.create(TEST_USER)
|
52
52
|
rescue Exception => e
|
53
53
|
unless write_command_enabled?
|
54
54
|
# If we are on versions less than 2.6, we need to create a user for
|
55
55
|
# each database, since the users are not stored in the admin database
|
56
56
|
# but in the system.users collection on the datbases themselves. Also,
|
57
57
|
# roles in versions lower than 2.6 can only be strings, not hashes.
|
58
|
-
begin
|
58
|
+
begin ADMIN_AUTHORIZED_TEST_CLIENT.database.users.create(TEST_READ_WRITE_USER); rescue; end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -80,7 +80,7 @@ CRL_PEM = "#{SSL_CERTS_DIR}/crl.pem"
|
|
80
80
|
# @since 2.0.0
|
81
81
|
def standalone?
|
82
82
|
$mongo_client ||= initialize_scanned_client!
|
83
|
-
$standalone ||= $mongo_client.cluster.standalone?
|
83
|
+
$standalone ||= $mongo_client.cluster.servers.first.standalone?
|
84
84
|
end
|
85
85
|
|
86
86
|
# Determine whether the test clients are connecting to a replica set.
|
@@ -99,6 +99,35 @@ def sharded?
|
|
99
99
|
$sharded ||= $mongo_client.cluster.sharded?
|
100
100
|
end
|
101
101
|
|
102
|
+
# Determine whether the single address provided is a replica set member.
|
103
|
+
# @note To run the specs relying on this to return true,
|
104
|
+
# start a replica set and set the environment variable
|
105
|
+
# MONGODB_ADDRESSES to the address of a single member.
|
106
|
+
#
|
107
|
+
# @since 2.0.0
|
108
|
+
def single_rs_member?
|
109
|
+
$mongo_client ||= initialize_scanned_client!
|
110
|
+
single_seed? && $mongo_client.cluster.servers.first.replica_set_name
|
111
|
+
end
|
112
|
+
|
113
|
+
# Determine whether the single address provided is a mongos.
|
114
|
+
# @note To run the specs relying on this to return true,
|
115
|
+
# start a sharded cluster and set the environment variable
|
116
|
+
# MONGODB_ADDRESSES to the address of a single mongos.
|
117
|
+
#
|
118
|
+
# @since 2.0.0
|
119
|
+
def single_mongos?
|
120
|
+
$mongo_client ||= initialize_scanned_client!
|
121
|
+
single_seed? && $mongo_client.cluster.servers.first.mongos?
|
122
|
+
end
|
123
|
+
|
124
|
+
# Determine whether a single address was provided.
|
125
|
+
#
|
126
|
+
# @since 2.0.0
|
127
|
+
def single_seed?
|
128
|
+
ADDRESSES.size == 1
|
129
|
+
end
|
130
|
+
|
102
131
|
# For instances where behaviour is different on different versions, we need to
|
103
132
|
# determine in the specs if we are 2.6 or higher.
|
104
133
|
#
|
@@ -118,7 +147,7 @@ def list_command_enabled?
|
|
118
147
|
end
|
119
148
|
|
120
149
|
def running_ssl?
|
121
|
-
|
150
|
+
SSL
|
122
151
|
end
|
123
152
|
|
124
153
|
alias :scram_sha_1_enabled? :list_command_enabled?
|
@@ -136,7 +165,7 @@ end
|
|
136
165
|
#
|
137
166
|
# @since 2.0.0
|
138
167
|
def initialize_scanned_client!
|
139
|
-
Mongo::Client.new(ADDRESSES, database: TEST_DB
|
168
|
+
Mongo::Client.new(ADDRESSES, TEST_OPTIONS.merge(database: TEST_DB))
|
140
169
|
end
|
141
170
|
|
142
171
|
# require all shared examples
|
@@ -40,6 +40,23 @@ CONNECT = ENV['RS_ENABLED'] == 'true' ? :replica_set.freeze :
|
|
40
40
|
ENV['SHARDED_ENABLED'] == 'true' ? :sharded.freeze :
|
41
41
|
:direct.freeze
|
42
42
|
|
43
|
+
# The write concern to use in the tests.
|
44
|
+
#
|
45
|
+
# @since 2.0.0
|
46
|
+
WRITE_CONCERN = (CONNECT == :replica_set) ? { w: ADDRESSES.size } : { w: 1 }
|
47
|
+
|
48
|
+
# Whether to use SSL.
|
49
|
+
#
|
50
|
+
# @since 2.0.3
|
51
|
+
SSL = ENV['SSL_ENABLED'] == 'true'
|
52
|
+
|
53
|
+
# Options for test suite clients.
|
54
|
+
#
|
55
|
+
# @since 2.0.3
|
56
|
+
TEST_OPTIONS = { max_pool_size: 1,
|
57
|
+
write: WRITE_CONCERN,
|
58
|
+
ssl: SSL }
|
59
|
+
|
43
60
|
# The root user name.
|
44
61
|
#
|
45
62
|
# @since 2.0.0
|
@@ -54,7 +71,6 @@ ROOT_USER_PWD = ENV['ROOT_USER_PWD'] || 'password'
|
|
54
71
|
#
|
55
72
|
# @since 2.0.0
|
56
73
|
ROOT_USER = Mongo::Auth::User.new(
|
57
|
-
database: Mongo::Database::ADMIN,
|
58
74
|
user: ROOT_USER_NAME,
|
59
75
|
password: ROOT_USER_PWD,
|
60
76
|
roles: [
|
@@ -94,38 +110,16 @@ TEST_READ_WRITE_USER = Mongo::Auth::User.new(
|
|
94
110
|
roles: [ Mongo::Auth::Roles::READ_WRITE, Mongo::Auth::Roles::DATABASE_ADMIN ]
|
95
111
|
)
|
96
112
|
|
97
|
-
# The write concern to use in the tests.
|
98
|
-
#
|
99
|
-
# @since 2.0.0
|
100
|
-
WRITE_CONCERN = (CONNECT == :replica_set) ? { w: ADDRESSES.size } : { w: 1 }
|
101
|
-
|
102
113
|
# Provides an authorized mongo client on the default test database for the
|
103
114
|
# default test user.
|
104
115
|
#
|
105
116
|
# @since 2.0.0
|
106
117
|
AUTHORIZED_CLIENT = Mongo::Client.new(
|
107
118
|
ADDRESSES,
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
write: WRITE_CONCERN,
|
113
|
-
connect: CONNECT
|
114
|
-
)
|
115
|
-
|
116
|
-
# Provides an authorized mongo client on the default test database for the
|
117
|
-
# default root system administrator.
|
118
|
-
#
|
119
|
-
# @since 2.0.0
|
120
|
-
ROOT_AUTHORIZED_CLIENT = Mongo::Client.new(
|
121
|
-
ADDRESSES,
|
122
|
-
auth_source: Mongo::Database::ADMIN,
|
123
|
-
database: TEST_DB,
|
124
|
-
user: ROOT_USER.name,
|
125
|
-
password: ROOT_USER.password,
|
126
|
-
max_pool_size: 1,
|
127
|
-
write: WRITE_CONCERN,
|
128
|
-
connect: CONNECT
|
119
|
+
TEST_OPTIONS.merge(
|
120
|
+
database: TEST_DB,
|
121
|
+
user: TEST_USER.name,
|
122
|
+
password: TEST_USER.password)
|
129
123
|
)
|
130
124
|
|
131
125
|
# Provides an unauthorized mongo client on the default test database.
|
@@ -133,10 +127,8 @@ ROOT_AUTHORIZED_CLIENT = Mongo::Client.new(
|
|
133
127
|
# @since 2.0.0
|
134
128
|
UNAUTHORIZED_CLIENT = Mongo::Client.new(
|
135
129
|
ADDRESSES,
|
136
|
-
|
137
|
-
|
138
|
-
write: WRITE_CONCERN,
|
139
|
-
connect: CONNECT
|
130
|
+
TEST_OPTIONS.merge(
|
131
|
+
database: TEST_DB)
|
140
132
|
)
|
141
133
|
|
142
134
|
# Provides an unauthorized mongo client on the admin database, for use in
|
@@ -145,19 +137,19 @@ UNAUTHORIZED_CLIENT = Mongo::Client.new(
|
|
145
137
|
# @since 2.0.0
|
146
138
|
ADMIN_UNAUTHORIZED_CLIENT = Mongo::Client.new(
|
147
139
|
ADDRESSES,
|
148
|
-
|
149
|
-
|
150
|
-
write: WRITE_CONCERN,
|
151
|
-
connect: CONNECT
|
140
|
+
TEST_OPTIONS.merge(
|
141
|
+
database: Mongo::Database::ADMIN)
|
152
142
|
)
|
153
143
|
|
154
|
-
# Get an authorized client on the
|
144
|
+
# Get an authorized client on the test database logged in as the admin
|
155
145
|
# root user.
|
156
146
|
#
|
157
147
|
# @since 2.0.0
|
158
|
-
|
148
|
+
ADMIN_AUTHORIZED_TEST_CLIENT = ADMIN_UNAUTHORIZED_CLIENT.with(
|
159
149
|
user: ROOT_USER.name,
|
160
|
-
password: ROOT_USER.password
|
150
|
+
password: ROOT_USER.password,
|
151
|
+
database: TEST_DB,
|
152
|
+
auth_source: Mongo::Database::ADMIN
|
161
153
|
)
|
162
154
|
|
163
155
|
module Authorization
|
@@ -185,12 +177,6 @@ module Authorization
|
|
185
177
|
# @since 2.0.0
|
186
178
|
context.let(:authorized_client) { AUTHORIZED_CLIENT }
|
187
179
|
|
188
|
-
# Provides an authorized mongo client on the default test database for the
|
189
|
-
# default root system administrator.
|
190
|
-
#
|
191
|
-
# @since 2.0.0
|
192
|
-
context.let(:root_authorized_client) { ROOT_AUTHORIZED_CLIENT }
|
193
|
-
|
194
180
|
# Provides an unauthorized mongo client on the default test database.
|
195
181
|
#
|
196
182
|
# @since 2.0.0
|
@@ -202,11 +188,11 @@ module Authorization
|
|
202
188
|
# @since 2.0.0
|
203
189
|
context.let!(:admin_unauthorized_client) { ADMIN_UNAUTHORIZED_CLIENT }
|
204
190
|
|
205
|
-
# Get an authorized client on the
|
191
|
+
# Get an authorized client on the test database logged in as the admin
|
206
192
|
# root user.
|
207
193
|
#
|
208
194
|
# @since 2.0.0
|
209
|
-
context.let!(:
|
195
|
+
context.let!(:root_authorized_client) { ADMIN_AUTHORIZED_TEST_CLIENT }
|
210
196
|
|
211
197
|
# Gets the default test collection from the authorized client.
|
212
198
|
#
|
@@ -29,7 +29,7 @@ RSpec::Matchers.define :be_topology do |expected|
|
|
29
29
|
when 'ReplicaSetWithPrimary' then actual.replica_set?
|
30
30
|
when 'ReplicaSetNoPrimary' then actual.replica_set?
|
31
31
|
when 'Sharded' then actual.sharded?
|
32
|
-
when 'Single' then actual.
|
32
|
+
when 'Single' then actual.single?
|
33
33
|
when 'Unknown' then actual.unknown?
|
34
34
|
end
|
35
35
|
end
|
@@ -14,7 +14,7 @@ module Mongo
|
|
14
14
|
'ReplicaSetNoPrimary' => Mongo::Cluster::Topology::ReplicaSet,
|
15
15
|
'ReplicaSetWithPrimary' => Mongo::Cluster::Topology::ReplicaSet,
|
16
16
|
'Sharded' => Mongo::Cluster::Topology::Sharded,
|
17
|
-
'Single' => Mongo::Cluster::Topology::
|
17
|
+
'Single' => Mongo::Cluster::Topology::Single,
|
18
18
|
'Unknown' => Mongo::Cluster::Topology::Unknown
|
19
19
|
}
|
20
20
|
|
@@ -92,18 +92,6 @@ module Mongo
|
|
92
92
|
type == Mongo::Cluster::Topology::ReplicaSet
|
93
93
|
end
|
94
94
|
|
95
|
-
# Does this spec raise an exception.
|
96
|
-
#
|
97
|
-
# @example Determine if the spec raises an exception.
|
98
|
-
# spec.raises_exception?
|
99
|
-
#
|
100
|
-
# @return [true, false] If the spec raises an exception.
|
101
|
-
#
|
102
|
-
# @since 2.0.0
|
103
|
-
def raises_exception?
|
104
|
-
!server_available? || invalid_server_preference?
|
105
|
-
end
|
106
|
-
|
107
95
|
# Does this spec expect a server to be found.
|
108
96
|
#
|
109
97
|
# @example Will a server be found with this spec.
|
@@ -116,18 +104,6 @@ module Mongo
|
|
116
104
|
!in_latency_window.empty?
|
117
105
|
end
|
118
106
|
|
119
|
-
# Is the read preference defined in the spec invalid.
|
120
|
-
#
|
121
|
-
# @example Determine if the spec's read preference is invalid.
|
122
|
-
# spec.invalid_server_preference?
|
123
|
-
#
|
124
|
-
# @return [true, false] If the spec's read preference is invalid.
|
125
|
-
#
|
126
|
-
# @since 2.0.0
|
127
|
-
def invalid_server_preference?
|
128
|
-
read_preference['mode'] == 'Primary' && read_preference['tag_sets']
|
129
|
-
end
|
130
|
-
|
131
107
|
# The subset of suitable servers that falls within the allowable latency
|
132
108
|
# window.
|
133
109
|
# We have to correct for our server selection algorithm that adds the primary
|
@@ -43,6 +43,7 @@ shared_context 'operation' do
|
|
43
43
|
allow(cxt).to receive(:primary?) { true }
|
44
44
|
allow(cxt).to receive(:secondary?) { false }
|
45
45
|
allow(cxt).to receive(:standalone?) { false }
|
46
|
+
allow(cxt).to receive(:slave_ok?) { false }
|
46
47
|
end
|
47
48
|
end
|
48
49
|
let(:secondary_context) do
|
@@ -54,6 +55,7 @@ shared_context 'operation' do
|
|
54
55
|
allow(cxt).to receive(:secondary?) { true }
|
55
56
|
allow(cxt).to receive(:primary?) { false }
|
56
57
|
allow(cxt).to receive(:standalone?) { false }
|
58
|
+
allow(cxt).to receive(:slave_ok?) { false }
|
57
59
|
end
|
58
60
|
end
|
59
61
|
let(:primary_context_2_4_version) do
|
@@ -64,6 +66,7 @@ shared_context 'operation' do
|
|
64
66
|
allow(cxt).to receive(:primary?) { true }
|
65
67
|
allow(cxt).to receive(:secondary?) { false }
|
66
68
|
allow(cxt).to receive(:standalone?) { false }
|
69
|
+
allow(cxt).to receive(:slave_ok?) { false }
|
67
70
|
allow(cxt).to receive(:features) { features_2_4 }
|
68
71
|
end
|
69
72
|
end
|
@@ -13,7 +13,7 @@ def server(mode, options = {})
|
|
13
13
|
listeners = Mongo::Event::Listeners.new
|
14
14
|
address = Mongo::Address.new('127.0.0.1:27017')
|
15
15
|
|
16
|
-
server = Mongo::Server.new(address, listeners)
|
16
|
+
server = Mongo::Server.new(address, listeners, TEST_OPTIONS)
|
17
17
|
description = Mongo::Server::Description.new(address, ismaster, average_round_trip_time)
|
18
18
|
server.tap do |s|
|
19
19
|
allow(s).to receive(:description).and_return(description)
|
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.3
|
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-04-28 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bson
|
@@ -67,7 +67,6 @@ files:
|
|
67
67
|
- lib/mongo/auth.rb
|
68
68
|
- lib/mongo/auth/cr.rb
|
69
69
|
- lib/mongo/auth/cr/conversation.rb
|
70
|
-
- lib/mongo/auth/executable.rb
|
71
70
|
- lib/mongo/auth/ldap.rb
|
72
71
|
- lib/mongo/auth/ldap/conversation.rb
|
73
72
|
- lib/mongo/auth/roles.rb
|
@@ -90,7 +89,7 @@ files:
|
|
90
89
|
- lib/mongo/cluster/topology.rb
|
91
90
|
- lib/mongo/cluster/topology/replica_set.rb
|
92
91
|
- lib/mongo/cluster/topology/sharded.rb
|
93
|
-
- lib/mongo/cluster/topology/
|
92
|
+
- lib/mongo/cluster/topology/single.rb
|
94
93
|
- lib/mongo/cluster/topology/unknown.rb
|
95
94
|
- lib/mongo/collection.rb
|
96
95
|
- lib/mongo/collection/view.rb
|
@@ -114,12 +113,16 @@ files:
|
|
114
113
|
- lib/mongo/error/invalid_file.rb
|
115
114
|
- lib/mongo/error/invalid_nonce.rb
|
116
115
|
- lib/mongo/error/invalid_replacement_document.rb
|
116
|
+
- lib/mongo/error/invalid_server_preference.rb
|
117
117
|
- lib/mongo/error/invalid_signature.rb
|
118
118
|
- lib/mongo/error/invalid_update_document.rb
|
119
|
+
- lib/mongo/error/invalid_uri.rb
|
120
|
+
- lib/mongo/error/invalid_uri_option.rb
|
119
121
|
- lib/mongo/error/max_bson_size.rb
|
120
122
|
- lib/mongo/error/max_message_size.rb
|
121
123
|
- lib/mongo/error/multi_index_drop.rb
|
122
124
|
- lib/mongo/error/need_primary_server.rb
|
125
|
+
- lib/mongo/error/no_server_available.rb
|
123
126
|
- lib/mongo/error/operation_failure.rb
|
124
127
|
- lib/mongo/error/parser.rb
|
125
128
|
- lib/mongo/error/socket_error.rb
|
@@ -253,7 +256,7 @@ files:
|
|
253
256
|
- spec/mongo/client_spec.rb
|
254
257
|
- spec/mongo/cluster/topology/replica_set_spec.rb
|
255
258
|
- spec/mongo/cluster/topology/sharded_spec.rb
|
256
|
-
- spec/mongo/cluster/topology/
|
259
|
+
- spec/mongo/cluster/topology/single_spec.rb
|
257
260
|
- spec/mongo/cluster/topology_spec.rb
|
258
261
|
- spec/mongo/cluster_spec.rb
|
259
262
|
- spec/mongo/collection/view/aggregation_spec.rb
|
@@ -454,7 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
454
457
|
version: '0'
|
455
458
|
requirements: []
|
456
459
|
rubyforge_project: mongo
|
457
|
-
rubygems_version: 2.4.
|
460
|
+
rubygems_version: 2.4.5
|
458
461
|
signing_key:
|
459
462
|
specification_version: 4
|
460
463
|
summary: Ruby driver for MongoDB
|
@@ -475,7 +478,7 @@ test_files:
|
|
475
478
|
- spec/mongo/client_spec.rb
|
476
479
|
- spec/mongo/cluster/topology/replica_set_spec.rb
|
477
480
|
- spec/mongo/cluster/topology/sharded_spec.rb
|
478
|
-
- spec/mongo/cluster/topology/
|
481
|
+
- spec/mongo/cluster/topology/single_spec.rb
|
479
482
|
- spec/mongo/cluster/topology_spec.rb
|
480
483
|
- spec/mongo/cluster_spec.rb
|
481
484
|
- spec/mongo/collection/view/aggregation_spec.rb
|