Created
August 12, 2014 08:13
-
-
Save Mahito/535b17e99c8e186eea4b to your computer and use it in GitHub Desktop.
Serverspec to xml file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'serverspec' | |
require 'nokogiri' | |
describe file('/etc/hadoop/hadoop-0.20.2/conf/mapred-site.xml') do | |
it { should be_file } | |
it do | |
doc = Nokogiri::Slop(subject.content) | |
doc.configuration.each do |property| | |
case property.name.content | |
when 'mapred.child.java.opts' | |
property.value.content.should eq '-Xmx1024m' | |
when 'mapred.map.tasks' | |
property.value.content.should eq '3' | |
when 'mapred.reduce.tasks' | |
property.value.content.should eq '1' | |
when 'mapred.tasktracker.map.tasks.maximum' | |
property.value.content.should eq '3' | |
when 'mapred.tasktracker.reduce.tasks.maximum' | |
property.value.content.should eq '1' | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment