mongo 2.0.3 → 2.0.4
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/error/parser.rb +2 -1
- data/lib/mongo/server/connection_pool.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/mongo/error/parser_spec.rb +5 -26
- data/spec/mongo/server/connection_pool_spec.rb +27 -0
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e38363c98850f8cb9f7ef56552faf0b6bbaf88e6
|
4
|
+
data.tar.gz: 9bb3295506cf0fdd420a7232283982145824cb11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 391cb75664da5c1d1f24a8b61b59703b2767c60c221c601342bf2597096af1a828b1eaec2402e91e5e512e251f64534a31dcc73103062cc111f6247137953edf
|
7
|
+
data.tar.gz: fe3b98b0be277225dbe52ca0a39a8bc3e31e80eff077041bf87d7327d9adfba697a8ed6b8333637dd5c6b887b7599b893b15ebfbf347af90cfdcae97582682c1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mongo/address.rb
CHANGED
@@ -148,7 +148,7 @@ module Mongo
|
|
148
148
|
error = nil
|
149
149
|
::Socket.getaddrinfo(host, nil, family, ::Socket::SOCK_STREAM).detect do |info|
|
150
150
|
begin
|
151
|
-
return FAMILY_MAP[info[4]].new(
|
151
|
+
return FAMILY_MAP[info[4]].new(info[3], port).tap do |res|
|
152
152
|
res.socket(timeout, ssl_options).connect!
|
153
153
|
end
|
154
154
|
rescue IOError, SystemCallError => e
|
data/lib/mongo/error/parser.rb
CHANGED
@@ -48,7 +48,8 @@ module Mongo
|
|
48
48
|
parse_single(@message, ERROR)
|
49
49
|
parse_single(@message, ERRMSG)
|
50
50
|
parse_multiple(@message, WRITE_ERRORS)
|
51
|
-
|
51
|
+
parse_single(@message, ERRMSG,
|
52
|
+
document[WRITE_CONCERN_ERROR]) if document[WRITE_CONCERN_ERROR]
|
52
53
|
end
|
53
54
|
|
54
55
|
def parse_single(message, key, doc = document)
|
data/lib/mongo/version.rb
CHANGED
@@ -84,35 +84,14 @@ describe Mongo::Error::Parser do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
context 'when the document contains
|
87
|
+
context 'when the document contains a writeConcernError' do
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
let(:document) do
|
92
|
-
{ 'writeConcernError' => [{ 'errmsg' => 'not authorized for query', 'code' => 13 }]}
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'returns the message' do
|
96
|
-
expect(parser.message).to eq('not authorized for query (13)')
|
97
|
-
end
|
89
|
+
let(:document) do
|
90
|
+
{ 'writeConcernError' => { 'code' => 100, 'errmsg' => 'Not enough data-bearing nodes' } }
|
98
91
|
end
|
99
92
|
|
100
|
-
|
101
|
-
|
102
|
-
let(:document) do
|
103
|
-
{
|
104
|
-
'writeConcernError' => [
|
105
|
-
{ 'code' => 9, 'errmsg' => 'Unknown modifier: $st' },
|
106
|
-
{ 'code' => 9, 'errmsg' => 'Unknown modifier: $bl' }
|
107
|
-
]
|
108
|
-
}
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'returns the messages concatenated' do
|
112
|
-
expect(parser.message).to eq(
|
113
|
-
'Unknown modifier: $st (9), Unknown modifier: $bl (9)'
|
114
|
-
)
|
115
|
-
end
|
93
|
+
it 'returns the message' do
|
94
|
+
expect(parser.message).to eq('Not enough data-bearing nodes (100)')
|
116
95
|
end
|
117
96
|
end
|
118
97
|
end
|
@@ -117,4 +117,31 @@ describe Mongo::Server::ConnectionPool do
|
|
117
117
|
expect(pool.inspect).to include(pool.__send__(:queue).inspect)
|
118
118
|
end
|
119
119
|
end
|
120
|
+
|
121
|
+
describe '#with_connection' do
|
122
|
+
|
123
|
+
let(:server) do
|
124
|
+
Mongo::Server.new(address, Mongo::Event::Listeners.new, ssl: SSL)
|
125
|
+
end
|
126
|
+
|
127
|
+
let(:pool) do
|
128
|
+
described_class.get(server)
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'when a connection cannot be checked out' do
|
132
|
+
|
133
|
+
before do
|
134
|
+
allow(pool).to receive(:checkout).and_return(nil)
|
135
|
+
pool.with_connection { |c| c }
|
136
|
+
end
|
137
|
+
|
138
|
+
let(:queue) do
|
139
|
+
pool.send(:queue).queue
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'does not add the connection to the pool' do
|
143
|
+
expect(queue.size).to eq(1)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
120
147
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -75,7 +75,7 @@ CLIENT_PASSWORD_PEM = "#{SSL_CERTS_DIR}/password_protected.pem"
|
|
75
75
|
CA_PEM = "#{SSL_CERTS_DIR}/ca.pem"
|
76
76
|
CRL_PEM = "#{SSL_CERTS_DIR}/crl.pem"
|
77
77
|
|
78
|
-
# Determine whether the test clients are connecting to a
|
78
|
+
# Determine whether the test clients are connecting to a standalone.
|
79
79
|
#
|
80
80
|
# @since 2.0.0
|
81
81
|
def standalone?
|
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.4
|
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-05-14 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bson
|
metadata.gz.sig
CHANGED
Binary file
|