mongo 1.10.0.rc1 → 1.10.0

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.
@@ -35,9 +35,9 @@ class GridIOTest < Test::Unit::TestCase
35
35
  @mode = 'w'
36
36
  end
37
37
 
38
- should "set default 256k chunk size" do
38
+ should "set default 255k chunk size" do
39
39
  file = GridIO.new(@files, @chunks, @filename, @mode)
40
- assert_equal 256 * 1024, file.chunk_size
40
+ assert_equal 255 * 1024, file.chunk_size
41
41
  end
42
42
 
43
43
  should "set chunk size" do
@@ -262,7 +262,7 @@ class GridTest < Test::Unit::TestCase
262
262
  end
263
263
 
264
264
  should "put and get a large io object if reading less than the chunk size" do
265
- read_and_write_stream('sample_data', 256 * 1024)
265
+ read_and_write_stream('sample_data', 255 * 1024)
266
266
  end
267
267
 
268
268
  should "put and get a large io object if reading more than the chunk size" do
@@ -82,13 +82,26 @@ class ReplicaSetInsertTest < Test::Unit::TestCase
82
82
  assert_match_document(
83
83
  {
84
84
  "ok" => 1,
85
- "n" => 1,
85
+ "n" => 2,
86
+ "writeErrors" => [
87
+ {
88
+ "index" => 2,
89
+ "code" => 11000,
90
+ "errmsg" => /duplicate key error/,
91
+ }
92
+ ],
86
93
  "writeConcernError" => [
87
94
  {
88
95
  "errmsg" => /waiting for replication timed out|timed out waiting for slaves|timeout/,
89
96
  "code" => 64,
90
97
  "errInfo" => {"wtimeout" => true},
91
98
  "index" => 0
99
+ },
100
+ {
101
+ "errmsg" => /waiting for replication timed out|timed out waiting for slaves|timeout/,
102
+ "code" => 64,
103
+ "errInfo" => {"wtimeout" => true},
104
+ "index" => 1
92
105
  }
93
106
  ],
94
107
  "code" => 65,
@@ -96,6 +109,7 @@ class ReplicaSetInsertTest < Test::Unit::TestCase
96
109
  "nInserted" => 1
97
110
  }, result, "wire_version:#{wire_version}")
98
111
  end
112
+ assert_equal 2, @coll.find.to_a.size
99
113
  end
100
114
 
101
115
  should "handle unordered errors with deferred write concern error - spec Merging Results" do # TODO - spec review
@@ -36,17 +36,23 @@ class ReplicaSetAckTest < Test::Unit::TestCase
36
36
  end
37
37
 
38
38
  def test_safe_mode_with_w_failure
39
- assert_raise_error OperationFailure, "timeout" do
39
+ assert_raise_error WriteConcernError, "time" do
40
40
  @col.insert({:foo => 1}, :w => 4, :wtimeout => 1, :fsync => true)
41
41
  end
42
- assert_raise_error OperationFailure, "timeout" do
42
+ assert_raise_error WriteConcernError, "time" do
43
43
  @col.update({:foo => 1}, {:foo => 2}, :w => 4, :wtimeout => 1, :fsync => true)
44
44
  end
45
- assert_raise_error OperationFailure, "timeout" do
45
+ assert_raise_error WriteConcernError, "time" do
46
46
  @col.remove({:foo => 2}, :w => 4, :wtimeout => 1, :fsync => true)
47
47
  end
48
- assert_raise_error OperationFailure do
49
- @col.insert({:foo => 3}, :w => "test-tag")
48
+ if @client.server_version >= '2.5.4'
49
+ assert_raise_error WriteConcernError do
50
+ @col.insert({:foo => 3}, :w => "test-tag")
51
+ end
52
+ else # indistinguishable "errmsg"=>"exception: unrecognized getLastError mode: test-tag"
53
+ assert_raise_error OperationFailure do
54
+ @col.insert({:foo => 3}, :w => "test-tag")
55
+ end
50
56
  end
