diff options
| author | John Ferlito <johnf@inodes.org> | 2010-02-14 18:07:43 +1100 |
|---|---|---|
| committer | Paul Nasrat <pnasrat@googlemail.com> | 2010-03-08 22:45:21 +0000 |
| commit | 62b6773a63bb96273fbcb6f79bec524fb67df075 (patch) | |
| tree | 161713a1c697aed6e319a67638be17401e3285eb /spec/unit | |
| parent | dca615c98b864d75e2ac5899d98d04a2bd979eba (diff) | |
| download | facter-62b6773a63bb96273fbcb6f79bec524fb67df075.tar.gz facter-62b6773a63bb96273fbcb6f79bec524fb67df075.tar.xz facter-62b6773a63bb96273fbcb6f79bec524fb67df075.zip | |
Add kvm support to virtual fact
Based on initial patch by James Turnbull
Diffstat (limited to 'spec/unit')
| -rw-r--r-- | spec/unit/util/virtual.rb | 7 | ||||
| -rw-r--r-- | spec/unit/virtual.rb | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/unit/util/virtual.rb b/spec/unit/util/virtual.rb index 1f1c0f8..de339b8 100644 --- a/spec/unit/util/virtual.rb +++ b/spec/unit/util/virtual.rb @@ -93,4 +93,11 @@ describe Facter::Util::Virtual do FileTest.expects(:exists?).with("/proc/xen").returns(false) Facter::Util::Virtual.should_not be_xen end + + it "should detect kvm" do + FileTest.stubs(:exists?).with("/proc/cpuinfo").returns(true) + File.stubs(:read).with("/proc/cpuinfo").returns("model name : QEMU Virtual CPU version 0.9.1\n") + Facter::Util::Virtual.should be_kvm + end + end diff --git a/spec/unit/virtual.rb b/spec/unit/virtual.rb index cc72ffc..fe9988e 100644 --- a/spec/unit/virtual.rb +++ b/spec/unit/virtual.rb @@ -48,4 +48,10 @@ describe "is_virtual fact" do Facter.fact(:virtual).stubs(:value).returns("openvzve") Facter.fact(:is_virtual).value.should == true end + + it "should be true when running on kvm" do + Facter.fact(:virtual).stubs(:value).returns("kvm") + Facter.fact(:is_virtual).value.should == true + end + end |
