mongo 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b0437cd0c5d8bb2f5500c239a8814d634c80499
4
- data.tar.gz: bed04278506ef47a820421a872f5850ab8f01a7d
3
+ metadata.gz: e38363c98850f8cb9f7ef56552faf0b6bbaf88e6
4
+ data.tar.gz: 9bb3295506cf0fdd420a7232283982145824cb11
5
5
  SHA512:
6
- metadata.gz: 9d790a1e9b2f1e97c2b354e22daf0ec5d6552c438f5d59c3d84e98ab57c42fec8f4cc4d81699569efde84840d3b41e5f9417c0aa536f0d51af1f39ce3c8368fa
7
- data.tar.gz: d9417be0c394836c30d60a0bf4a1199003b56866a39f3630aea96e9647a3ef27040c9d1df9a7acc6c068718da4bee16bdb982c6feb3fae13ef7218280059e9e3
6
+ metadata.gz: 391cb75664da5c1d1f24a8b61b59703b2767c60c221c601342bf2597096af1a828b1eaec2402e91e5e512e251f64534a31dcc73103062cc111f6247137953edf
7
+ data.tar.gz: fe3b98b0be277225dbe52ca0a39a8bc3e31e80eff077041bf87d7327d9adfba697a8ed6b8333637dd5c6b887b7599b893b15ebfbf347af90cfdcae97582682c1
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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(host, port).tap do |res|
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
@@ -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
- parse_multiple(@message, WRITE_CONCERN_ERROR)
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)
@@ -98,7 +98,7 @@ module Mongo
98
98
  connection = checkout
99
99
  yield(connection)
100
100
  ensure
101
- checkin(connection)
101
+ checkin(connection) if connection
102
102
  end
103
103
  end
104
104
 
@@ -17,5 +17,5 @@ module Mongo
17
17
  # The current version of the driver.
18
18
  #
19
19
  # @since 2.0.0
20
- VERSION = '2.0.3'.freeze
20
+ VERSION = '2.0.4'.freeze
21
21
  end
@@ -84,35 +84,14 @@ describe Mongo::Error::Parser do
84
84
  end
85
85
  end
86
86
 
87
- context 'when the document contains writeConcernErrors' do
87
+ context 'when the document contains a writeConcernError' do
88
88
 
89
- context 'when a single error exists' do
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
- context 'when multiple errors exist' do
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
@@ -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 standlone.
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.3
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-04-28 00:00:00.000000000 Z
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