51
57
  end
52
58
 
@@ -18,7 +18,9 @@ module SSLTests
18
18
  MONGODB_X509_USERNAME = 'CN=client,OU=kerneluser,O=10Gen,L=New York City,ST=New York,C=US'
19
19
  CERT_PATH = "#{Dir.pwd}/test/fixtures/certificates/"
20
20
  CLIENT_CERT = "#{CERT_PATH}client.pem"
21
+ CLIENT_CERT_PASS = "#{CERT_PATH}password_protected.pem"
21
22
  CA_CERT = "#{CERT_PATH}ca.pem"
23
+ PASS_PHRASE = ENV['SSL_KEY_PASS_PHRASE']
22
24
 
23
25
  def create_client(*args)
24
26
  if @client_class == MongoClient
@@ -59,9 +61,16 @@ module SSLTests
59
61
  :ssl_cert => CLIENT_CERT,
60
62
  :ssl_verify => true)
61
63
  end
64
+
65
+ # raises when key passphrase is given without key file
66
+ assert_raise MongoArgumentError do
67
+ create_client(@connect_info, :connect => false,
68
+ :ssl => true,
69
+ :ssl_key_pass_phrase => PASS_PHRASE)
70
+ end
62
71
  end
63
72
 
64
- # Requires MongoDB built with SSL and the follow options:
73
+ # Requires MongoDB built with SSL and the following options:
65
74
  #
66
75
  # mongod --dbpath /path/to/data/directory --sslOnNormalPorts \
67
76
  # --sslPEMKeyFile /path/to/server.pem \
@@ -76,7 +85,7 @@ module SSLTests
76
85
  assert client.connect
77
86
  end
78
87
 
79
- # Requires MongoDB built with SSL and the follow options:
88
+ # Requires MongoDB built with SSL and the following options:
80
89
  #
81
90
  # mongod --dbpath /path/to/data/directory --sslOnNormalPorts \
82
91
  # --sslPEMKeyFile /path/to/server.pem \
@@ -115,7 +124,38 @@ module SSLTests
115
124
  end
116
125
  end
117
126
 
118
- # Requires mongod built with SSL and the follow options:
127
+ # Requires MongoDB built with SSL and the following options:
128
+ #
129
+ # mongod --dbpath /path/to/data/directory --sslOnNormalPorts \
130
+ # --sslPEMKeyFile /path/to/password_protected.pem \
131
+ # --sslCAFile /path/to/ca.pem \
132
+ # --sslCRLFile /path/to/crl.pem
133
+ #
134
+ # Make sure you have 'server' as an alias for localhost in /etc/hosts.
135
+ # If SSL_KEY_PASS_PHRASE is not set as an environment variable,
136
+ # you will be prompted to enter a passphrase at runtime.
137
+ #
138
+ def test_ssl_with_key_pass_phrase
139
+ client = create_client(@connect_info, :connect => false,
140
+ :ssl => true,
141
+ :ssl_cert => CLIENT_CERT_PASS,
142
+ :ssl_key => CLIENT_CERT_PASS,
143
+ :ssl_key_pass_phrase => PASS_PHRASE)
144
+ assert client.connect
145
+ end
146
+
147
+ def test_ssl_with_key_pass_phrase_fail
148
+ client = create_client(@connect_info, :connect => false,
149
+ :ssl => true,
150
+ :ssl_cert => CLIENT_CERT_PASS,
151
+ :ssl_key => CLIENT_CERT_PASS,
152
+ :ssl_key_pass_phrase => "secret")
153
+ assert_raise OpenSSL::PKey::RSAError do
154
+ client.connect
155
+ end
156
+ end
157
+
158
+ # Requires mongod built with SSL and the following options:
119
159
  #
120
160
  # mongod --dbpath /path/to/data/directory --sslOnNormalPorts \
121
161
  # --sslPEMKeyFile /path/to/server.pem \
@@ -136,7 +176,7 @@ module SSLTests
136
176
 
