mongo 1.9.2 → 1.10.0.rc0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE +1 -1
- data/README.md +94 -334
- data/Rakefile +6 -4
- data/VERSION +1 -1
- data/bin/mongo_console +13 -6
- data/lib/mongo.rb +22 -27
- data/lib/mongo/bulk_write_collection_view.rb +352 -0
- data/lib/mongo/collection.rb +128 -188
- data/lib/mongo/collection_writer.rb +348 -0
- data/lib/mongo/connection.rb +19 -0
- data/lib/mongo/{util → connection}/node.rb +15 -1
- data/lib/mongo/{util → connection}/pool.rb +34 -19
- data/lib/mongo/{util → connection}/pool_manager.rb +8 -2
- data/lib/mongo/{util → connection}/sharding_pool_manager.rb +1 -1
- data/lib/mongo/connection/socket.rb +18 -0
- data/lib/mongo/{util → connection/socket}/socket_util.rb +5 -2
- data/lib/mongo/{util → connection/socket}/ssl_socket.rb +3 -4
- data/lib/mongo/{util → connection/socket}/tcp_socket.rb +25 -15
- data/lib/mongo/{util → connection/socket}/unix_socket.rb +6 -4
- data/lib/mongo/cursor.rb +113 -47
- data/lib/mongo/db.rb +203 -131
- data/lib/mongo/{exceptions.rb → exception.rb} +7 -1
- data/lib/mongo/functional.rb +19 -0
- data/lib/mongo/functional/authentication.rb +303 -0
- data/lib/mongo/{util → functional}/logging.rb +1 -1
- data/lib/mongo/{util → functional}/read_preference.rb +49 -1
- data/lib/mongo/{util → functional}/uri_parser.rb +81 -69
- data/lib/mongo/{util → functional}/write_concern.rb +2 -1
- data/{test/unit/pool_test.rb → lib/mongo/gridfs.rb} +5 -10
- data/lib/mongo/gridfs/grid.rb +1 -3
- data/lib/mongo/gridfs/grid_ext.rb +1 -1
- data/lib/mongo/gridfs/grid_file_system.rb +1 -1
- data/lib/mongo/gridfs/grid_io.rb +1 -1
- data/lib/mongo/legacy.rb +63 -8
- data/lib/mongo/mongo_client.rb +128 -154
- data/lib/mongo/mongo_replica_set_client.rb +17 -11
- data/lib/mongo/mongo_sharded_client.rb +2 -1
- data/lib/mongo/networking.rb +19 -10
- data/lib/mongo/utils.rb +19 -0
- data/lib/mongo/{util → utils}/conversions.rb +1 -1
- data/lib/mongo/{util → utils}/core_ext.rb +1 -1
- data/lib/mongo/{util → utils}/server_version.rb +1 -1
- data/lib/mongo/{util → utils}/support.rb +10 -57
- data/lib/mongo/{util → utils}/thread_local_variable_manager.rb +1 -1
- data/test/functional/authentication_test.rb +8 -21
- data/test/functional/bulk_write_collection_view_test.rb +782 -0
- data/test/functional/{connection_test.rb → client_test.rb} +153 -78
- data/test/functional/collection_test.rb +343 -97
- data/test/functional/collection_writer_test.rb +83 -0
- data/test/functional/conversions_test.rb +1 -3
- data/test/functional/cursor_fail_test.rb +3 -3
- data/test/functional/cursor_message_test.rb +3 -3
- data/test/functional/cursor_test.rb +38 -3
- data/test/functional/db_api_test.rb +5 -5
- data/test/functional/db_connection_test.rb +2 -2
- data/test/functional/db_test.rb +35 -11
- data/test/functional/grid_file_system_test.rb +2 -2
- data/test/functional/grid_io_test.rb +2 -2
- data/test/functional/grid_test.rb +2 -2
- data/test/functional/pool_test.rb +2 -3
- data/test/functional/safe_test.rb +5 -5
- data/test/functional/ssl_test.rb +22 -102
- data/test/functional/support_test.rb +1 -1
- data/test/functional/timeout_test.rb +6 -22
- data/test/functional/uri_test.rb +113 -12
- data/test/functional/write_concern_test.rb +6 -6
- data/test/helpers/general.rb +50 -0
- data/test/helpers/test_unit.rb +309 -0
- data/test/replica_set/authentication_test.rb +8 -23
- data/test/replica_set/basic_test.rb +41 -14
- data/test/replica_set/client_test.rb +179 -117
- data/test/replica_set/complex_connect_test.rb +6 -7
- data/test/replica_set/connection_test.rb +46 -38
- data/test/replica_set/count_test.rb +2 -2
- data/test/replica_set/cursor_test.rb +8 -8
- data/test/replica_set/insert_test.rb +64 -2
- data/test/replica_set/max_values_test.rb +59 -10
- data/test/replica_set/pinning_test.rb +2 -2
- data/test/replica_set/query_test.rb +2 -2
- data/test/replica_set/read_preference_test.rb +6 -6
- data/test/replica_set/refresh_test.rb +7 -7
- data/test/replica_set/replication_ack_test.rb +5 -5
- data/test/replica_set/ssl_test.rb +24 -106
- data/test/sharded_cluster/basic_test.rb +43 -15
- data/test/shared/authentication/basic_auth_shared.rb +215 -0
- data/test/shared/authentication/sasl_plain_shared.rb +96 -0
- data/test/shared/ssl_shared.rb +173 -0
- data/test/test_helper.rb +31 -199
- data/test/threading/basic_test.rb +29 -3
- data/test/tools/mongo_config.rb +45 -20
- data/test/tools/mongo_config_test.rb +1 -1
- data/test/unit/client_test.rb +136 -57
- data/test/unit/collection_test.rb +31 -55
- data/test/unit/connection_test.rb +135 -72
- data/test/unit/cursor_test.rb +2 -2
- data/test/unit/db_test.rb +19 -15
- data/test/unit/grid_test.rb +2 -2
- data/test/unit/mongo_sharded_client_test.rb +17 -15
- data/test/unit/node_test.rb +2 -2
- data/test/unit/pool_manager_test.rb +7 -5
- data/test/unit/read_pref_test.rb +82 -2
- data/test/unit/read_test.rb +14 -14
- data/test/unit/safe_test.rb +9 -9
- data/test/unit/sharding_pool_manager_test.rb +11 -5
- data/test/unit/write_concern_test.rb +9 -9
- metadata +71 -56
- metadata.gz.sig +0 -0
- data/test/functional/threading_test.rb +0 -109
- data/test/shared/authentication.rb +0 -121
- data/test/unit/util_test.rb +0 -69
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013
|
1
|
+
# Copyright (C) 2009-2013 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -15,7 +15,7 @@
|
|
15
15
|
require 'test_helper'
|
16
16
|
include Mongo
|
17
17
|
|
18
|
-
class
|
18
|
+
class ShardingPoolManagerUnitTest < Test::Unit::TestCase
|
19
19
|
|
20
20
|
context "Initialization: " do
|
21
21
|
|
@@ -45,8 +45,10 @@ class ShardingPoolManagerTest < Test::Unit::TestCase
|
|
45
45
|
@ismaster = {
|
46
46
|
'hosts' => @hosts,
|
47
47
|
'arbiters' => @arbiters,
|
48
|
+
'maxBsonObjectSize' => 1024,
|
48
49
|
'maxMessageSizeBytes' => 1024 * 2.5,
|
49
|
-
'
|
50
|
+
'maxWireVersion' => 1,
|
51
|
+
'minWireVersion' => 0
|
50
52
|
}
|
51
53
|
end
|
52
54
|
|
@@ -58,8 +60,10 @@ class ShardingPoolManagerTest < Test::Unit::TestCase
|
|
58
60
|
|
59
61
|
# Subsequent calls to configure pools.
|
60
62
|
@ismaster.merge({'ismaster' => true}),
|
61
|
-
@ismaster.merge({'secondary' => true, 'maxMessageSizeBytes' => 700}),
|
62
63
|
@ismaster.merge({'secondary' => true, 'maxBsonObjectSize' => 500}),
|
64
|
+
@ismaster.merge({'secondary' => true, 'maxMessageSizeBytes' => 700}),
|
65
|
+
@ismaster.merge({'secondary' => true, 'maxWireVersion' => 0}),
|
66
|
+
@ismaster.merge({'secondary' => true, 'minWireVersion' => 0}),
|
63
67
|
@ismaster.merge({'arbiterOnly' => true})
|
64
68
|
)
|
65
69
|
|
@@ -72,7 +76,9 @@ class ShardingPoolManagerTest < Test::Unit::TestCase
|
|
72
76
|
|
73
77
|
assert manager.seeds.include? formatted_seed
|
74
78
|
assert_equal 500, manager.max_bson_size
|
75
|
-
assert_equal 700
|
79
|
+
assert_equal 700, manager.max_message_size
|
80
|
+
assert_equal 0, manager.max_wire_version
|
81
|
+
assert_equal 0, manager.min_wire_version
|
76
82
|
end
|
77
83
|
end
|
78
84
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013
|
1
|
+
# Copyright (C) 2009-2013 MongoDB, Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
require 'test_helper'
|
16
16
|
|
17
|
-
class
|
17
|
+
class WriteConcernUnitTest < Test::Unit::TestCase
|
18
18
|
|
19
19
|
context "Write-Concern modes on Mongo::MongoClient " do
|
20
20
|
setup do
|
@@ -35,28 +35,28 @@ class WriteConcernTest < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
should "propogate to DB" do
|
38
|
-
db = @client[
|
38
|
+
db = @client[TEST_DB]
|
39
39
|
assert_equal @write_concern, db.write_concern
|
40
40
|
|
41
41
|
|
42
|
-
db = @client.db(
|
42
|
+
db = @client.db(TEST_DB)
|
43
43
|
assert_equal @write_concern, db.write_concern
|
44
44
|
|
45
|
-
db = DB.new(
|
45
|
+
db = DB.new(TEST_DB, @client)
|
46
46
|
assert_equal @write_concern, db.write_concern
|
47
47
|
end
|
48
48
|
|
49
49
|
should "allow db override" do
|
50
|
-
db = DB.new(
|
50
|
+
db = DB.new(TEST_DB, @client, :w => 0)
|
51
51
|
assert_equal 0, db.write_concern[:w]
|
52
52
|
|
53
|
-
db = @client.db(
|
53
|
+
db = @client.db(TEST_DB, :w => 0)
|
54
54
|
assert_equal 0, db.write_concern[:w]
|
55
55
|
end
|
56
56
|
|
57
57
|
context "on DB: " do
|
58
58
|
setup do
|
59
|
-
@db = @client[
|
59
|
+
@db = @client[TEST_DB]
|
60
60
|
end
|
61
61
|
|
62
62
|
should "propogate to collection" do
|
@@ -81,7 +81,7 @@ class WriteConcernTest < Test::Unit::TestCase
|
|
81
81
|
|
82
82
|
context "on operations supporting 'gle' mode" do
|
83
83
|
setup do
|
84
|
-
@collection = @client[
|
84
|
+
@collection = @client[TEST_DB]['bar']
|
85
85
|
end
|
86
86
|
|
87
87
|
should "not send w = 1 to the server" do
|
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.
|
4
|
+
version: 1.10.0.rc0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -14,41 +14,42 @@ bindir: bin
|
|
14
14
|
cert_chain:
|
15
15
|
- |
|
16
16
|
-----BEGIN CERTIFICATE-----
|
17
|
-
|
17
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
|
18
18
|
ZXItcnVieTEVMBMGCgmSJomT8ixkARkWBTEwZ2VuMRMwEQYKCZImiZPyLGQBGRYD
|
19
|
-
|
19
|
+
Y29tMB4XDTE0MDIxODIyMDQwMVoXDTE1MDIxODIyMDQwMVowQjEUMBIGA1UEAwwL
|
20
20
|
ZHJpdmVyLXJ1YnkxFTATBgoJkiaJk/IsZAEZFgUxMGdlbjETMBEGCgmSJomT8ixk
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANdoZILE3alL
|
22
|
+
V5OGgh2hkgVTd79nRV3akueIZgu9qXhNHixXsyxBnaSPbrK7s1bWurgVT/Klp//3
|
23
|
+
ASnU78R5ChmCX5/xMRp+E9FO69nCt33njUKyYU0+SwiEID02At+bUb3iS7S5CIMO
|
24
|
+
tLSybh/DhH9Hi5g+FqwpRQy/RQcTJ6Uz/75+Ng2J0oz6eVvXAuEz75apE3qJcLb3
|
25
|
+
w699mm0e4qqpfHcSkgJbOGpmbrb+XimNy+AXdagkKYk2tUjYiCwkLop0hf/XBEWu
|
26
|
+
ap8vwBNdAn+ox1eNQUSdowBf4dJvIJWepRjqeFRcLPUrF5JES7qyHbnyi7nqtaCS
|
27
|
+
GwLBeSsgxdECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
28
|
+
BBYEFEfmGN56RK0OIRqm4XYACgI7AXbsMCAGA1UdEQQZMBeBFWRyaXZlci1ydWJ5
|
29
|
+
QDEwZ2VuLmNvbTAgBgNVHRIEGTAXgRVkcml2ZXItcnVieUAxMGdlbi5jb20wDQYJ
|
30
|
+
KoZIhvcNAQEFBQADggEBAFcxu5xBsPg6szjBrkej2P+Qa9LK22rdIZtECnK8TLsQ
|
31
|
+
tmNdYMraNgiYf96U1zZKvjgzI04BRYmIeCnIDdg2MkpOZO35d/v/Hu0N9tiu08NX
|
32
|
+
aSSw+yzt43hIzEtYgs0WlSxXqnmu0ClA37t+mA0OTzp64pkQSiJfYlMbsCpElk4r
|
33
|
+
vJ5hsT7hMiPKABow5+pXckFwznEuciyBCx3ox9MnEic8qsjdiZgleeAJKDpKb+uX
|
34
|
+
ZLLlRFg7YfmA+N2giYd0oQz670xnBy5ZOvtXZe1wLLfGyeDwXeTrQGUE3oBRpr/t
|
35
|
+
eokvmuSJOtUOXE7dArS2jfgXfYsg1YZt4HttbJ9Z4ZM=
|
35
36
|
-----END CERTIFICATE-----
|
36
|
-
date:
|
37
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
37
38
|
dependencies:
|
38
39
|
- !ruby/object:Gem::Dependency
|
39
40
|
name: bson
|
40
41
|
requirement: !ruby/object:Gem::Requirement
|
41
42
|
requirements:
|
42
|
-
- - ~>
|
43
|
+
- - "~>"
|
43
44
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.
|
45
|
+
version: 1.10.0.rc0
|
45
46
|
type: :runtime
|
46
47
|
prerelease: false
|
47
48
|
version_requirements: !ruby/object:Gem::Requirement
|
48
49
|
requirements:
|
49
|
-
- - ~>
|
50
|
+
- - "~>"
|
50
51
|
- !ruby/object:Gem::Version
|
51
|
-
version: 1.
|
52
|
+
version: 1.10.0.rc0
|
52
53
|
description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
|
53
54
|
email: mongodb-dev@googlegroups.com
|
54
55
|
executables:
|
@@ -56,17 +57,35 @@ executables:
|
|
56
57
|
extensions: []
|
57
58
|
extra_rdoc_files: []
|
58
59
|
files:
|
59
|
-
- mongo.gemspec
|
60
60
|
- LICENSE
|
61
|
-
- VERSION
|
62
61
|
- README.md
|
63
62
|
- Rakefile
|
63
|
+
- VERSION
|
64
64
|
- bin/mongo_console
|
65
65
|
- lib/mongo.rb
|
66
|
+
- lib/mongo/bulk_write_collection_view.rb
|
66
67
|
- lib/mongo/collection.rb
|
68
|
+
- lib/mongo/collection_writer.rb
|
69
|
+
- lib/mongo/connection.rb
|
70
|
+
- lib/mongo/connection/node.rb
|
71
|
+
- lib/mongo/connection/pool.rb
|
72
|
+
- lib/mongo/connection/pool_manager.rb
|
73
|
+
- lib/mongo/connection/sharding_pool_manager.rb
|
74
|
+
- lib/mongo/connection/socket.rb
|
75
|
+
- lib/mongo/connection/socket/socket_util.rb
|
76
|
+
- lib/mongo/connection/socket/ssl_socket.rb
|
77
|
+
- lib/mongo/connection/socket/tcp_socket.rb
|
78
|
+
- lib/mongo/connection/socket/unix_socket.rb
|
67
79
|
- lib/mongo/cursor.rb
|
68
80
|
- lib/mongo/db.rb
|
69
|
-
- lib/mongo/
|
81
|
+
- lib/mongo/exception.rb
|
82
|
+
- lib/mongo/functional.rb
|
83
|
+
- lib/mongo/functional/authentication.rb
|
84
|
+
- lib/mongo/functional/logging.rb
|
85
|
+
- lib/mongo/functional/read_preference.rb
|
86
|
+
- lib/mongo/functional/uri_parser.rb
|
87
|
+
- lib/mongo/functional/write_concern.rb
|
88
|
+
- lib/mongo/gridfs.rb
|
70
89
|
- lib/mongo/gridfs/grid.rb
|
71
90
|
- lib/mongo/gridfs/grid_ext.rb
|
72
91
|
- lib/mongo/gridfs/grid_file_system.rb
|
@@ -76,26 +95,18 @@ files:
|
|
76
95
|
- lib/mongo/mongo_replica_set_client.rb
|
77
96
|
- lib/mongo/mongo_sharded_client.rb
|
78
97
|
- lib/mongo/networking.rb
|
79
|
-
- lib/mongo/
|
80
|
-
- lib/mongo/
|
81
|
-
- lib/mongo/
|
82
|
-
- lib/mongo/
|
83
|
-
- lib/mongo/
|
84
|
-
- lib/mongo/
|
85
|
-
-
|
86
|
-
- lib/mongo/util/server_version.rb
|
87
|
-
- lib/mongo/util/sharding_pool_manager.rb
|
88
|
-
- lib/mongo/util/socket_util.rb
|
89
|
-
- lib/mongo/util/ssl_socket.rb
|
90
|
-
- lib/mongo/util/support.rb
|
91
|
-
- lib/mongo/util/tcp_socket.rb
|
92
|
-
- lib/mongo/util/thread_local_variable_manager.rb
|
93
|
-
- lib/mongo/util/unix_socket.rb
|
94
|
-
- lib/mongo/util/uri_parser.rb
|
95
|
-
- lib/mongo/util/write_concern.rb
|
98
|
+
- lib/mongo/utils.rb
|
99
|
+
- lib/mongo/utils/conversions.rb
|
100
|
+
- lib/mongo/utils/core_ext.rb
|
101
|
+
- lib/mongo/utils/server_version.rb
|
102
|
+
- lib/mongo/utils/support.rb
|
103
|
+
- lib/mongo/utils/thread_local_variable_manager.rb
|
104
|
+
- mongo.gemspec
|
96
105
|
- test/functional/authentication_test.rb
|
106
|
+
- test/functional/bulk_write_collection_view_test.rb
|
107
|
+
- test/functional/client_test.rb
|
97
108
|
- test/functional/collection_test.rb
|
98
|
-
- test/functional/
|
109
|
+
- test/functional/collection_writer_test.rb
|
99
110
|
- test/functional/conversions_test.rb
|
100
111
|
- test/functional/cursor_fail_test.rb
|
101
112
|
- test/functional/cursor_message_test.rb
|
@@ -110,10 +121,11 @@ files:
|
|
110
121
|
- test/functional/safe_test.rb
|
111
122
|
- test/functional/ssl_test.rb
|
112
123
|
- test/functional/support_test.rb
|
113
|
-
- test/functional/threading_test.rb
|
114
124
|
- test/functional/timeout_test.rb
|
115
125
|
- test/functional/uri_test.rb
|
116
126
|
- test/functional/write_concern_test.rb
|
127
|
+
- test/helpers/general.rb
|
128
|
+
- test/helpers/test_unit.rb
|
117
129
|
- test/replica_set/authentication_test.rb
|
118
130
|
- test/replica_set/basic_test.rb
|
119
131
|
- test/replica_set/client_test.rb
|
@@ -130,7 +142,9 @@ files:
|
|
130
142
|
- test/replica_set/replication_ack_test.rb
|
131
143
|
- test/replica_set/ssl_test.rb
|
132
144
|
- test/sharded_cluster/basic_test.rb
|
133
|
-
- test/shared/authentication.rb
|
145
|
+
- test/shared/authentication/basic_auth_shared.rb
|
146
|
+
- test/shared/authentication/sasl_plain_shared.rb
|
147
|
+
- test/shared/ssl_shared.rb
|
134
148
|
- test/test_helper.rb
|
135
149
|
- test/threading/basic_test.rb
|
136
150
|
- test/tools/mongo_config.rb
|
@@ -144,12 +158,10 @@ files:
|
|
144
158
|
- test/unit/mongo_sharded_client_test.rb
|
145
159
|
- test/unit/node_test.rb
|
146
160
|
- test/unit/pool_manager_test.rb
|
147
|
-
- test/unit/pool_test.rb
|
148
161
|
- test/unit/read_pref_test.rb
|
149
162
|
- test/unit/read_test.rb
|
150
163
|
- test/unit/safe_test.rb
|
151
164
|
- test/unit/sharding_pool_manager_test.rb
|
152
|
-
- test/unit/util_test.rb
|
153
165
|
- test/unit/write_concern_test.rb
|
154
166
|
homepage: http://www.mongodb.org
|
155
167
|
licenses:
|
@@ -161,24 +173,26 @@ require_paths:
|
|
161
173
|
- lib
|
162
174
|
required_ruby_version: !ruby/object:Gem::Requirement
|
163
175
|
requirements:
|
164
|
-
- -
|
176
|
+
- - ">="
|
165
177
|
- !ruby/object:Gem::Version
|
166
178
|
version: '0'
|
167
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
180
|
requirements:
|
169
|
-
- -
|
181
|
+
- - ">"
|
170
182
|
- !ruby/object:Gem::Version
|
171
|
-
version:
|
183
|
+
version: 1.3.1
|
172
184
|
requirements: []
|
173
185
|
rubyforge_project: mongo
|
174
|
-
rubygems_version: 2.
|
186
|
+
rubygems_version: 2.2.1
|
175
187
|
signing_key:
|
176
188
|
specification_version: 4
|
177
189
|
summary: Ruby driver for MongoDB
|
178
190
|
test_files:
|
179
191
|
- test/functional/authentication_test.rb
|
192
|
+
- test/functional/bulk_write_collection_view_test.rb
|
193
|
+
- test/functional/client_test.rb
|
180
194
|
- test/functional/collection_test.rb
|
181
|
-
- test/functional/
|
195
|
+
- test/functional/collection_writer_test.rb
|
182
196
|
- test/functional/conversions_test.rb
|
183
197
|
- test/functional/cursor_fail_test.rb
|
184
198
|
- test/functional/cursor_message_test.rb
|
@@ -193,10 +207,11 @@ test_files:
|
|
193
207
|
- test/functional/safe_test.rb
|
194
208
|
- test/functional/ssl_test.rb
|
195
209
|
- test/functional/support_test.rb
|
196
|
-
- test/functional/threading_test.rb
|
197
210
|
- test/functional/timeout_test.rb
|
198
211
|
- test/functional/uri_test.rb
|
199
212
|
- test/functional/write_concern_test.rb
|
213
|
+
- test/helpers/general.rb
|
214
|
+
- test/helpers/test_unit.rb
|
200
215
|
- test/replica_set/authentication_test.rb
|
201
216
|
- test/replica_set/basic_test.rb
|
202
217
|
- test/replica_set/client_test.rb
|
@@ -213,7 +228,9 @@ test_files:
|
|
213
228
|
- test/replica_set/replication_ack_test.rb
|
214
229
|
- test/replica_set/ssl_test.rb
|
215
230
|
- test/sharded_cluster/basic_test.rb
|
216
|
-
- test/shared/authentication.rb
|
231
|
+
- test/shared/authentication/basic_auth_shared.rb
|
232
|
+
- test/shared/authentication/sasl_plain_shared.rb
|
233
|
+
- test/shared/ssl_shared.rb
|
217
234
|
- test/test_helper.rb
|
218
235
|
- test/threading/basic_test.rb
|
219
236
|
- test/tools/mongo_config.rb
|
@@ -227,11 +244,9 @@ test_files:
|
|
227
244
|
- test/unit/mongo_sharded_client_test.rb
|
228
245
|
- test/unit/node_test.rb
|
229
246
|
- test/unit/pool_manager_test.rb
|
230
|
-
- test/unit/pool_test.rb
|
231
247
|
- test/unit/read_pref_test.rb
|
232
248
|
- test/unit/read_test.rb
|
233
249
|
- test/unit/safe_test.rb
|
234
250
|
- test/unit/sharding_pool_manager_test.rb
|
235
|
-
- test/unit/util_test.rb
|
236
251
|
- test/unit/write_concern_test.rb
|
237
252
|
has_rdoc: yard
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# Copyright (C) 2013 10gen Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
require 'test_helper'
|
16
|
-
|
17
|
-
class TestThreading < Test::Unit::TestCase
|
18
|
-
|
19
|
-
include Mongo
|
20
|
-
|
21
|
-
@@client = standard_connection(:pool_size => 2, :pool_timeout => 30)
|
22
|
-
@@db = @@client[MONGO_TEST_DB]
|
23
|
-
@@coll = @@db.collection('thread-test-collection')
|
24
|
-
|
25
|
-
def set_up_safe_data
|
26
|
-
@@db.drop_collection('duplicate')
|
27
|
-
@@db.drop_collection('unique')
|
28
|
-
@duplicate = @@db.collection('duplicate')
|
29
|
-
@unique = @@db.collection('unique')
|
30
|
-
|
31
|
-
@duplicate.insert("test" => "insert")
|
32
|
-
@duplicate.insert("test" => "update")
|
33
|
-
@unique.insert("test" => "insert")
|
34
|
-
@unique.insert("test" => "update")
|
35
|
-
@unique.create_index("test", :unique => true)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_safe_update
|
39
|
-
times = []
|
40
|
-
set_up_safe_data
|
41
|
-
threads = []
|
42
|
-
25.times do |i|
|
43
|
-
threads[i] = Thread.new do
|
44
|
-
100.times do
|
45
|
-
if i % 2 == 0
|
46
|
-
assert_raise Mongo::OperationFailure do
|
47
|
-
t1 = Time.now
|
48
|
-
@unique.update({"test" => "insert"}, {"$set" => {"test" => "update"}})
|
49
|
-
times << Time.now - t1
|
50
|
-
end
|
51
|
-
else
|
52
|
-
t1 = Time.now
|
53
|
-
@duplicate.update({"test" => "insert"}, {"$set" => {"test" => "update"}})
|
54
|
-
times << Time.now - t1
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
25.times do |i|
|
61
|
-
threads[i].join
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_safe_insert
|
66
|
-
set_up_safe_data
|
67
|
-
threads = []
|
68
|
-
25.times do |i|
|
69
|
-
threads[i] = Thread.new do
|
70
|
-
if i % 2 == 0
|
71
|
-
assert_raise Mongo::OperationFailure do
|
72
|
-
@unique.insert({"test" => "insert"})
|
73
|
-
end
|
74
|
-
else
|
75
|
-
@duplicate.insert({"test" => "insert"})
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
25.times do |i|
|
81
|
-
threads[i].join
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_threading
|
86
|
-
@@coll.drop
|
87
|
-
@@coll = @@db.collection('thread-test-collection')
|
88
|
-
|
89
|
-
docs = []
|
90
|
-
1000.times {|i| docs << {:x => i}}
|
91
|
-
@@coll.insert(docs)
|
92
|
-
|
93
|
-
threads = []
|
94
|
-
|
95
|
-
10.times do |i|
|
96
|
-
threads[i] = Thread.new do
|
97
|
-
sum = 0
|
98
|
-
@@coll.find().each do |document|
|
99
|
-
sum += document["x"]
|
100
|
-
end
|
101
|
-
assert_equal 499500, sum
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
10.times do |i|
|
106
|
-
threads[i].join
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|