add service unit tests for ubuntu 14.04

This commit is contained in:
Christoph Hartmann 2015-09-23 22:32:31 +02:00
parent 24885e2d4d
commit 1936383120
4 changed files with 16 additions and 0 deletions

View file

@ -104,6 +104,8 @@ class MockLoader
'netstat -tulpen' => cmd.call('netstat-tulpen'), 'netstat -tulpen' => cmd.call('netstat-tulpen'),
'sockstat -46l' => cmd.call('sockstat'), 'sockstat -46l' => cmd.call('sockstat'),
"Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq 'Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161'} | Select-Object -Property Name,Version,Vendor,PackageCode,Caption,Description | ConvertTo-Json" => cmd.call('win32_product'), "Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq 'Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161'} | Select-Object -Property Name,Version,Vendor,PackageCode,Caption,Description | ConvertTo-Json" => cmd.call('win32_product'),
'initctl status ssh' => cmd.call('initctl-status-ssh'),
'initctl show-config ssh' => cmd.call('initctl-show-config-ssh'),
} }
# set os emulation # set os emulation

View file

@ -0,0 +1,3 @@
ssh
start on (filesystem or runlevel [2345])
stop on runlevel [!2345]

View file

@ -0,0 +1 @@
ssh start/running, process 1291

View file

@ -14,6 +14,16 @@ describe 'Vulcano::Resources::Service' do
_(resource.enabled?).must_equal true _(resource.enabled?).must_equal true
_(resource.running?).must_equal true _(resource.running?).must_equal true
end end
# # ubuntu 14.04 with upstart
it 'verify ubuntu package parsing' do
resource = MockLoader.new(:ubuntu1404).load_resource('service', 'ssh')
srv = { name: 'ssh', description: '', installed: true, running: true, enabled: true, type: 'upstart' }
_(resource.info).must_equal srv
_(resource.installed?).must_equal true
_(resource.enabled?).must_equal true
_(resource.running?).must_equal true
end
# unknown OS # unknown OS
it 'verify package handling on unsupported os' do it 'verify package handling on unsupported os' do
resource = MockLoader.new(:undefined).load_resource('service', 'dhcp') resource = MockLoader.new(:undefined).load_resource('service', 'dhcp')