mongo 2.0.5 → 2.0.6
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/lib/mongo/auth/cr/conversation.rb +0 -1
- data/lib/mongo/client.rb +19 -5
- data/lib/mongo/cluster.rb +84 -16
- data/lib/mongo/cluster/topology.rb +3 -4
- data/lib/mongo/cluster/topology/replica_set.rb +75 -0
- data/lib/mongo/cluster/topology/sharded.rb +60 -0
- data/lib/mongo/cluster/topology/single.rb +51 -0
- data/lib/mongo/cluster/topology/unknown.rb +62 -0
- data/lib/mongo/error/invalid_bulk_operation.rb +2 -1
- data/lib/mongo/event.rb +9 -9
- data/lib/mongo/event/{server_added.rb → description_changed.rb} +6 -5
- data/lib/mongo/event/{server_removed.rb → standalone_discovered.rb} +15 -15
- data/lib/mongo/operation/aggregate.rb +6 -5
- data/lib/mongo/operation/command.rb +5 -6
- data/lib/mongo/operation/kill_cursors.rb +3 -2
- data/lib/mongo/operation/map_reduce.rb +6 -5
- data/lib/mongo/operation/read/collections_info.rb +5 -4
- data/lib/mongo/operation/read/get_more.rb +8 -7
- data/lib/mongo/operation/read/indexes.rb +4 -3
- data/lib/mongo/operation/read/list_collections.rb +5 -4
- data/lib/mongo/operation/read/list_indexes.rb +7 -6
- data/lib/mongo/operation/read/query.rb +8 -7
- data/lib/mongo/operation/read_preferrable.rb +6 -2
- data/lib/mongo/operation/write/bulk/bulk_delete.rb +13 -12
- data/lib/mongo/operation/write/bulk/bulk_insert.rb +10 -9
- data/lib/mongo/operation/write/bulk/bulk_insert/result.rb +2 -2
- data/lib/mongo/operation/write/bulk/bulk_update.rb +12 -11
- data/lib/mongo/operation/write/create_index.rb +8 -7
- data/lib/mongo/operation/write/create_user.rb +4 -3
- data/lib/mongo/operation/write/delete.rb +13 -12
- data/lib/mongo/operation/write/drop_index.rb +6 -5
- data/lib/mongo/operation/write/insert.rb +8 -7
- data/lib/mongo/operation/write/insert/result.rb +1 -1
- data/lib/mongo/operation/write/remove_user.rb +4 -3
- data/lib/mongo/operation/write/update.rb +10 -9
- data/lib/mongo/operation/write/update_user.rb +4 -3
- data/lib/mongo/server.rb +8 -15
- data/lib/mongo/server/context.rb +2 -2
- data/lib/mongo/server/description.rb +65 -3
- data/lib/mongo/server/description/features.rb +2 -1
- data/lib/mongo/server/description/inspector.rb +5 -5
- data/lib/mongo/server/description/inspector/{server_added.rb → description_changed.rb} +3 -5
- data/lib/mongo/server/description/inspector/{server_removed.rb → standalone_discovered.rb} +12 -15
- data/lib/mongo/version.rb +1 -1
- data/spec/mongo/auth/cr_spec.rb +1 -1
- data/spec/mongo/auth/ldap_spec.rb +1 -1
- data/spec/mongo/auth/scram_spec.rb +1 -1
- data/spec/mongo/auth/x509_spec.rb +1 -1
- data/spec/mongo/client_spec.rb +4 -0
- data/spec/mongo/cluster/topology/replica_set_spec.rb +254 -4
- data/spec/mongo/cluster/topology/sharded_spec.rb +70 -19
- data/spec/mongo/cluster/topology/single_spec.rb +25 -4
- data/spec/mongo/cluster/topology/unknown_spec.rb +167 -0
- data/spec/mongo/cluster/topology_spec.rb +6 -6
- data/spec/mongo/cluster_spec.rb +179 -1
- data/spec/mongo/operation/read_preferrable_spec.rb +81 -28
- data/spec/mongo/operation/write/bulk/bulk_delete_spec.rb +1 -0
- data/spec/mongo/server/connection_pool_spec.rb +10 -10
- data/spec/mongo/server/connection_spec.rb +1 -1
- data/spec/mongo/server/description/features_spec.rb +23 -3
- data/spec/mongo/server/description/inspector/description_changed_spec.rb +78 -0
- data/spec/mongo/server/description_spec.rb +238 -0
- data/spec/mongo/server/monitor_spec.rb +1 -1
- data/spec/mongo/server_discovery_and_monitoring_spec.rb +20 -4
- data/spec/mongo/server_selection_spec.rb +2 -2
- data/spec/mongo/server_spec.rb +12 -8
- data/spec/support/authorization.rb +8 -8
- data/spec/support/sdam/rs/discover_passives.yml +36 -0
- data/spec/support/sdam/rs/new_primary_wrong_set_name.yml +2 -2
- data/spec/support/sdam/rs/primary_becomes_standalone.yml +1 -1
- data/spec/support/sdam/rs/primary_changes_set_name.yml +2 -2
- data/spec/support/sdam/rs/primary_disconnect.yml +1 -1
- data/spec/support/sdam/rs/primary_wrong_set_name.yml +1 -1
- data/spec/support/sdam/rs/secondary_wrong_set_name.yml +1 -1
- data/spec/support/sdam/rs/secondary_wrong_set_name_with_primary.yml +2 -2
- data/spec/support/sdam/sharded/single_mongos.yml +33 -0
- data/spec/support/shared/operation.rb +12 -4
- data/spec/support/shared/server_selector.rb +1 -1
- metadata +12 -10
- metadata.gz.sig +0 -0
- data/spec/mongo/server/description/inspector/server_added_spec.rb +0 -92
- data/spec/mongo/server/description/inspector/server_removed_spec.rb +0 -95
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mongo::Server::Description::Inspector::ServerAdded do
|
4
|
-
|
5
|
-
let(:listeners) do
|
6
|
-
Mongo::Event::Listeners.new
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:inspection) do
|
10
|
-
described_class.new(listeners)
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:address) do
|
14
|
-
Mongo::Address.new('127.0.0.1:27017')
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#run' do
|
18
|
-
|
19
|
-
let(:config) do
|
20
|
-
{
|
21
|
-
'ismaster' => true,
|
22
|
-
'secondary' => false,
|
23
|
-
'hosts' => [ '127.0.0.1:27018', '127.0.0.1:27019' ],
|
24
|
-
'setName' => 'test'
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
let(:description) do
|
29
|
-
Mongo::Server::Description.new(address, config, listeners)
|
30
|
-
end
|
31
|
-
|
32
|
-
let(:updated) do
|
33
|
-
Mongo::Server::Description.new(address, new_config, listeners)
|
34
|
-
end
|
35
|
-
|
36
|
-
let(:listener) do
|
37
|
-
double('listener')
|
38
|
-
end
|
39
|
-
|
40
|
-
before do
|
41
|
-
listeners.add_listener(Mongo::Event::SERVER_ADDED, listener)
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when a host is added' do
|
45
|
-
|
46
|
-
let(:new_config) do
|
47
|
-
{ 'hosts' => [ '127.0.0.1:27019', '127.0.0.1:27020' ] }
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'fires a server added event' do
|
51
|
-
expect(listener).to receive(:handle).with('127.0.0.1:27020')
|
52
|
-
inspection.run(description, updated)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'when an arbiter is added' do
|
57
|
-
|
58
|
-
let(:new_config) do
|
59
|
-
{ 'arbiters' => [ '127.0.0.1:27020' ] }
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'fires a server added event' do
|
63
|
-
expect(listener).to receive(:handle).with('127.0.0.1:27020')
|
64
|
-
inspection.run(description, updated)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'when a passive is added' do
|
69
|
-
|
70
|
-
let(:new_config) do
|
71
|
-
{ 'passives' => [ '127.0.0.1:27020' ] }
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'fires a server added event' do
|
75
|
-
expect(listener).to receive(:handle).with('127.0.0.1:27020')
|
76
|
-
inspection.run(description, updated)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'when no server is added' do
|
81
|
-
|
82
|
-
let(:new_config) do
|
83
|
-
{ 'hosts' => [ '127.0.0.1:27018', '127.0.0.1:27019' ] }
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'fires no event' do
|
87
|
-
expect(listener).to_not receive(:handle)
|
88
|
-
inspection.run(description, updated)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mongo::Server::Description::Inspector::ServerRemoved do
|
4
|
-
|
5
|
-
let(:listeners) do
|
6
|
-
Mongo::Event::Listeners.new
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:inspection) do
|
10
|
-
described_class.new(listeners)
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:address) do
|
14
|
-
Mongo::Address.new('127.0.0.1:27017')
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '.run' do
|
18
|
-
|
19
|
-
let(:config) do
|
20
|
-
{
|
21
|
-
'ismaster' => true,
|
22
|
-
'secondary' => false,
|
23
|
-
'hosts' => [ '127.0.0.1:27018', '127.0.0.1:27019' ],
|
24
|
-
'setName' => 'test'
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
let(:description) do
|
29
|
-
Mongo::Server::Description.new(address, config, listeners)
|
30
|
-
end
|
31
|
-
|
32
|
-
let(:updated) do
|
33
|
-
Mongo::Server::Description.new(address, new_config, listeners)
|
34
|
-
end
|
35
|
-
|
36
|
-
let(:listener) do
|
37
|
-
double('listener')
|
38
|
-
end
|
39
|
-
|
40
|
-
before do
|
41
|
-
listeners.add_listener(Mongo::Event::SERVER_REMOVED, listener)
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when no server is removed' do
|
45
|
-
|
46
|
-
let(:new_config) do
|
47
|
-
{
|
48
|
-
'hosts' => [ '127.0.0.1:27018', '127.0.0.1:27019' ],
|
49
|
-
'ismaster' => true,
|
50
|
-
'setName' => 'test'
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'does not fire a server removed event' do
|
55
|
-
expect(listener).to_not receive(:handle)
|
56
|
-
inspection.run(description, updated)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'when a server is removed' do
|
61
|
-
|
62
|
-
context 'when the server is a primary' do
|
63
|
-
|
64
|
-
let(:new_config) do
|
65
|
-
{
|
66
|
-
'hosts' => [ '127.0.0.1:27019', '127.0.0.1:27020' ],
|
67
|
-
'ismaster' => true,
|
68
|
-
'setName' => 'test'
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'fires a server removed event' do
|
73
|
-
expect(listener).to receive(:handle).with('127.0.0.1:27018')
|
74
|
-
inspection.run(description, updated)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
context 'when the server is not a primary' do
|
79
|
-
|
80
|
-
let(:new_config) do
|
81
|
-
{
|
82
|
-
'hosts' => [ '127.0.0.1:27019', '127.0.0.1:27020' ],
|
83
|
-
'secondary' => true,
|
84
|
-
'setName' => 'test'
|
85
|
-
}
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'does not fire a server removed event' do
|
89
|
-
expect(listener).to_not receive(:handle)
|
90
|
-
inspection.run(description, updated)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|