Skip to content

Commit

Permalink
Merge pull request #601 from haus/maint/stable/fix_virtual_specs
Browse files Browse the repository at this point in the history
(maint) Update virtual spec to match dmidecode invocation
  • Loading branch information
Kylo Ginsberg committed Jan 13, 2014
2 parents 28c0bec + b72da8b commit 09e6d1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion spec/unit/util/virtual_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

it "should identify kvm" do
Facter::Util::Virtual.stubs(:kvm?).returns(true)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("something")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("something")
Facter::Util::Virtual.kvm_type().should == "kvm"
end

Expand Down
24 changes: 12 additions & 12 deletions spec/unit/virtual_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

it "should be vmware with VMWare vendor name from dmidecode" do
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
Facter.fact(:virtual).value.should == "vmware"
end

Expand All @@ -134,33 +134,33 @@

it "should be xenhvm with Xen HVM vendor name from dmidecode" do
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("System Information\nManufacturer: Xen\nProduct Name: HVM domU")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("System Information\nManufacturer: Xen\nProduct Name: HVM domU")
Facter.fact(:virtual).value.should == "xenhvm"
end

it "should be parallels with Parallels vendor name from dmidecode" do
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("On Board Device Information\nType: Video\nStatus: Disabled\nDescription: Parallels Video Adapter")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device Information\nType: Video\nStatus: Disabled\nDescription: Parallels Video Adapter")
Facter.fact(:virtual).value.should == "parallels"
end

it "should be virtualbox with VirtualBox vendor name from dmidecode" do
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("BIOS Information\nVendor: innotek GmbH\nVersion: VirtualBox\n\nSystem Information\nManufacturer: innotek GmbH\nProduct Name: VirtualBox\nFamily: Virtual Machine")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("BIOS Information\nVendor: innotek GmbH\nVersion: VirtualBox\n\nSystem Information\nManufacturer: innotek GmbH\nProduct Name: VirtualBox\nFamily: Virtual Machine")
Facter.fact(:virtual).value.should == "virtualbox"
end

it "should be rhev with RHEV Hypervisor product name from dmidecode" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("Product Name: RHEV Hypervisor")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("Product Name: RHEV Hypervisor")
Facter.fact(:virtual).value.should == "rhev"
end

it "should be ovirt with oVirt Node product name from dmidecode" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("Product Name: oVirt Node")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("Product Name: oVirt Node")
Facter.fact(:virtual).value.should == "ovirt"
end

Expand All @@ -171,7 +171,7 @@

it "should be hyperv with Microsoft vendor name from dmidecode" do
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("System Information\nManufacturer: Microsoft Corporation\nProduct Name: Virtual Machine")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("System Information\nManufacturer: Microsoft Corporation\nProduct Name: Virtual Machine")
Facter.fact(:virtual).value.should == "hyperv"
end

Expand Down Expand Up @@ -208,7 +208,7 @@

it "(#20236) is vmware when dmidecode contains vmware and lspci returns insufficient information" do
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("garbage\ninformation\n")
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
Facter.fact(:virtual).value.should eq("vmware")
end
end
Expand All @@ -222,23 +222,23 @@
it "should be vmware with VMWare vendor name from prtdiag" do
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: VMware, Inc. VMware Virtual Platform")
Facter.fact(:virtual).value.should == "vmware"
end

it "should be parallels with Parallels vendor name from prtdiag" do
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: Parallels Virtual Platform")
Facter.fact(:virtual).value.should == "parallels"
end

it "should be virtualbox with VirtualBox vendor name from prtdiag" do
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: innotek GmbH VirtualBox")
Facter.fact(:virtual).value.should == "virtualbox"
end
Expand All @@ -250,7 +250,7 @@
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
end

it "should be parallels with Parallels product name from sysctl" do
Expand Down

0 comments on commit 09e6d1c

Please sign in to comment.