Skip to content

Commit beb6402

Browse files
committed
Merge pull request #580 from estolfo/jenkins
Changes to test suite for testing on Jenkins with Mongo Orchestration
2 parents 3d4e6a7 + 3cf3c1b commit beb6402

File tree

12 files changed

+50
-24
lines changed

12 files changed

+50
-24
lines changed

lib/mongo/operation/map_reduce.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class MapReduce
6363
#
6464
# @since 2.0.0
6565
def execute(context)
66-
unless context.standalone? || context.primary? || secondary_ok?
66+
unless context.standalone? || context.mongos? || context.primary? || secondary_ok?
6767
raise Error::NeedPrimaryServer.new(ERROR_MESSAGE)
6868
end
6969
execute_message(context)

lib/mongo/operation/read/list_collections.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ class ListCollections
4949
#
5050
# @since 2.0.0
5151
def execute(context)
52-
unless context.primary? || context.standalone?
53-
raise Exception, "Must use primary server"
54-
end
5552
execute_message(context)
5653
end
5754

lib/mongo/operation/read/list_indexes.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ class ListIndexes
5151
#
5252
# @since 2.0.0
5353
def execute(context)
54-
unless context.primary? || context.standalone?
55-
raise Exception, "Must use primary server"
56-
end
5754
execute_message(context)
5855
end
5956

spec/mongo/auth/cr_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe Mongo::Auth::CR do
44

55
let(:address) do
6-
Mongo::Address.new('127.0.0.1:27017')
6+
Mongo::Address.new(DEFAULT_ADDRESS)
77
end
88

99
let(:server) do

spec/mongo/auth/ldap_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe Mongo::Auth::LDAP do
44

55
let(:address) do
6-
Mongo::Address.new('127.0.0.1:27017')
6+
Mongo::Address.new(DEFAULT_ADDRESS)
77
end
88

99
let(:server) do

spec/mongo/auth/scram_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe Mongo::Auth::SCRAM do
44

55
let(:address) do
6-
Mongo::Address.new('127.0.0.1:27017')
6+
Mongo::Address.new(DEFAULT_ADDRESS)
77
end
88

99
let(:server) do

spec/mongo/auth/x509_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe Mongo::Auth::X509 do
44

55
let(:address) do
6-
Mongo::Address.new('127.0.0.1:27017')
6+
Mongo::Address.new(DEFAULT_ADDRESS)
77
end
88

99
let(:server) do

spec/mongo/database_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
pending 'raises an exception' # 2.6
134134
end
135135

136-
context 'when the user is not authorized' do
136+
context 'when the user is not authorized', unless: sharded? do
137137

138138
let(:database) do
139139
described_class.new(unauthorized_client, TEST_DB)
@@ -177,7 +177,7 @@
177177
described_class.new(client, TEST_DB, client.options)
178178
end
179179

180-
it 'uses that read preference' do
180+
it 'uses that read preference', unless: sharded? do
181181
expect do
182182
database.command({ ping: 1 }, { read: read })
183183
end.to raise_error(Mongo::ServerSelector::NoServerAvailable)

spec/mongo/server/connection_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe Mongo::Server::Connection do
44

55
let(:address) do
6-
Mongo::Address.new('127.0.0.1:27017')
6+
Mongo::Address.new(DEFAULT_ADDRESS)
77
end
88

99
let(:server) do

spec/mongo/server/monitor_spec.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe Mongo::Server::Monitor do
44

55
let(:address) do
6-
Mongo::Address.new('127.0.0.1:27017')
6+
Mongo::Address.new(DEFAULT_ADDRESS)
77
end
88

99
let(:listeners) do
@@ -22,9 +22,17 @@
2222
monitor.scan!
2323
end
2424

25-
it 'updates the server description' do
25+
it 'updates the server description', if: standalone? do
2626
expect(monitor.description).to be_standalone
2727
end
28+
29+
it 'updates the server description', if: replica_set? do
30+
expect(monitor.description).to be_primary
31+
end
32+
33+
it 'updates the server description', if: sharded? do
34+
expect(monitor.description).to be_mongos
35+
end
2836
end
2937

3038
context 'when the ismaster command fails' do
@@ -51,7 +59,7 @@
5159
context 'when the socket gets an exception' do
5260

5361
let(:bad_address) do
54-
Mongo::Address.new('127.0.0.1:27017')
62+
Mongo::Address.new(DEFAULT_ADDRESS)
5563
end
5664

5765
let(:monitor) do

0 commit comments

Comments
 (0)