Skip to content

Commit

Permalink
Add new resource kvm
Browse files Browse the repository at this point in the history
  • Loading branch information
tohta committed May 17, 2017
1 parent 97f3d39 commit d514116
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/serverspec/helper/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Type
types = %w(
base bridge bond cgroup command cron default_gateway file fstab
group host iis_website iis_app_pool interface ipfilter ipnat
iptables ip6tables json_file kernel_module linux_kernel_parameter lxc
iptables ip6tables json_file kernel_module kvm linux_kernel_parameter lxc
mail_alias mysql_config package php_config port ppa process
routing_table selinux selinux_module service user yumrepo
windows_feature windows_hot_fix windows_registry_key
Expand Down
19 changes: 19 additions & 0 deletions lib/serverspec/type/kvm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Serverspec::Type
class Kvm < Base
def exists?
@runner.check_kvm_guest_exists(@name)
end

def running?
@runner.check_kvm_guest_is_running(@name)
end

def enabled?
@runner.check_kvm_guest_is_enabled(@name)
end

def to_s
'KVM'
end
end
end
15 changes: 15 additions & 0 deletions spec/type/linux/kvm_guest_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'

set :os, :family => 'linux'

describe kvm('ct01') do
it { should exist }
end

describe kvm('ct01') do
it { should be_running }
end

describe kvm('ct01') do
it { should be_enabled }
end

0 comments on commit d514116

Please sign in to comment.