minor system test cleanups

This commit is contained in:
Joshua Hoblitt 2013-11-13 20:28:27 -07:00
parent c852dc22d7
commit 4ee4be00ac
7 changed files with 37 additions and 30 deletions

View file

@ -56,7 +56,7 @@ describe 'basic concat test' do
end end
context 'owner/group root' do context 'owner/group root' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': concat { '/tmp/concat/file':
owner => 'root', owner => 'root',
group => 'root', group => 'root',
@ -74,7 +74,7 @@ describe 'basic concat test' do
content => '2', content => '2',
order => '02', order => '02',
} }
" EOS
it_behaves_like 'successfully_applied', pp it_behaves_like 'successfully_applied', pp

View file

@ -13,75 +13,75 @@ describe 'deprecation warnings' do
end end
context 'concat gnu parameter' do context 'concat gnu parameter' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': concat { '/tmp/concat/file':
gnu => 'foo', gnu => 'foo',
} }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/concat/file', target => '/tmp/concat/file',
} }
" EOS
w = 'The $gnu parameter to concat is deprecated and has no effect' w = 'The $gnu parameter to concat is deprecated and has no effect'
it_behaves_like 'has_warning', pp, w it_behaves_like 'has_warning', pp, w
end end
context 'concat::fragment mode parameter' do context 'concat::fragment mode parameter' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/concat/file', target => '/tmp/concat/file',
mode => 'bar', mode => 'bar',
} }
" EOS
w = 'The $mode parameter to concat::fragment is deprecated and has no effect' w = 'The $mode parameter to concat::fragment is deprecated and has no effect'
it_behaves_like 'has_warning', pp, w it_behaves_like 'has_warning', pp, w
end end
context 'concat::fragment owner parameter' do context 'concat::fragment owner parameter' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/concat/file', target => '/tmp/concat/file',
owner => 'bar', owner => 'bar',
} }
" EOS
w = 'The $owner parameter to concat::fragment is deprecated and has no effect' w = 'The $owner parameter to concat::fragment is deprecated and has no effect'
it_behaves_like 'has_warning', pp, w it_behaves_like 'has_warning', pp, w
end end
context 'concat::fragment group parameter' do context 'concat::fragment group parameter' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/concat/file', target => '/tmp/concat/file',
group => 'bar', group => 'bar',
} }
" EOS
w = 'The $group parameter to concat::fragment is deprecated and has no effect' w = 'The $group parameter to concat::fragment is deprecated and has no effect'
it_behaves_like 'has_warning', pp, w it_behaves_like 'has_warning', pp, w
end end
context 'concat::fragment backup parameter' do context 'concat::fragment backup parameter' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/concat/file', target => '/tmp/concat/file',
backup => 'bar', backup => 'bar',
} }
" EOS
w = 'The $backup parameter to concat::fragment is deprecated and has no effect' w = 'The $backup parameter to concat::fragment is deprecated and has no effect'
it_behaves_like 'has_warning', pp, w it_behaves_like 'has_warning', pp, w
end end
context 'include concat::setup' do context 'include concat::setup' do
pp=" pp = <<-EOS
include concat::setup include concat::setup
" EOS
w = 'concat::setup is deprecated as a public API of the concat module and should no longer be directly included in the manifest.' w = 'concat::setup is deprecated as a public API of the concat module and should no longer be directly included in the manifest.'
it_behaves_like 'has_warning', pp, w it_behaves_like 'has_warning', pp, w

View file

@ -2,14 +2,14 @@ require 'spec_helper_system'
describe 'basic concat test' do describe 'basic concat test' do
context 'should run successfully' do context 'should run successfully' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': concat { '/tmp/concat/file':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
force => true, force => true,
} }
" EOS
context puppet_apply(pp) do context puppet_apply(pp) do
its(:stderr) { should be_empty } its(:stderr) { should be_empty }

View file

