Merge pull request #105 from jhoblitt/system_test_isolation

clean up between system spec files
This commit is contained in:
Ashley Penney 2013-11-14 09:58:53 -08:00
commit f9edb94b20
8 changed files with 64 additions and 57 deletions

View file

@ -23,4 +23,11 @@ RSpec.configure do |c|
puppet_module_install(:source => proj_root, :module_name => 'concat') puppet_module_install(:source => proj_root, :module_name => 'concat')
shell('puppet module install puppetlabs-stdlib') shell('puppet module install puppetlabs-stdlib')
end end
c.before(:all) do
shell('mkdir -p /tmp/concat')
end
c.after(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
end
end end

View file

@ -29,25 +29,25 @@ describe 'basic concat test' do
#it { should be_grouped_into 'root' } #it { should be_grouped_into 'root' }
it { should be_mode 755 } it { should be_mode 755 }
end end
describe file('/var/lib/puppet/concat/_tmp_file') do describe file('/var/lib/puppet/concat/_tmp_concat_file') do
it { should be_directory } it { should be_directory }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
it { should be_mode 750 } it { should be_mode 750 }
end end
describe file('/var/lib/puppet/concat/_tmp_file/fragments') do describe file('/var/lib/puppet/concat/_tmp_concat_file/fragments') do
it { should be_directory } it { should be_directory }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
it { should be_mode 750 } it { should be_mode 750 }
end end
describe file('/var/lib/puppet/concat/_tmp_file/fragments.concat') do describe file('/var/lib/puppet/concat/_tmp_concat_file/fragments.concat') do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
it { should be_mode 640 } it { should be_mode 640 }
end end
describe file('/var/lib/puppet/concat/_tmp_file/fragments.concat.out') do describe file('/var/lib/puppet/concat/_tmp_concat_file/fragments.concat.out') do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
@ -57,20 +57,20 @@ describe 'basic concat test' do
context 'owner/group root' do context 'owner/group root' do
pp=" pp="
concat { '/tmp/file': concat { '/tmp/concat/file':
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => '0644', mode => '0644',
} }
concat::fragment { '1': concat::fragment { '1':
target => '/tmp/file', target => '/tmp/concat/file',
content => '1', content => '1',
order => '01', order => '01',
} }
concat::fragment { '2': concat::fragment { '2':
target => '/tmp/file', target => '/tmp/concat/file',
content => '2', content => '2',
order => '02', order => '02',
} }
@ -78,7 +78,7 @@ describe 'basic concat test' do
it_behaves_like 'successfully_applied', pp it_behaves_like 'successfully_applied', pp
describe file('/tmp/file') do describe file('/tmp/concat/file') do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
@ -86,13 +86,13 @@ describe 'basic concat test' do
it { should contain '1' } it { should contain '1' }
it { should contain '2' } it { should contain '2' }
end end
describe file('/var/lib/puppet/concat/_tmp_file/fragments/01_1') do describe file('/var/lib/puppet/concat/_tmp_concat_file/fragments/01_1') do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
it { should be_mode 640 } it { should be_mode 640 }
end end
describe file('/var/lib/puppet/concat/_tmp_file/fragments/02_2') do describe file('/var/lib/puppet/concat/_tmp_concat_file/fragments/02_2') do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
@ -107,20 +107,20 @@ describe 'basic concat test' do
end end
pp=" pp="
concat { '/tmp/file': concat { '/tmp/concat/file':
owner => 'bob', owner => 'bob',
group => 'bob', group => 'bob',
mode => '0644', mode => '0644',
} }
concat::fragment { '1': concat::fragment { '1':
target => '/tmp/file', target => '/tmp/concat/file',
content => '1', content => '1',
order => '01', order => '01',
} }
concat::fragment { '2': concat::fragment { '2':
target => '/tmp/file', target => '/tmp/concat/file',
content => '2', content => '2',
order => '02', order => '02',
} }
@ -128,7 +128,7 @@ describe 'basic concat test' do
it_behaves_like 'successfully_applied', pp it_behaves_like 'successfully_applied', pp
describe file('/tmp/file') do describe file('/tmp/concat/file') do
it { should be_file } it { should be_file }
it { should be_owned_by 'bob' } it { should be_owned_by 'bob' }
it { should be_grouped_into 'bob' } it { should be_grouped_into 'bob' }
@ -136,14 +136,14 @@ describe 'basic concat test' do
it { should contain '1' } it { should contain '1' }
it { should contain '2' } it { should contain '2' }
end end
describe file('/var/lib/puppet/concat/_tmp_file/fragments/01_1') do describe file('/var/lib/puppet/concat/_tmp_concat_file/fragments/01_1') do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
it { should be_mode 640 } it { should be_mode 640 }
it { should contain '1' } it { should contain '1' }
end end
describe file('/var/lib/puppet/concat/_tmp_file/fragments/02_2') do describe file('/var/lib/puppet/concat/_tmp_concat_file/fragments/02_2') do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }

View file

@ -14,11 +14,11 @@ describe 'deprecation warnings' do
context 'concat gnu parameter' do context 'concat gnu parameter' do
pp=" pp="
concat { '/tmp/file': concat { '/tmp/concat/file':
gnu => 'foo', gnu => 'foo',
} }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/file', target => '/tmp/concat/file',
} }
" "
w = 'The $gnu parameter to concat is deprecated and has no effect' w = 'The $gnu parameter to concat is deprecated and has no effect'
@ -28,9 +28,9 @@ describe 'deprecation warnings' do
context 'concat::fragment mode parameter' do context 'concat::fragment mode parameter' do
pp=" pp="
concat { '/tmp/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/file', target => '/tmp/concat/file',
mode => 'bar', mode => 'bar',
} }
" "
@ -41,9 +41,9 @@ describe 'deprecation warnings' do
context 'concat::fragment owner parameter' do context 'concat::fragment owner parameter' do
pp=" pp="
concat { '/tmp/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/file', target => '/tmp/concat/file',
owner => 'bar', owner => 'bar',
} }
" "
@ -54,9 +54,9 @@ describe 'deprecation warnings' do
context 'concat::fragment group parameter' do context 'concat::fragment group parameter' do
pp=" pp="
concat { '/tmp/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/file', target => '/tmp/concat/file',
group => 'bar', group => 'bar',
} }
" "
@ -67,9 +67,9 @@ describe 'deprecation warnings' do
context 'concat::fragment backup parameter' do context 'concat::fragment backup parameter' do
pp=" pp="
concat { '/tmp/file': } concat { '/tmp/concat/file': }
concat::fragment { 'foo': concat::fragment { 'foo':
target => '/tmp/file', target => '/tmp/concat/file',
backup => 'bar', backup => 'bar',
} }
" "

View file

