spec/unit/virtual_spec.rb in facter-1.7.4 vs spec/unit/virtual_spec.rb in facter-1.7.5.rc1
- old
+ new
@@ -106,11 +106,11 @@
Facter.fact(:virtual).value.should == "virtualbox"
end
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
it "should be xen0 with xen dom0 files in /proc" do
Facter.fact(:hardwaremodel).stubs(:value).returns("i386")
@@ -132,48 +132,48 @@
Facter.fact(:virtual).value.should == "xenhvm"
end
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
it "should be hyperv with Microsoft vendor name from lspci 2>/dev/null" do
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA")
Facter.fact(:virtual).value.should == "hyperv"
end
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
context "In Google Compute Engine" do
before :each do
@@ -206,11 +206,11 @@
end
end
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
describe "on Solaris" do
@@ -220,27 +220,27 @@
end
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
end
@@ -248,10 +248,10 @@
before do
Facter::Util::Resolution.stubs(:exec).with("vmware -v").returns false
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
Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("Parallels Virtual Platform")
Facter.fact(:virtual).value.should == "parallels"