Commit 5e8a2506 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'use_string_host_for_db_load_balancing' into 'master'

DB load balancing: Use string instead of IPAddr

See merge request gitlab-org/gitlab-ee!16030
parents 0896218d 4fc2acf0
......@@ -174,7 +174,7 @@ module Gitlab
address = srv_resolver.address_for(r.host.to_s)
next unless address
Address.new(address, r.port)
Address.new(address.to_s, r.port)
end.compact
end
......
......@@ -175,8 +175,8 @@ describe Gitlab::Database::LoadBalancing::ServiceDiscovery do
context 'with an A record' do
let(:record_type) { 'A' }
let(:res1) { double(:resource, address: '255.255.255.0', ttl: 90) }
let(:res2) { double(:resource, address: '127.0.0.1', ttl: 90) }
let(:res1) { double(:resource, address: IPAddr.new('255.255.255.0'), ttl: 90) }
let(:res2) { double(:resource, address: IPAddr.new('127.0.0.1'), ttl: 90) }
it 'returns a TTL and ordered list of IP addresses' do
addresses = [
......@@ -198,8 +198,8 @@ describe Gitlab::Database::LoadBalancing::ServiceDiscovery do
before do
expect_next_instance_of(Gitlab::Database::LoadBalancing::SrvResolver) do |resolver|
allow(resolver).to receive(:address_for).with('foo1.service.consul.').and_return('255.255.255.0')
allow(resolver).to receive(:address_for).with('foo2.service.consul.').and_return('127.0.0.1')
allow(resolver).to receive(:address_for).with('foo1.service.consul.').and_return(IPAddr.new('255.255.255.0'))
allow(resolver).to receive(:address_for).with('foo2.service.consul.').and_return(IPAddr.new('127.0.0.1'))
allow(resolver).to receive(:address_for).with('foo3.service.consul.').and_return(nil)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment