inspec/test/unit/mock/cmd
Adam Leff c280e9a816 Fix host resolution on Darwin, use dig wherever possible (#1986)
* Fix host resolution on Darwin, use dig wherever possible

The `host` and `dig` commands do not return non-zero if a query returns NXDOMAIN
or NOERROR, but the DarwinHostProvider was expecting it when deciding whether to
fall back to IPv4 if a IPv6 query failed. Therefore, the `host` resource would
not function properly when resolving hostnames on Darwin. The logic has been
changed to use `dig` short output and query for both v6 and v4 addresses.

Additionally, the LinuxHostProvider has been modified to prefer `dig` if it's
available to keep behavior similar between Darwin and Linux whenever possible.
This has the added benefit of providing v6 and v4 resolution if possible where
`getent hosts` only returns v6 if v6 records exist.

Signed-off-by: Adam Leff <adam@leff.co>
2017-07-05 10:45:30 -04:00
..
$env-computername add unit tests 2016-09-09 12:43:03 +02:00
$env-PATH Add Windows support to the os_env resource 2015-11-19 15:41:00 +01:00
adsigroups implement filter table for group/groups resource 2016-09-23 00:53:24 +02:00
adsiusers fetch user groups while building user object 2017-04-20 16:02:21 +02:00
auditctl auditd_rules: unit tests, meet the real world 2016-02-09 11:51:52 +01:00
auditctl-legacy auditd_rules: teach old dog new tricks 2016-02-09 11:51:52 +01:00
auditctl-s auditd_rules: status querying (old/new) and unit tests 2016-02-09 11:51:52 +01:00
auditpol add unit test for audit_policy resource 2015-09-21 14:09:16 +02:00
bash -c type psql New postgres_ident_conf resource (#1963) 2017-07-03 20:01:40 +02:00
brew-info--json-v1-curl Mock 'brew info --json=v1 curl' to facilitate unit testing the package resource for the darwin platform 2017-01-02 17:57:20 +01:00
brew-info-jq add mock resources for package resource 2015-09-22 02:15:41 +02:00
chage-l-root return password expiry information for linux 2015-10-05 11:50:49 +02:00
crontab-foouser Adding new crontab resource 2017-02-10 09:33:31 -05:00
crontab-root Adding new crontab resource 2017-02-10 09:33:31 -05:00
crontab-special Support special cases for crontab resource 2017-06-06 15:12:12 +02:00
dig-A-example.com Fix host resolution on Darwin, use dig wherever possible (#1986) 2017-07-05 10:45:30 -04:00
dig-AAAA-example.com Fix host resolution on Darwin, use dig wherever possible (#1986) 2017-07-05 10:45:30 -04:00
docker-images Docker resource (#1566) 2017-04-24 10:47:03 -04:00
docker-info Docker resource (#1566) 2017-04-24 10:47:03 -04:00
docker-inspec Docker resource (#1566) 2017-04-24 10:47:03 -04:00
docker-ps-a Docker resource (#1566) 2017-04-24 10:47:03 -04:00
docker-version Docker resource (#1566) 2017-04-24 10:47:03 -04:00
dpkg-query-W Switch package resource to os.redhat detection and use two spaces as fileds delimited 2017-02-15 11:07:10 +00:00
dpkg-s-curl add mock resources for package resource 2015-09-22 02:15:41 +02:00
dscl add tests for user resource 2015-10-05 11:50:49 +02:00
env api: don't force root on os_env 2015-11-13 12:10:22 +01:00
etc-apt add test coverage for apt 2015-10-10 23:28:03 +02:00
find-apache2-conf-enabled [resources/apache_conf]: add tests, fix bug 2015-12-07 10:50:48 +01:00
find-apache2-conf-enabled-link Added unit tests for apache_conf inclusion of symlinked files. 2017-02-24 16:13:22 +11:00
find-apache2-ports-conf [resources/apache_conf]: add tests, fix bug 2015-12-07 10:50:48 +01:00
find-etc-rc-d-name-S rewrite systemv service implementation, read enabled services from rc 2015-09-25 12:58:03 +02:00
find-httpd-conf-enabled-link Added unit tests for apache_conf inclusion of symlinked files. 2017-02-24 16:13:22 +11:00
find-httpd-ssl-conf added unit tests 2016-09-02 21:55:28 -04:00
find-httpd-status-conf In ApacheConf#include_files, check for abs paths 2016-09-20 09:11:09 -04:00
find-net-interface introduce better network interface abstraction, add test cases 2015-10-08 13:01:50 +02:00
find-xinetd.d Fix xinetd parsing of services from the same file. Expose resource.protocols 2017-01-31 12:40:29 +00:00
gem-list-local-a-q-chef-sugar Extend gem to take an optional gem_binary 2017-03-24 22:28:42 -07:00
gem-list-local-a-q-json Extend gem to take an optional gem_binary 2017-03-24 22:28:42 -07:00
gem-list-local-a-q-knife-backup Extend gem to take an optional gem_binary 2017-03-24 22:28:42 -07:00
gem-list-local-a-q-not-installed Fix installed? check for gem resource 2017-05-22 15:34:01 -05:00
gem-list-local-a-q-pry Extend gem to take an optional gem_binary 2017-03-24 22:28:42 -07:00
gem-list-local-a-q-rubocop add gem resource to verify gem packages 2015-09-22 02:15:41 +02:00
get-item-property-package add unit test for new package resource 2016-08-24 14:40:26 +02:00
get-net-tcpconnection port resource support for Windows 2015-09-23 23:08:19 +02:00
Get-NetAdapter add windows support to network adapter 2015-10-08 13:01:50 +02:00
get-netadapter-binding-bridge add bridge unit tests for windows 2015-10-09 15:26:59 +02:00
get-package-firefox increase test coverage for oneget 2015-10-03 13:27:20 +02:00
get-package-ruby increase test coverage for oneget 2015-10-03 13:27:20 +02:00
get-process_processes Added windows support to the processes resource 2017-06-05 23:41:02 +01:00
get-service-dhcp add resource test for windows 2015-09-22 02:26:59 +02:00
get-windows-feature add unit tests for windows feature 2015-09-22 02:27:03 +02:00
get-wmiobject improve wmi resource 2016-06-19 23:40:45 +02:00
getent-hosts-example.com add linux tests for host 2015-10-09 19:27:29 +02:00
getent-passwd-jfolmer add unit tests for user resource that cover ldap groups 2015-11-24 18:35:10 +01:00
getent-passwd-root add tests for user resource 2015-10-05 11:50:49 +02:00
host-AAAA-example.com Add OSX support for host resource (#1608) 2017-04-13 11:32:04 -04:00
hostname add unit tests 2016-09-09 12:43:03 +02:00
hpux-netstat-inet prefixed hpux to cmd file name 2016-05-03 21:38:39 +05:30
hpux-netstat-inet6 prefixed hpux to cmd file name 2016-05-03 21:38:39 +05:30
id-chartmann add tests for user resource 2015-10-05 11:50:49 +02:00
id-jfolmer add unit tests for user resource that cover ldap groups 2015-11-24 18:35:10 +01:00
id-root add tests for user resource 2015-10-05 11:50:49 +02:00
initctl--version upstart_service: add version mock for ubuntu 2016-02-05 13:49:18 +01:00
initctl-show-config-ssh add service unit tests for ubuntu 14.04 2015-09-25 11:52:33 +02:00
initctl-status-ssh add service unit tests for ubuntu 14.04 2015-09-25 11:52:33 +02:00
iptables-s iptables unit test: add comment examples 2016-02-10 09:57:32 +01:00
launchctl-list improve service handling for mac and add unit tests 2015-09-25 12:51:12 +02:00
logins-x added hpux user and package resource support 2016-04-21 14:01:56 +05:30
ls-1-etc-init.d rewrite systemv service implementation, read enabled services from rc 2015-09-25 12:58:03 +02:00
ls-sys-class-net-br add bridge test for linux 2015-10-09 15:07:58 +02:00
lsmod kernel_module resource: added blacklisting, enabled, disabled, docs and unit tests (#1798) 2017-07-05 11:41:44 +02:00
lsof-nP-i-FpctPn formatted lsof mockup 2016-01-14 23:03:24 -05:00
modinfo-f-version-dhcp Add version method to kernel_module 2017-01-27 13:33:41 +03:00
modprobe-config kernel_module resource: added blacklisting, enabled, disabled, docs and unit tests (#1798) 2017-07-05 11:41:44 +02:00
mount add mount resource 2016-01-03 00:03:24 +01:00
mount-multiple handle mount results with multiple entries 2016-01-03 00:03:24 +01:00
mssql-getdate oracle_session and mssql_session improvement (#1857) 2017-06-29 11:01:32 -04:00
mssql-result oracle_session and mssql_session improvement (#1857) 2017-06-29 11:01:32 -04:00
mssql-sqlcmd oracle_session and mssql_session improvement (#1857) 2017-06-29 11:01:32 -04:00
nc-example-com Add TCP reachability support on Linux for host resource (#1915) 2017-06-09 18:18:51 +02:00
netstat-anbo-pipe-select-string-pattern.utf8 make netstat default for getting ports and get only listening ones 2016-08-12 16:02:56 +01:00
netstat-tulpen Fix port resource for invalid IP address in netstat output 2017-03-29 08:33:50 +02:00
npm-ls-g--json-bower add npm resource to verify gem packages 2015-09-22 02:15:41 +02:00
oracle-cmd oracle_session and mssql_session improvement (#1857) 2017-06-29 11:01:32 -04:00
oracle-result oracle_session and mssql_session improvement (#1857) 2017-06-29 11:01:32 -04:00
pacman-qi-curl rename pacman mock file 2015-09-23 23:30:31 +02:00
ping-example.com add linux tests for host 2015-10-09 19:27:29 +02:00
pip-show-jinja2 add pip resource to verify gem packages 2015-09-22 02:15:41 +02:00
pkg-info-system-file-system-zfs add unit tests 2016-01-28 18:30:38 +01:00
pkginfo-l-SUNWzfsr add unit tests 2016-01-28 18:30:38 +01:00
ps-axo use command instead of comm and set user column width on linux 2016-10-17 15:39:13 +01:00
ps-axoZ add testcase for #1332 2016-11-30 13:25:44 +09:00
psql-version New postgres_ident_conf resource (#1963) 2017-07-03 20:01:40 +02:00
pw-usershow-root-7 add tests for user resource 2015-10-05 11:50:49 +02:00
reg_schedule update mock command for registry key 2015-11-17 22:28:11 +01:00
Resolve-DnsName add mock files for host windows tests 2015-10-09 19:27:07 +02:00
rpm-qa-queryformat Switch package resource to os.redhat detection and use two spaces as fileds delimited 2017-02-15 11:07:10 +00:00
rpm-qia-curl add mock resources for package resource 2015-09-22 02:15:41 +02:00
s11-netstat-an-finet-finet6 add unit tests 2016-01-28 18:30:38 +01:00
sbin_sysctl add tests 2015-09-22 02:27:04 +02:00
schtasks-error Added unit tests, only took most of the night :) 2016-11-20 20:07:59 +00:00
schtasks-success Added unit tests, only took most of the night :) 2016-11-20 20:07:59 +00:00
secedit-export implement security policy resource tests 2015-09-21 13:51:43 +02:00
service-e add unit tests for freebsd service resource 2015-09-25 12:53:40 +02:00
service-sendmail-onestatus add unit tests for freebsd service resource 2015-09-25 12:53:40 +02:00
service-sshd-status rewrite systemv service implementation, read enabled services from rc 2015-09-25 12:58:03 +02:00
sockstat add sockstat mock result 2015-09-23 23:15:37 +02:00
success implement security policy resource tests 2015-09-21 13:51:43 +02:00
swlist-l-product added hpux user and package resource support 2016-04-21 14:01:56 +05:30
systemctl-show-all-dbus Add 'static' value as enabled to systemd service enabled check 2016-04-13 14:44:28 -05:00
systemctl-show-all-sshd check service running by ActiveState 2016-07-06 12:57:04 +02:00
Test-NetConnection Add TCP reachability support on Linux for host resource (#1915) 2017-06-09 18:18:51 +02:00
type-nc Add TCP reachability support on Linux for host resource (#1915) 2017-06-09 18:18:51 +02:00
yum-repolist-all implement yum resource 2015-09-22 01:10:56 +02:00
zfs-get-all-tank-tmp Add FreeBSD support for ZFS datasets and pools 2017-02-22 10:29:49 -07:00
zpool-get-all-tank Add FreeBSD support for ZFS datasets and pools 2017-02-22 10:29:49 -07:00