add tests for windows

This commit is contained in:
Christoph Hartmann 2015-10-09 19:21:55 +02:00
parent f4ed4cf7f5
commit 80b38412e6
2 changed files with 27 additions and 1 deletions

View file

@ -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

View 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