Skip to content

Commit 836ad5f

Browse files
authored
RUBY-2812 add custom srvServiceName prose test (#2403)
1 parent 10601c0 commit 836ad5f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

spec/integration/srv_monitoring_spec.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,5 +402,42 @@
402402
end
403403
end
404404
end
405+
406+
context 'when the client mocks the srvServiceName' do
407+
408+
let(:uri) do
409+
"mongodb+srv://test-fake.test.build.10gen.cc/?tls=#{SpecConfig.instance.ssl?}&tlsInsecure=true&srvServiceName=customname"
410+
end
411+
412+
it 'finds the records using the custom service name' do
413+
414+
rules = [
415+
['_customname._tcp.test-fake.test.build.10gen.cc', :srv,
416+
[0, 0, 27998, 'localhost.test.build.10gen.cc'],
417+
[0, 0, 27999, 'localhost.test.build.10gen.cc'],
418+
],
419+
]
420+
421+
mock_dns(rules) do
422+
15.times do
423+
address_strs = client.cluster.servers_list.map(&:address).map(&:seed).sort
424+
if address_strs == %w(
425+
localhost.test.build.10gen.cc:27998
426+
localhost.test.build.10gen.cc:27999
427+
)
428+
then
429+
break
430+
end
431+
sleep 1
432+
end
433+
434+
address_strs = client.cluster.servers_list.map(&:address).map(&:seed).sort
435+
expect(address_strs).to eq(%w(
436+
localhost.test.build.10gen.cc:27998
437+
localhost.test.build.10gen.cc:27999
438+
))
439+
end
440+
end
441+
end
405442
end
406443
end

0 commit comments

Comments
 (0)