@ -2,14 +2,15 @@ require 'spec_helper_system'
describe 'concat::fragment source lists ' do describe 'concat::fragment source lists ' do
context 'should create files containing first match only.' do context 'should create files containing first match only.' do
file1_contents="file1 contents" let(:file1_contents) { 'file1 contents' }
file2_contents="file2 contents" let(:file2_contents) { 'file2 contents' }
before(:all) do before(:all) do
shell("/bin/echo '#{file1_contents}' > /tmp/concat/file1") shell("/bin/echo '#{file1_contents}' > /tmp/concat/file1")
shell("/bin/echo '#{file2_contents}' > /tmp/concat/file2") shell("/bin/echo '#{file2_contents}' > /tmp/concat/file2")
end end
pp="
pp = <<-EOS
concat { '/tmp/concat/result_file1': concat { '/tmp/concat/result_file1':
owner => root, owner => root,
group => root, group => root,
@ -41,7 +42,8 @@ describe 'concat::fragment source lists ' do
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ], source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
order => '01', order => '01',
} }
" EOS
context puppet_apply(pp) do context puppet_apply(pp) do
its(:stderr) { should be_empty } its(:stderr) { should be_empty }
its(:exit_code) { should_not == 1 } its(:exit_code) { should_not == 1 }
@ -70,7 +72,8 @@ describe 'concat::fragment source lists ' do
before(:all) do before(:all) do
shell("/bin/rm /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither") shell("/bin/rm /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither")
end end
pp="
pp = <<-EOS
concat { '/tmp/concat/fail_no_source': concat { '/tmp/concat/fail_no_source':
owner => root, owner => root,
group => root, group => root,
@ -82,7 +85,8 @@ describe 'concat::fragment source lists ' do
source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ], source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ],
order => '01', order => '01',
} }
" EOS
context puppet_apply(pp) do context puppet_apply(pp) do
its(:exit_code) { should_not be_zero } its(:exit_code) { should_not be_zero }
its(:exit_code) { should_not == 1 } its(:exit_code) { should_not == 1 }

View file

@ -2,9 +2,12 @@ require 'spec_helper_system'
describe 'file should not replace' do describe 'file should not replace' do
shell('echo "file exists" >> /tmp/concat/file') before(:all) do
shell('echo "file exists" > /tmp/concat/file')
end
context 'should fail' do context 'should fail' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': concat { '/tmp/concat/file':
owner => root, owner => root,
group => root, group => root,
@ -23,7 +26,7 @@ describe 'file should not replace' do
content => '2', content => '2',
order => '02', order => '02',
} }
" EOS
context puppet_apply(pp) do context puppet_apply(pp) do
its(:stderr) { should be_empty } its(:stderr) { should be_empty }

View file

@ -1,7 +1,7 @@
require 'spec_helper_system' require 'spec_helper_system'
describe 'symbolic name' do describe 'symbolic name' do
pp=" pp = <<-EOS
concat { 'not_abs_path': concat { 'not_abs_path':
path => '/tmp/concat/file', path => '/tmp/concat/file',
} }
@ -17,7 +17,7 @@ describe 'symbolic name' do
content => '2', content => '2',
order => '02', order => '02',
} }
" EOS
context puppet_apply(pp) do context puppet_apply(pp) do
its(:stderr) { should be_empty } its(:stderr) { should be_empty }

View file

@ -2,7 +2,7 @@ require 'spec_helper_system'
describe 'basic concat test' do describe 'basic concat test' do
context 'should run successfully' do context 'should run successfully' do
pp=" pp = <<-EOS
concat { '/tmp/concat/file': concat { '/tmp/concat/file':
owner => root, owner => root,
group => root, group => root,
@ -21,7 +21,7 @@ describe 'basic concat test' do
content => '2', content => '2',
order => '02', order => '02',
} }
" EOS
context puppet_apply(pp) do context puppet_apply(pp) do
its(:stderr) { should be_empty } its(:stderr) { should be_empty }