mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
add tests for windows
This commit is contained in:
parent
f4ed4cf7f5
commit
80b38412e6
2 changed files with 27 additions and 1 deletions
|
@ -163,7 +163,9 @@ class MockLoader
|
|||
'ls -1 /sys/class/net/br0/brif/' => cmd.call('ls-sys-class-net-br'),
|
||||
# bridge on Windows
|
||||
'Get-NetAdapterBinding -ComponentID ms_bridge | Get-NetAdapter | Select-Object -Property Name, InterfaceDescription | ConvertTo-Json' => cmd.call('get-netadapter-binding-bridge'),
|
||||
|
||||
# host for Windows
|
||||
'Resolve-DnsName –Type A microsoft.com | ConvertTo-Json' => cmd.call('Resolve-DnsName'),
|
||||
'Test-NetConnection -ComputerName microsoft.com | Select-Object -Property ComputerName, PingSucceeded | ConvertTo-Json' => cmd.call('Test-NetConnection'),
|
||||
}
|
||||
|
||||
# set os emulation
|
||||
|
|
24
test/unit/resource_host_test.rb
Normal file
24
test/unit/resource_host_test.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
# encoding: utf-8
|
||||
# author: Christoph Hartmann
|
||||
# author: Dominik Richter
|
||||
|
||||
require 'helper'
|
||||
require 'vulcano/resource'
|
||||
|
||||
describe 'Vulcano::Resources::Host' do
|
||||
|
||||
it 'check host on windows' do
|
||||
resource = MockLoader.new(:windows).load_resource('host', 'microsoft.com')
|
||||
_(resource.resolvable?).must_equal true
|
||||
_(resource.reachable?).must_equal false
|
||||
_(resource.ipaddress).must_equal ['134.170.185.46', '134.170.188.221']
|
||||
end
|
||||
|
||||
it 'check host on unsupported os' do
|
||||
resource = MockLoader.new(:undefined).load_resource('host', 'example.com')
|
||||
_(resource.resolvable?).must_equal false
|
||||
_(resource.reachable?).must_equal false
|
||||
_(resource.ipaddress).must_equal nil
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue