Merge pull request #228 from mhaskel/moar_test_fixes

Windows fixes
This commit is contained in:
Travis Fields 2014-09-11 12:51:04 -07:00
commit 0f43e1a4bd
3 changed files with 19 additions and 13 deletions

View file

@ -5,27 +5,33 @@ when 'AIX'
username = 'root'
groupname = 'system'
scriptname = 'concatfragments.sh'
vardir = default['puppetvardir']
when 'Darwin'
username = 'root'
groupname = 'wheel'
scriptname = 'concatfragments.sh'
vardir = default['puppetvardir']
when 'windows'
username = 'Administrator'
groupname = 'Administrators'
scriptname = 'concatfragments.rb'
result = on default, "echo #{default['puppetvardir']}"
vardir = result.raw_output.chomp
when 'Solaris'
username = 'root'
groupname = 'root'
scriptname = 'concatfragments.rb'
vardir = default['puppetvardir']
else
username = 'root'
groupname = 'root'
scriptname = 'concatfragments.sh'
vardir = default['puppetvardir']
end
describe 'basic concat test' do
basedir = default.tmpdir('concat')
safe_basedir = basedir.gsub('/','_')
safe_basedir = basedir.gsub(/[\/:]/,'_')
shared_examples 'successfully_applied' do |pp|
it 'applies the manifest twice with no stderr' do
@ -33,49 +39,49 @@ describe 'basic concat test' do
apply_manifest(pp, :catch_changes => true)
end
describe file("#{default['puppetvardir']}/concat") do
describe file("#{vardir}/concat") do
it { should be_directory }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 755
}
end
describe file("#{default['puppetvardir']}/concat/bin") do
describe file("#{vardir}/concat/bin") do
it { should be_directory }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 755
}
end
describe file("#{default['puppetvardir']}/concat/bin/#{scriptname}") do
describe file("#{vardir}/concat/bin/#{scriptname}") do
it { should be_file }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 755
}
end
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file") do
describe file("#{vardir}/concat/#{safe_basedir}_file") do
it { should be_directory }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 750
}
end
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments") do
describe file("#{vardir}/concat/#{safe_basedir}_file/fragments") do
it { should be_directory }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 750
}
end
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat") do
describe file("#{vardir}/concat/#{safe_basedir}_file/fragments.concat") do
it { should be_file }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 640
}
end
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat.out") do
describe file("#{vardir}/concat/#{safe_basedir}_file/fragments.concat.out") do
it { should be_file }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
@ -125,14 +131,14 @@ describe 'basic concat test' do
it { should contain '1' }
it { should contain '2' }
end
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/01_1") do
describe file("#{vardir}/concat/#{safe_basedir}_file/fragments/01_1") do
it { should be_file }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 640
}
end
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments/02_2") do
describe file("#{vardir}/concat/#{safe_basedir}_file/fragments/02_2") do
it { should be_file }
it { should be_owned_by username }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {

View file

@ -104,7 +104,7 @@ describe 'deprecation warnings' do
it { should contain 'file1 contents' }
end
describe 'the fragment can be changed from a symlink to a plain file' do
describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact("osfamily") == "windows") do
pp = <<-EOS
concat { '#{basedir}/file': }
concat::fragment { 'foo':
@ -142,7 +142,7 @@ describe 'deprecation warnings' do
it { should be_file }
end
describe 'the fragment can be changed from a symlink to a plain file' do
describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact('osfamily') == 'windows') do
pp = <<-EOS
concat { '#{basedir}/file': }
concat::fragment { 'foo':

View file

@ -86,7 +86,7 @@ describe 'replacement of' do
end
end # file
context 'symlink' do
context 'symlink', :unless => (fact("osfamily") == "windows") do
context 'should not succeed' do
# XXX the core puppet file type will replace a symlink with a plain file
# when using ensure => present and source => ... but it will not when using