clean up between system spec files
This commit is contained in:
parent
911bb65b78
commit
c852dc22d7
8 changed files with 64 additions and 57 deletions
|
@ -23,4 +23,11 @@ RSpec.configure do |c|
|
|||
puppet_module_install(:source => proj_root, :module_name => 'concat')
|
||||
shell('puppet module install puppetlabs-stdlib')
|
||||
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
|
||||
|
|
|
@ -29,25 +29,25 @@ describe 'basic concat test' do
|
|||
#it { should be_grouped_into 'root' }
|
||||
it { should be_mode 755 }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
it { should be_mode 750 }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
it { should be_mode 750 }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
it { should be_mode 640 }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
|
@ -57,20 +57,20 @@ describe 'basic concat test' do
|
|||
|
||||
context 'owner/group root' do
|
||||
pp="
|
||||
concat { '/tmp/file':
|
||||
concat { '/tmp/concat/file':
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
}
|
||||
|
||||
concat::fragment { '1':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '1',
|
||||
order => '01',
|
||||
}
|
||||
|
||||
concat::fragment { '2':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '2',
|
||||
order => '02',
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ describe 'basic concat test' do
|
|||
|
||||
it_behaves_like 'successfully_applied', pp
|
||||
|
||||
describe file('/tmp/file') do
|
||||
describe file('/tmp/concat/file') do
|
||||
it { should be_file }
|
||||
it { should be_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
|
@ -86,13 +86,13 @@ describe 'basic concat test' do
|
|||
it { should contain '1' }
|
||||
it { should contain '2' }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
it { should be_mode 640 }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
|
@ -107,20 +107,20 @@ describe 'basic concat test' do
|
|||
end
|
||||
|
||||
pp="
|
||||
concat { '/tmp/file':
|
||||
concat { '/tmp/concat/file':
|
||||
owner => 'bob',
|
||||
group => 'bob',
|
||||
mode => '0644',
|
||||
}
|
||||
|
||||
concat::fragment { '1':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '1',
|
||||
order => '01',
|
||||
}
|
||||
|
||||
concat::fragment { '2':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '2',
|
||||
order => '02',
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ describe 'basic concat test' do
|
|||
|
||||
it_behaves_like 'successfully_applied', pp
|
||||
|
||||
describe file('/tmp/file') do
|
||||
describe file('/tmp/concat/file') do
|
||||
it { should be_file }
|
||||
it { should be_owned_by 'bob' }
|
||||
it { should be_grouped_into 'bob' }
|
||||
|
@ -136,14 +136,14 @@ describe 'basic concat test' do
|
|||
it { should contain '1' }
|
||||
it { should contain '2' }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
it { should be_mode 640 }
|
||||
it { should contain '1' }
|
||||
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_owned_by 'root' }
|
||||
it { should be_grouped_into 'root' }
|
||||
|
|
|
@ -14,11 +14,11 @@ describe 'deprecation warnings' do
|
|||
|
||||
context 'concat gnu parameter' do
|
||||
pp="
|
||||
concat { '/tmp/file':
|
||||
concat { '/tmp/concat/file':
|
||||
gnu => 'foo',
|
||||
}
|
||||
concat::fragment { 'foo':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
}
|
||||
"
|
||||
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
|
||||
pp="
|
||||
concat { '/tmp/file': }
|
||||
concat { '/tmp/concat/file': }
|
||||
concat::fragment { 'foo':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
mode => 'bar',
|
||||
}
|
||||
"
|
||||
|
@ -41,9 +41,9 @@ describe 'deprecation warnings' do
|
|||
|
||||
context 'concat::fragment owner parameter' do
|
||||
pp="
|
||||
concat { '/tmp/file': }
|
||||
concat { '/tmp/concat/file': }
|
||||
concat::fragment { 'foo':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
owner => 'bar',
|
||||
}
|
||||
"
|
||||
|
@ -54,9 +54,9 @@ describe 'deprecation warnings' do
|
|||
|
||||
context 'concat::fragment group parameter' do
|
||||
pp="
|
||||
concat { '/tmp/file': }
|
||||
concat { '/tmp/concat/file': }
|
||||
concat::fragment { 'foo':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
group => 'bar',
|
||||
}
|
||||
"
|
||||
|
@ -67,9 +67,9 @@ describe 'deprecation warnings' do
|
|||
|
||||
context 'concat::fragment backup parameter' do
|
||||
pp="
|
||||
concat { '/tmp/file': }
|
||||
concat { '/tmp/concat/file': }
|
||||
concat::fragment { 'foo':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
backup => 'bar',
|
||||
}
|
||||
"
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper_system'
|
|||
describe 'basic concat test' do
|
||||
context 'should run successfully' do
|
||||
pp="
|
||||
concat { '/tmp/file':
|
||||
concat { '/tmp/concat/file':
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => '0644',
|
||||
|
@ -19,7 +19,7 @@ describe 'basic concat test' do
|
|||
its(:exit_code) { should be_zero }
|
||||
end
|
||||
|
||||
describe file('/tmp/file') do
|
||||
describe file('/tmp/concat/file') do
|
||||
it { should be_file }
|
||||
it { should_not contain '1\n2' }
|
||||
end
|
||||
|
|
|
@ -5,40 +5,40 @@ describe 'concat::fragment source lists ' do
|
|||
file1_contents="file1 contents"
|
||||
file2_contents="file2 contents"
|
||||
before(:all) do
|
||||
shell("/bin/echo '#{file1_contents}' > /tmp/file1")
|
||||
shell("/bin/echo '#{file2_contents}' > /tmp/file2")
|
||||
shell("/bin/echo '#{file1_contents}' > /tmp/concat/file1")
|
||||
shell("/bin/echo '#{file2_contents}' > /tmp/concat/file2")
|
||||
end
|
||||
pp="
|
||||
|
||||
concat { '/tmp/result_file1':
|
||||
concat { '/tmp/concat/result_file1':
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => '0644',
|
||||
}
|
||||
concat { '/tmp/result_file2':
|
||||
concat { '/tmp/concat/result_file2':
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => '0644',
|
||||
}
|
||||
concat { '/tmp/result_file3':
|
||||
concat { '/tmp/concat/result_file3':
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => '0644',
|
||||
}
|
||||
|
||||
concat::fragment { '1':
|
||||
target => '/tmp/result_file1',
|
||||
source => [ '/tmp/file1', '/tmp/file2' ],
|
||||
target => '/tmp/concat/result_file1',
|
||||
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
|
||||
order => '01',
|
||||
}
|
||||
concat::fragment { '2':
|
||||
target => '/tmp/result_file2',
|
||||
source => [ '/tmp/file2', '/tmp/file1' ],
|
||||
target => '/tmp/concat/result_file2',
|
||||
source => [ '/tmp/concat/file2', '/tmp/concat/file1' ],
|
||||
order => '01',
|
||||
}
|
||||
concat::fragment { '3':
|
||||
target => '/tmp/result_file3',
|
||||
source => [ '/tmp/file1', '/tmp/file2' ],
|
||||
target => '/tmp/concat/result_file3',
|
||||
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
|
||||
order => '01',
|
||||
}
|
||||
"
|
||||
|
@ -49,17 +49,17 @@ describe 'concat::fragment source lists ' do
|
|||
its(:stderr) { should be_empty }
|
||||
its(:exit_code) { should be_zero }
|
||||
end
|
||||
describe file('/tmp/result_file1') do
|
||||
describe file('/tmp/concat/result_file1') do
|
||||
it { should be_file }
|
||||
it { should contain file1_contents }
|
||||
it { should_not contain file2_contents }
|
||||
end
|
||||
describe file('/tmp/result_file2') do
|
||||
describe file('/tmp/concat/result_file2') do
|
||||
it { should be_file }
|
||||
it { should contain file2_contents }
|
||||
it { should_not contain file1_contents }
|
||||
end
|
||||
describe file('/tmp/result_file3') do
|
||||
describe file('/tmp/concat/result_file3') do
|
||||
it { should be_file }
|
||||
it { should contain file1_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
|
||||
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
|
||||
pp="
|
||||
concat { '/tmp/fail_no_source':
|
||||
concat { '/tmp/concat/fail_no_source':
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => '0644',
|
||||
}
|
||||
|
||||
concat::fragment { '1':
|
||||
target => '/tmp/fail_no_source',
|
||||
source => [ '/tmp/nofilehere', '/tmp/nothereeither' ],
|
||||
target => '/tmp/concat/fail_no_source',
|
||||
source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ],
|
||||
order => '01',
|
||||
}
|
||||
"
|
||||
|
@ -88,7 +88,7 @@ describe 'concat::fragment source lists ' do
|
|||
its(:exit_code) { should_not == 1 }
|
||||
its(:refresh) { should be_nil }
|
||||
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.
|
||||
it { should_not be_file }
|
||||
it { should_not be_directory }
|
||||
|
|
|
@ -2,10 +2,10 @@ require 'spec_helper_system'
|
|||
|
||||
|
||||
describe 'file should not replace' do
|
||||
shell('echo "file exists" >> /tmp/file')
|
||||
shell('echo "file exists" >> /tmp/concat/file')
|
||||
context 'should fail' do
|
||||
pp="
|
||||
concat { '/tmp/file':
|
||||
concat { '/tmp/concat/file':
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => '0644',
|
||||
|
@ -13,13 +13,13 @@ describe 'file should not replace' do
|
|||
}
|
||||
|
||||
concat::fragment { '1':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '1',
|
||||
order => '01',
|
||||
}
|
||||
|
||||
concat::fragment { '2':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '2',
|
||||
order => '02',
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper_system'
|
|||
describe 'symbolic name' do
|
||||
pp="
|
||||
concat { 'not_abs_path':
|
||||
path => '/tmp/file',
|
||||
path => '/tmp/concat/file',
|
||||
}
|
||||
|
||||
concat::fragment { '1':
|
||||
|
@ -27,7 +27,7 @@ describe 'symbolic name' do
|
|||
its(:exit_code) { should be_zero }
|
||||
end
|
||||
|
||||
describe file('/tmp/file') do
|
||||
describe file('/tmp/concat/file') do
|
||||
it { should be_file }
|
||||
it { should contain '1' }
|
||||
it { should contain '2' }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper_system'
|
|||
describe 'basic concat test' do
|
||||
context 'should run successfully' do
|
||||
pp="
|
||||
concat { '/tmp/file':
|
||||
concat { '/tmp/concat/file':
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => '0644',
|
||||
|
@ -11,13 +11,13 @@ describe 'basic concat test' do
|
|||
}
|
||||
|
||||
concat::fragment { '1':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '1',
|
||||
order => '01',
|
||||
}
|
||||
|
||||
concat::fragment { '2':
|
||||
target => '/tmp/file',
|
||||
target => '/tmp/concat/file',
|
||||
content => '2',
|
||||
order => '02',
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ describe 'basic concat test' do
|
|||
its(:exit_code) { should be_zero }
|
||||
end
|
||||
|
||||
describe file('/tmp/file') do
|
||||
describe file('/tmp/concat/file') do
|
||||
it { should be_file }
|
||||
it { should contain '# This file is managed by Puppet. DO NOT EDIT.' }
|
||||
it { should contain '1' }
|
||||
|
|
Loading…
Reference in a new issue