Skip to content

Commit

Permalink
Fixes DNS resolution to accept IPs as well
Browse files Browse the repository at this point in the history
This way, if an IP is given as parameter to resolve_domain_name, it gets an
IP back as return instead of an empty array.
  • Loading branch information
a9shdemelo committed Oct 5, 2018
1 parent b64b73a commit 56c7b0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/unit_tests_utils/internal_dns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ def self.resolv(hostname)
end

def self.resolve_domain_name(hostname)
`dig +short #{hostname} @#{nameserver_ip}`.strip.split("\n")
if self.valid_ips?([hostname])
return [hostname]
end

return `dig +short #{hostname} @#{nameserver_ip}`.strip.split("\n")
end

def self.host_addresses(hostnames, port)
Expand Down
4 changes: 2 additions & 2 deletions unit_tests_utils.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Gem::Specification.new do |s|
s.name = 'unit-tests-utils'
s.version = '1.4.0'
s.date = '2018-04-25'
s.version = '1.4.1'
s.date = '2018-10-05'
s.summary = 'Common unit tests utils'
s.description = 'This gems includes all resources needed for the a9s BOSH release unit tests.'
s.authors = ['Michael Lieser', 'Dennis Groß', 'Lucas Pinto']
Expand Down

0 comments on commit 56c7b0e

Please sign in to comment.