137
177
  # X509 Authentication Tests
138
178
  #
139
- # Requires MongoDB built with SSL and the follow options:
179
+ # Requires MongoDB built with SSL and the following options:
140
180
  #
141
181
  # mongod --auth --dbpath /path/to/data/directory --sslOnNormalPorts \
142
182
  # --sslPEMKeyFile /path/to/server.pem \
@@ -106,6 +106,37 @@ class PoolManagerUnitTest < Test::Unit::TestCase
106
106
  assert_equal [['localhost', 27020]], manager.arbiters
107
107
  end
108
108
 
109
+ should "return clones of pool lists" do
110
+
111
+ @db.stubs(:command).returns(
112
+ # First call to get a socket.
113
+ @ismaster.merge({'ismaster' => true}),
114
+
115
+ # Subsequent calls to configure pools.
116
+ @ismaster.merge({'ismaster' => true}),
117
+ @ismaster.merge({'secondary' => true, 'maxBsonObjectSize' => 500}),
118
+ @ismaster.merge({'secondary' => true, 'maxMessageSizeBytes' => 700}),
119
+ @ismaster.merge({'arbiterOnly' => true})
120
+ )
121
+
122
+ seeds = [['localhost', 27017], ['localhost', 27018]]
123
+ manager = Mongo::PoolManager.new(@client, seeds)
124
+ @client.stubs(:local_manager).returns(manager)
125
+ manager.connect
126
+
127
+ assert_not_equal manager.instance_variable_get(:@arbiters).object_id, manager.arbiters.object_id
128
+ assert_not_equal manager.instance_variable_get(:@secondaries).object_id, manager.secondaries.object_id
129
+ assert_not_equal manager.instance_variable_get(:@secondary_pools).object_id, manager.secondary_pools.object_id
130
+ assert_not_equal manager.instance_variable_get(:@hosts).object_id, manager.hosts.object_id
131
+ assert_not_equal manager.instance_variable_get(:@pools).object_id, manager.pools.object_id
132
+
133
+ assert_not_equal manager.instance_variable_get(:@arbiters).object_id, manager.state_snapshot[:arbiters].object_id
134
+ assert_not_equal manager.instance_variable_get(:@secondaries).object_id, manager.state_snapshot[:secondaries].object_id
135
+ assert_not_equal manager.instance_variable_get(:@secondary_pools).object_id, manager.state_snapshot[:secondary_pools].object_id
136
+ assert_not_equal manager.instance_variable_get(:@hosts).object_id, manager.state_snapshot[:hosts].object_id
137
+ assert_not_equal manager.instance_variable_get(:@pools).object_id, manager.state_snapshot[:pools].object_id
138
+ end
139
+
109
140
  end
110
141
 
111
142
  end
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: 1.10.0.rc1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -34,7 +34,7 @@ cert_chain:
34
34
  JrZM8w8wGbIOeLtoQqa7HB/jOYbTahH7KMNh2LHAbOR93hNIJxVRa4iwxiMQ75tN
35
35
  9WUIAJ4AEtjwRg1Bz0OwDo3aucPCBpx77+/FWhv7JYY=
36
36
  -----END CERTIFICATE-----
37
- date: 2014-03-17 00:00:00.000000000 Z
37
+ date: 2014-04-03 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: bson
@@ -42,14 +42,14 @@ dependencies:
42
42
  requirements:
43
43
  - - "~>"
44
44
  - !ruby/object:Gem::Version
45
- version: 1.10.0.rc1
45
+ version: 1.10.0
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: 1.10.0.rc1
52
+ version: 1.10.0
53
53
  description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
54
54
  email: mongodb-dev@googlegroups.com
55
55
  executables:
@@ -182,9 +182,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">"
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: 1.3.1
187
+ version: '0'
188
188
  requirements: []
189
189
  rubyforge_project: mongo
190
190
  rubygems_version: 2.2.2
metadata.gz.sig CHANGED
Binary file