Merge pull request #146 from cyberious/SpecinfraUpgrade

Fixes issues due to serverspec upgrade
This commit is contained in:
Morgan Haskel 2015-02-09 14:07:49 -08:00
commit 88676100ed
4 changed files with 92 additions and 86 deletions

View file

@ -19,10 +19,15 @@ group :development, :unit_tests do
gem 'simplecov', :require => false
gem 'puppet_facts', :require => false
gem 'json', :require => false
gem 'pry', :require => false
end
beaker_version = ENV['BEAKER_VERSION']
beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
group :system_tests do
if beaker_version
gem 'beaker', *location_for(beaker_version)
end
if beaker_rspec_version
gem 'beaker-rspec', *location_for(beaker_rspec_version)
else

View file

@ -23,10 +23,7 @@ describe 'ini_setting resource' do
describe file(path) do
it { should be_file }
#XXX Solaris 10 doesn't support multi-line grep
it("should contain #{content}", :unless => fact('osfamily') == 'Solaris') {
should contain(content)
}
its(:content) { should match content }
end
end
@ -72,13 +69,13 @@ describe 'ini_setting resource' do
apply_manifest(pp, :catch_changes => true)
end
it_behaves_like 'has_content', "#{tmpdir}/ini_setting.ini", pp, "four = five\n[one]\ntwo = three"
it_behaves_like 'has_content', "#{tmpdir}/ini_setting.ini", pp, /four = five\n\n\[one\]\ntwo = three/
end
context '=> absent for key/value' do
before :all do
if fact('osfamily') == 'Darwin'
shell("echo \"four = five\n[one]\ntwo = three\" > #{tmpdir}/ini_setting.ini")
shell("echo \"four = five[one]\ntwo = three\" > #{tmpdir}/ini_setting.ini")
else
shell("echo -e \"four = five\n[one]\ntwo = three\" > #{tmpdir}/ini_setting.ini")
end
@ -101,9 +98,11 @@ describe 'ini_setting resource' do
describe file("#{tmpdir}/ini_setting.ini") do
it { should be_file }
it { should contain('four = five') }
it { should contain('[one]') }
it { should_not contain('two = three') }
its(:content) {
should match /four = five/
should match /\[one\]/
should_not match /two = three/
}
end
end
@ -137,18 +136,20 @@ describe 'ini_setting resource' do
describe file("#{tmpdir}/ini_setting.ini") do
it { should be_file }
it { should_not contain('four = five') }
it { should contain('[one]') }
it { should contain('two = three') }
its(:content) {
should_not match /four = five/
should match /\[one\]/
should match /two = three/
}
end
end
end
describe 'section, setting, value parameters' do
{
"section => 'test', setting => 'foo', value => 'bar'," => "[test]\nfoo = bar",
"section => 'more', setting => 'baz', value => 'quux'," => "[more]\nbaz = quux",
"section => '', setting => 'top', value => 'level'," => "top = level",
"section => 'test', setting => 'foo', value => 'bar'," => /\[test\]\nfoo = bar/,
"section => 'more', setting => 'baz', value => 'quux'," => /\[more\]\nbaz = quux/,
"section => '', setting => 'top', value => 'level'," => /top = level/,
}.each do |parameter_list, content|
context parameter_list do
pp = <<-EOS
@ -202,7 +203,7 @@ describe 'ini_setting resource' do
}
EOS
it_behaves_like 'has_content', path, pp, "[one]\ntwo = three"
it_behaves_like 'has_content', path, pp, /\[one\]\ntwo = three/
end
end
@ -223,9 +224,9 @@ describe 'ini_setting resource' do
describe 'key_val_separator parameter' do
{
"" => "two = three",
"key_val_separator => '='," => "two=three",
"key_val_separator => ' = '," => "two = three",
"" => /two = three/,
"key_val_separator => '='," => /two=three/,
"key_val_separator => ' = '," => /two = three/,
}.each do |parameter, content|
context "with \"#{parameter}\" makes \"#{content}\"" do
pp = <<-EOS

