spec/unit/plugins/linux/platform_spec.rb in ohai-7.4.1 vs spec/unit/plugins/linux/platform_spec.rb in ohai-7.6.0.rc.0
- old
+ new
@@ -33,10 +33,11 @@
File.stub(:exists?).with("/etc/arch-release").and_return(false)
File.stub(:exists?).with("/etc/system-release").and_return(false)
File.stub(:exists?).with("/etc/slackware-version").and_return(false)
File.stub(:exists?).with("/etc/enterprise-release").and_return(false)
File.stub(:exists?).with("/etc/oracle-release").and_return(false)
+ File.stub(:exists?).with("/etc/parallels-release").and_return(false)
File.stub(:exists?).with("/usr/bin/raspi-config").and_return(false)
end
describe "on lsb compliant distributions" do
before(:each) do
@@ -292,9 +293,44 @@
it "should read the platform as fedora and version as 13 using to_i" do
File.should_receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
@plugin.run
@plugin[:platform].should == "fedora"
@plugin[:platform_version].to_i.should == 13
+ end
+
+ end
+ end
+
+ describe "on pcs linux" do
+ describe "with lsb_result" do
+ it "should read the platform as parallels and version as 6.0.5" do
+ @plugin[:lsb][:id] = "CloudLinuxServer"
+ @plugin[:lsb][:release] = "6.5"
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
+ File.stub(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
+ File.should_receive(:exists?).with("/etc/parallels-release").and_return(true)
+ File.should_receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
+ @plugin.run
+ @plugin[:platform].should == "parallels"
+ @plugin[:platform_version].should == "6.0.5"
+ @plugin[:platform_family].should == "rhel"
+ end
+ end
+
+ describe "without lsb_results" do
+ before(:each) do
+ @plugin.lsb = nil
+ end
+
+ it "should read the platform as parallels and version as 6.0.5" do
+ File.stub(:exists?).with("/etc/redhat-release").and_return(true)
+ File.stub(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
+ File.should_receive(:exists?).with("/etc/parallels-release").and_return(true)
+ File.should_receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
+ @plugin.run
+ @plugin[:platform].should == "parallels"
+ @plugin[:platform_version].should == "6.0.5"
+ @plugin[:platform_family].should == "rhel"
end
end
end
describe "on oracle enterprise linux" do