File: host_spec.rb

package info (click to toggle)
ruby-specinfra 2.94.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,448 kB
  • sloc: ruby: 10,538; sh: 4; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'spec_helper'

property[:os] = nil
set :os, :family => 'freebsd'

describe get_command(:check_host_is_reachable, 'pink.unicorn.com', nil, 'tcp', 10) do 
  it { should eq "ping -t 10 -c 2 -n pink.unicorn.com"} 
end

describe get_command(:check_host_is_reachable, 'pink.unicorn.com', 53, 'udp', 66) do 
  it { should eq "nc -vvvvzu pink.unicorn.com 53 -w 66" } 
end

describe get_command(:get_host_ipaddress, 'pink.unicorn.com') do 
  it { should eq "getent hosts pink.unicorn.com | awk '{print $1; exit}'" }
end

describe get_command(:get_host_ipv4_address, 'pink.unicorn.com') do 
  it { should eq "getent hosts pink.unicorn.com | awk '$1 ~ /^[0-9.]+$/ {print $1}'" }
end 

describe get_command(:get_host_ipv6_address, 'pink.unicorn.com') do 
  it { should eq "getent hosts pink.unicorn.com | awk 'tolower($1) ~ /^[0-9a-f:]+$/ {print $1}'" }
end