@ -3,7 +3,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="
concat { '/tmp/file': concat { '/tmp/concat/file':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
@ -19,7 +19,7 @@ describe 'basic concat test' do
its(:exit_code) { should be_zero } its(:exit_code) { should be_zero }
end end
describe file('/tmp/file') do describe file('/tmp/concat/file') do
it { should be_file } it { should be_file }
it { should_not contain '1\n2' } it { should_not contain '1\n2' }
end end

View file

@ -5,40 +5,40 @@ describe 'concat::fragment source lists ' do
file1_contents="file1 contents" file1_contents="file1 contents"
file2_contents="file2 contents" file2_contents="file2 contents"
before(:all) do before(:all) do
shell("/bin/echo '#{file1_contents}' > /tmp/file1") shell("/bin/echo '#{file1_contents}' > /tmp/concat/file1")
shell("/bin/echo '#{file2_contents}' > /tmp/file2") shell("/bin/echo '#{file2_contents}' > /tmp/concat/file2")
end end
pp=" pp="
concat { '/tmp/result_file1': concat { '/tmp/concat/result_file1':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
} }
concat { '/tmp/result_file2': concat { '/tmp/concat/result_file2':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
} }
concat { '/tmp/result_file3': concat { '/tmp/concat/result_file3':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
} }
concat::fragment { '1': concat::fragment { '1':
target => '/tmp/result_file1', target => '/tmp/concat/result_file1',
source => [ '/tmp/file1', '/tmp/file2' ], source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
order => '01', order => '01',
} }
concat::fragment { '2': concat::fragment { '2':
target => '/tmp/result_file2', target => '/tmp/concat/result_file2',
source => [ '/tmp/file2', '/tmp/file1' ], source => [ '/tmp/concat/file2', '/tmp/concat/file1' ],
order => '01', order => '01',
} }
concat::fragment { '3': concat::fragment { '3':
target => '/tmp/result_file3', target => '/tmp/concat/result_file3',
source => [ '/tmp/file1', '/tmp/file2' ], source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
order => '01', order => '01',
} }
" "
@ -49,17 +49,17 @@ describe 'concat::fragment source lists ' do
its(:stderr) { should be_empty } its(:stderr) { should be_empty }
its(:exit_code) { should be_zero } its(:exit_code) { should be_zero }
end end
describe file('/tmp/result_file1') do describe file('/tmp/concat/result_file1') do
it { should be_file } it { should be_file }
it { should contain file1_contents } it { should contain file1_contents }
it { should_not contain file2_contents } it { should_not contain file2_contents }
end end
describe file('/tmp/result_file2') do describe file('/tmp/concat/result_file2') do
it { should be_file } it { should be_file }
it { should contain file2_contents } it { should contain file2_contents }
it { should_not contain file1_contents } it { should_not contain file1_contents }
end end
describe file('/tmp/result_file3') do describe file('/tmp/concat/result_file3') do
it { should be_file } it { should be_file }
it { should contain file1_contents } it { should contain file1_contents }
it { should_not contain file2_contents } it { should_not contain file2_contents }
@ -68,18 +68,18 @@ describe 'concat::fragment source lists ' do
context 'should fail if no match on source.' do context 'should fail if no match on source.' do
before(:all) do before(:all) do
shell("/bin/rm /tmp/fail_no_source /tmp/nofilehere /tmp/nothereeither") shell("/bin/rm /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither")
end end
pp=" pp="
concat { '/tmp/fail_no_source': concat { '/tmp/concat/fail_no_source':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
} }
concat::fragment { '1': concat::fragment { '1':
target => '/tmp/fail_no_source', target => '/tmp/concat/fail_no_source',
source => [ '/tmp/nofilehere', '/tmp/nothereeither' ], source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ],
order => '01', order => '01',
} }
" "
@ -88,7 +88,7 @@ describe 'concat::fragment source lists ' do
its(:exit_code) { should_not == 1 } its(:exit_code) { should_not == 1 }
its(:refresh) { should be_nil } its(:refresh) { should be_nil }
end end
describe file('/tmp/fail_no_source') do describe file('/tmp/concat/fail_no_source') do
#FIXME: Serverspec::Type::File doesn't support exists? for some reason. so... hack. #FIXME: Serverspec::Type::File doesn't support exists? for some reason. so... hack.
it { should_not be_file } it { should_not be_file }
it { should_not be_directory } it { should_not be_directory }

View file

@ -2,10 +2,10 @@ require 'spec_helper_system'
describe 'file should not replace' do describe 'file should not replace' do
shell('echo "file exists" >> /tmp/file') shell('echo "file exists" >> /tmp/concat/file')
context 'should fail' do context 'should fail' do
pp=" pp="
concat { '/tmp/file': concat { '/tmp/concat/file':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
@ -13,13 +13,13 @@ describe 'file should not replace' do
} }
concat::fragment { '1': concat::fragment { '1':
target => '/tmp/file', target => '/tmp/concat/file',
content => '1', content => '1',
order => '01', order => '01',
} }
concat::fragment { '2': concat::fragment { '2':
target => '/tmp/file', target => '/tmp/concat/file',
content => '2', content => '2',
order => '02', order => '02',
} }

View file

@ -3,7 +3,7 @@ require 'spec_helper_system'
describe 'symbolic name' do describe 'symbolic name' do
pp=" pp="
concat { 'not_abs_path': concat { 'not_abs_path':
path => '/tmp/file', path => '/tmp/concat/file',
} }
concat::fragment { '1': concat::fragment { '1':
@ -27,7 +27,7 @@ describe 'symbolic name' do
its(:exit_code) { should be_zero } its(:exit_code) { should be_zero }
end end
describe file('/tmp/file') do describe file('/tmp/concat/file') do
it { should be_file } it { should be_file }
it { should contain '1' } it { should contain '1' }
it { should contain '2' } it { should contain '2' }

View file

@ -3,7 +3,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="
concat { '/tmp/file': concat { '/tmp/concat/file':
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
@ -11,13 +11,13 @@ describe 'basic concat test' do
} }
concat::fragment { '1': concat::fragment { '1':
target => '/tmp/file', target => '/tmp/concat/file',
content => '1', content => '1',
order => '01', order => '01',
} }
concat::fragment { '2': concat::fragment { '2':
target => '/tmp/file', target => '/tmp/concat/file',
content => '2', content => '2',
order => '02', order => '02',
} }
@ -31,7 +31,7 @@ describe 'basic concat test' do
its(:exit_code) { should be_zero } its(:exit_code) { should be_zero }
end end
describe file('/tmp/file') do describe file('/tmp/concat/file') do
it { should be_file } it { should be_file }
it { should contain '# This file is managed by Puppet. DO NOT EDIT.' } it { should contain '# This file is managed by Puppet. DO NOT EDIT.' }
it { should contain '1' } it { should contain '1' }