summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Yudin <pyudin@parallels.com>2014-07-20 18:38:53 +0400
committerPavel Yudin <pyudin@parallels.com>2014-07-20 18:38:53 +0400
commit250611d17b1c70634f08e432283bea3fd7ec4544 (patch)
tree4893e8372e2caefe5f0473967183837203ff4624
parent40dc98645356dbea59fb268f92751163fa3941b6 (diff)
downloadohai-250611d17b1c70634f08e432283bea3fd7ec4544.tar.gz
Fix tests.
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index defe8836..a148ecf9 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -35,6 +35,7 @@ describe Ohai::System, "Linux plugin platform" do
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
@@ -295,6 +296,41 @@ describe Ohai::System, "Linux plugin platform" do
@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