View file

@ -23,7 +23,9 @@ describe 'ini_subsetting resource' do
describe file(path) do
it { should be_file }
it { should contain(content) }
its(:content) {
should match content
}
end
end
@ -73,9 +75,8 @@ describe 'ini_subsetting resource' do
describe file("#{tmpdir}/ini_subsetting.ini") do
it { should be_file }
#XXX Solaris 10 doesn't support multi-line grep
it("should contain [one]\nkey = alphabet betatrons", :unless => fact('osfamily') == 'Solaris') {
should contain("[one]\nkey = alphabet betatrons")
its(:content) {
should match /\[one\]\nkey = alphabet betatrons/
}
end
end
@ -106,22 +107,22 @@ describe 'ini_subsetting resource' do
describe file("#{tmpdir}/ini_subsetting.ini") do
it { should be_file }
it { should contain('[one]') }
it { should contain('key = betatrons') }
it { should_not contain('alphabet') }
its(:content) {
should match /\[one\]/
should match /key = betatrons/
should_not match /alphabet/
}
end
end
end
describe 'subsetting_separator' do
{
"" => "two = twinethree foobar",
#"subsetting_separator => ''," => "two = twinethreefoobar", # breaks regex
"subsetting_separator => ','," => "two = twinethree,foobar",
"subsetting_separator => ' '," => "two = twinethree foobar",
"subsetting_separator => ' == '," => "two = twinethree == foobar",
"subsetting_separator => '='," => "two = twinethree=foobar",
#"subsetting_separator => '---'," => "two = twinethree---foobar", # breaks regex
"" => /two = twinethree foobar/,
"subsetting_separator => ','," => /two = twinethree,foobar/,
"subsetting_separator => ' '," => /two = twinethree foobar/,
"subsetting_separator => ' == '," => /two = twinethree == foobar/,
"subsetting_separator => '='," => /two = twinethree=foobar/,
}.each do |parameter, content|
context "with \"#{parameter}\" makes \"#{content}\"" do
pp = <<-EOS
@ -152,10 +153,10 @@ describe 'ini_subsetting resource' do
describe 'quote_char' do
{
['-Xmx'] => 'args=""',
['-Xmx', '256m'] => 'args=-Xmx256m',
['-Xmx', '512m'] => 'args="-Xmx512m"',
['-Xms', '256m'] => 'args="-Xmx256m -Xms256m"',
['-Xmx'] => /args=""/,
['-Xmx', '256m'] => /args=-Xmx256m/,
['-Xmx', '512m'] => /args="-Xmx512m"/,
['-Xms', '256m'] => /args="-Xmx256m -Xms256m"/,
}.each do |parameter, content|
context %Q{with '#{parameter.first}' #{parameter.length > 1 ? '=> \'' << parameter[1] << '\'' : 'absent'} makes '#{content}'} do
path = File.join(tmpdir, 'ini_subsetting.ini')
@ -187,7 +188,9 @@ describe 'ini_subsetting resource' do
describe file("#{tmpdir}/ini_subsetting.ini") do
it { should be_file }
it { should contain(content) }
its(:content) {
should match content
}
end
end
end

View file

@ -6,7 +6,11 @@ unless ENV['RS_PROVISION'] == 'no'
# systems fail on windows and osx, and install via gem on other *nixes
foss_opts = {:default_action => 'gem_install'}
if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
if default.is_pe?; then
install_pe;
else
install_puppet(foss_opts);
end
hosts.each do |host|
if host['platform'] =~ /debian/
@ -27,16 +31,9 @@ RSpec.configure do |c|
c.before :suite do
# Install module and dependencies
hosts.each do |host|
if host['platform'] !~ /windows/i
copy_root_module_to(host, :source => proj_root, :module_name => 'inifile')
end
end
hosts.each do |host|
if host['platform'] =~ /windows/i
on host, puppet('plugin download')
end
end
end
c.treat_symbols_as_metadata_keys_with_true_values = true
end