Skip to content

Commit

Permalink
Adds skips for functionality not yet implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
cgranleese-r7 committed Feb 14, 2025
1 parent a2475a2 commit 39b7aa8
Showing 1 changed file with 40 additions and 19 deletions.
59 changes: 40 additions & 19 deletions test/modules/post/test/resolve_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,63 @@ def test_resolve_host
vprint_status('Starting resolve_host tests')

it 'should return a Hash' do
hostname = 'localhost'
hostname = 'google.com'
family = AF_INET
does_not_support_local_resolution = ['php']

resolved_host = resolve_host(hostname, family)
resolved_host.is_a?(Hash)
if does_not_support_local_resolution.include?(session.arch) && session.platform.eql?('windows') && hostname == 'localhost'
vprint_status("test skipped for #{session.arch} - local DNS resolution not available")
else
resolved_host = resolve_host(hostname, family)
resolved_host.is_a?(Hash)
end
end

it 'should return a valid IPV4 host' do
hostname = 'localhost'
hostname = 'google.com'
family = AF_INET
does_not_support_local_resolution = ['php']

resolved_host = resolve_host(hostname, family)
if resolved_host[:ips].empty?
false
if does_not_support_local_resolution.include?(session.arch) && session.platform.eql?('windows') && hostname == 'localhost'
vprint_status("test skipped for #{session.arch} - local DNS resolution not available")
else
matches = resolved_host[:ips].map do |ip|
!!(ip =~ Resolv::IPv4::Regex)
resolved_host = resolve_host(hostname, family)
if resolved_host[:ips].empty?
false
else
matches = resolved_host[:ips].map do |ip|
!!(ip =~ Resolv::IPv4::Regex)
end

matches.all?(true)
end

matches.all?(true)
end
end

it 'should return a valid IPV6 host' do
hostname = 'localhost'
hostname = 'google.com'
family = AF_INET6
does_not_support_ipv6_resolution = %w[python java x64 x86]
does_not_support_local_resolution = ['php']

resolved_host = resolve_host(hostname, family)
if resolved_host[:ips].empty?
false
print_status(session.arch)
print_status(session.platform)

if does_not_support_ipv6_resolution.include?(session.arch) && session.platform.eql?('windows')
vprint_status("test skipped for #{session.arch} - IPV6 DNS resolution not available")
elsif does_not_support_local_resolution.include?(session.arch) && session.platform.eql?('windows') && hostname == 'localhost'
vprint_status("test skipped for #{session.arch} - local DNS resolution not available")
else
matches = resolved_host[:ips].map do |ip|
!!(ip =~ Resolv::IPv6::Regex)
resolved_host = resolve_host(hostname, family)
if resolved_host[:ips].empty?
false
else
matches = resolved_host[:ips].map do |ip|
!!(ip =~ Resolv::IPv6::Regex)
end

matches.all?(true)
end

matches.all?(true)
end
end

Expand Down

0 comments on commit 39b7aa8

Please sign in to comment.