Use tmpdir instead of /tmp for windows compatability
This commit is contained in:
parent
1c10eb5614
commit
f0b6187f76
9 changed files with 178 additions and 148 deletions
|
@ -1,20 +1,23 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
describe 'concat backup parameter' do
|
describe 'concat backup parameter' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
context '=> puppet' do
|
context '=> puppet' do
|
||||||
before :all do
|
before :all do
|
||||||
shell('rm -rf /tmp/concat')
|
shell("rm -rf #{basedir}")
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell("/bin/echo 'old contents' > /tmp/concat/file")
|
shell("echo 'old contents' > #{basedir}/file")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
backup => 'puppet',
|
backup => 'puppet',
|
||||||
}
|
}
|
||||||
concat::fragment { 'new file':
|
concat::fragment { 'new file':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => 'new contents',
|
content => 'new contents',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -22,12 +25,12 @@ describe 'concat backup parameter' do
|
||||||
it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do
|
it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do
|
||||||
apply_manifest(pp, :catch_failures => true) do |r|
|
apply_manifest(pp, :catch_failures => true) do |r|
|
||||||
expect(r.stderr).to eq("")
|
expect(r.stderr).to eq("")
|
||||||
expect(r.stdout).to match(/Filebucketed \/tmp\/concat\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents'
|
expect(r.stdout).to match(/Filebucketed #{basedir}\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents'
|
||||||
end
|
end
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'new contents' }
|
it { should contain 'new contents' }
|
||||||
end
|
end
|
||||||
|
@ -35,18 +38,18 @@ describe 'concat backup parameter' do
|
||||||
|
|
||||||
context '=> .backup' do
|
context '=> .backup' do
|
||||||
before :all do
|
before :all do
|
||||||
shell('rm -rf /tmp/concat')
|
shell("rm -rf #{basedir}")
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell("/bin/echo 'old contents' > /tmp/concat/file")
|
shell("echo 'old contents' > #{basedir}/file")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
backup => '.backup',
|
backup => '.backup',
|
||||||
}
|
}
|
||||||
concat::fragment { 'new file':
|
concat::fragment { 'new file':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => 'new contents',
|
content => 'new contents',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -58,11 +61,11 @@ describe 'concat backup parameter' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'new contents' }
|
it { should contain 'new contents' }
|
||||||
end
|
end
|
||||||
describe file('/tmp/concat/file.backup') do
|
describe file("#{basedir}/file.backup") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'old contents' }
|
it { should contain 'old contents' }
|
||||||
end
|
end
|
||||||
|
@ -72,18 +75,18 @@ describe 'concat backup parameter' do
|
||||||
# boolean false value, but the string 'false' has the same effect in Puppet 3
|
# boolean false value, but the string 'false' has the same effect in Puppet 3
|
||||||
context "=> 'false'" do
|
context "=> 'false'" do
|
||||||
before :all do
|
before :all do
|
||||||
shell('rm -rf /tmp/concat')
|
shell("rm -rf #{basedir}")
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell("/bin/echo 'old contents' > /tmp/concat/file")
|
shell("echo 'old contents' > #{basedir}/file")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
backup => '.backup',
|
backup => '.backup',
|
||||||
}
|
}
|
||||||
concat::fragment { 'new file':
|
concat::fragment { 'new file':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => 'new contents',
|
content => 'new contents',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -96,7 +99,7 @@ describe 'concat backup parameter' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'new contents' }
|
it { should contain 'new contents' }
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,9 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'basic concat test' do
|
describe 'basic concat test' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
|
|
||||||
shared_examples 'successfully_applied' do |pp|
|
shared_examples 'successfully_applied' do |pp|
|
||||||
it 'applies the manifest twice with no stderr' do
|
it 'applies the manifest twice with no stderr' do
|
||||||
|
@ -24,20 +27,20 @@ describe 'basic concat test' do
|
||||||
context 'owner/group' do
|
context 'owner/group' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
owner => '#{username}',
|
owner => '#{username}',
|
||||||
group => '#{groupname}',
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
order => '02',
|
order => '02',
|
||||||
}
|
}
|
||||||
|
@ -45,7 +48,7 @@ describe 'basic concat test' do
|
||||||
|
|
||||||
it_behaves_like 'successfully_applied', pp
|
it_behaves_like 'successfully_applied', pp
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should be_owned_by username }
|
it { should be_owned_by username }
|
||||||
it { should be_grouped_into groupname }
|
it { should be_grouped_into groupname }
|
||||||
|
@ -56,7 +59,7 @@ 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("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/01_1") do
|
describe file("#{default.puppet['vardir']}/concat/#{basedir.gsub('/','_')}_file/fragments/01_1") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should be_owned_by username }
|
it { should be_owned_by username }
|
||||||
it { should be_grouped_into groupname }
|
it { should be_grouped_into groupname }
|
||||||
|
@ -65,7 +68,7 @@ describe 'basic concat test' do
|
||||||
should be_mode 644
|
should be_mode 644
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
describe file("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/02_2") do
|
describe file("#{default.puppet['vardir']}/concat/#{basedir.gsub('/','_')}_file/fragments/02_2") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should be_owned_by username }
|
it { should be_owned_by username }
|
||||||
it { should be_grouped_into groupname }
|
it { should be_grouped_into groupname }
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
describe 'concat force empty parameter' do
|
describe 'concat force empty parameter' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
context 'should run successfully' do
|
context 'should run successfully' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
force => true,
|
force => true,
|
||||||
}
|
}
|
||||||
|
@ -15,7 +18,7 @@ describe 'concat force empty parameter' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should_not contain '1\n2' }
|
it { should_not contain '1\n2' }
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,27 +13,30 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'concat::fragment source' do
|
describe 'concat::fragment source' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
context 'should read file fragments from local system' do
|
context 'should read file fragments from local system' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell("/bin/echo 'file1 contents' > /tmp/concat/file1")
|
shell("/bin/echo 'file1 contents' > #{basedir}/file1")
|
||||||
shell("/bin/echo 'file2 contents' > /tmp/concat/file2")
|
shell("/bin/echo 'file2 contents' > #{basedir}/file2")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/foo': }
|
concat { '#{basedir}/foo': }
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
source => '/tmp/concat/file1',
|
source => '#{basedir}/file1',
|
||||||
}
|
}
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string1 contents',
|
content => 'string1 contents',
|
||||||
}
|
}
|
||||||
concat::fragment { '3':
|
concat::fragment { '3':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
source => '/tmp/concat/file2',
|
source => '#{basedir}/file2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
@ -42,7 +45,7 @@ describe 'concat::fragment source' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/foo') do
|
describe file("#{basedir}/foo") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'file1 contents' }
|
it { should contain 'file1 contents' }
|
||||||
it { should contain 'string1 contents' }
|
it { should contain 'string1 contents' }
|
||||||
|
@ -52,43 +55,43 @@ describe 'concat::fragment source' do
|
||||||
|
|
||||||
context 'should create files containing first match only.' do
|
context 'should create files containing first match only.' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell("/bin/echo 'file1 contents' > /tmp/concat/file1")
|
shell("echo 'file1 contents' > #{basedir}/file1")
|
||||||
shell("/bin/echo 'file2 contents' > /tmp/concat/file2")
|
shell("echo 'file2 contents' > #{basedir}/file2")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/result_file1':
|
concat { '#{basedir}/result_file1':
|
||||||
owner => '#{username}',
|
owner => '#{username}',
|
||||||
group => '#{groupname}',
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
concat { '/tmp/concat/result_file2':
|
concat { '#{basedir}/result_file2':
|
||||||
owner => '#{username}',
|
owner => '#{username}',
|
||||||
group => '#{groupname}',
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
concat { '/tmp/concat/result_file3':
|
concat { '#{basedir}/result_file3':
|
||||||
owner => '#{username}',
|
owner => '#{username}',
|
||||||
group => '#{groupname}',
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/result_file1',
|
target => '#{basedir}/result_file1',
|
||||||
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
|
source => [ '#{basedir}/file1', '#{basedir}/file2' ],
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/result_file2',
|
target => '#{basedir}/result_file2',
|
||||||
source => [ '/tmp/concat/file2', '/tmp/concat/file1' ],
|
source => [ '#{basedir}/file2', '#{basedir}/file1' ],
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
concat::fragment { '3':
|
concat::fragment { '3':
|
||||||
target => '/tmp/concat/result_file3',
|
target => '#{basedir}/result_file3',
|
||||||
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
|
source => [ '#{basedir}/file1', '#{basedir}/file2' ],
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -97,17 +100,17 @@ describe 'concat::fragment source' do
|
||||||
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
describe file('/tmp/concat/result_file1') do
|
describe file("#{basedir}/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/concat/result_file2') do
|
describe file("#{basedir}/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/concat/result_file3') do
|
describe file("#{basedir}/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' }
|
||||||
|
@ -116,22 +119,22 @@ describe 'concat::fragment source' 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('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell('/bin/rm -rf /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither')
|
shell("rm -rf #{basedir}/fail_no_source #{basedir}/nofilehere #{basedir}/nothereeither")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/fail_no_source':
|
concat { '#{basedir}/fail_no_source':
|
||||||
owner => '#{username}',
|
owner => '#{username}',
|
||||||
group => '#{groupname}',
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/fail_no_source',
|
target => '#{basedir}/fail_no_source',
|
||||||
source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ],
|
source => [ '#{basedir}/nofilehere', '#{basedir}/nothereeither' ],
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -139,7 +142,7 @@ describe 'concat::fragment source' do
|
||||||
it 'applies the manifest with resource failures' do
|
it 'applies the manifest with resource failures' do
|
||||||
apply_manifest(pp, :expect_failures => true)
|
apply_manifest(pp, :expect_failures => true)
|
||||||
end
|
end
|
||||||
describe file('/tmp/concat/fail_no_source') do
|
describe file("#{basedir}/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 }
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
describe 'concat ensure_newline parameter' do
|
describe 'concat ensure_newline parameter' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
context '=> false' do
|
context '=> false' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
ensure_newline => false,
|
ensure_newline => false,
|
||||||
}
|
}
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
}
|
}
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -22,7 +25,7 @@ describe 'concat ensure_newline parameter' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain '12' }
|
it { should contain '12' }
|
||||||
end
|
end
|
||||||
|
@ -31,15 +34,15 @@ describe 'concat ensure_newline parameter' do
|
||||||
#context '=> true' do
|
#context '=> true' do
|
||||||
# pp = <<-EOS
|
# pp = <<-EOS
|
||||||
# include concat::setup
|
# include concat::setup
|
||||||
# concat { '/tmp/concat/file':
|
# concat { '#{basedir}/file':
|
||||||
# ensure_newline => true,
|
# ensure_newline => true,
|
||||||
# }
|
# }
|
||||||
# concat::fragment { '1':
|
# concat::fragment { '1':
|
||||||
# target => '/tmp/concat/file',
|
# target => '#{basedir}/file',
|
||||||
# content => '1',
|
# content => '1',
|
||||||
# }
|
# }
|
||||||
# concat::fragment { '2':
|
# concat::fragment { '2':
|
||||||
# target => '/tmp/concat/file',
|
# target => '#{basedir}/file',
|
||||||
# content => '2',
|
# content => '2',
|
||||||
# }
|
# }
|
||||||
# EOS
|
# EOS
|
||||||
|
@ -51,7 +54,7 @@ describe 'concat ensure_newline parameter' do
|
||||||
# #are modified in place.
|
# #are modified in place.
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# describe file('/tmp/concat/file') do
|
# describe file("#{basedir}/file") do
|
||||||
# it { should be_file }
|
# it { should be_file }
|
||||||
# it { should contain "1\n2\n" }
|
# it { should contain "1\n2\n" }
|
||||||
# end
|
# end
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
describe 'concat order' do
|
describe 'concat order' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
end
|
end
|
||||||
|
|
||||||
context '=> alpha' do
|
context '=> alpha' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/foo':
|
concat { '#{basedir}/foo':
|
||||||
order => 'alpha'
|
order => 'alpha'
|
||||||
}
|
}
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string1',
|
content => 'string1',
|
||||||
}
|
}
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string2',
|
content => 'string2',
|
||||||
}
|
}
|
||||||
concat::fragment { '10':
|
concat::fragment { '10':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string10',
|
content => 'string10',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -31,7 +34,7 @@ describe 'concat order' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/foo') do
|
describe file("#{basedir}/foo") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
#XXX Solaris 10 doesn't support multi-line grep
|
#XXX Solaris 10 doesn't support multi-line grep
|
||||||
it("should contain string10\nstring1\nsring2", :unless => fact('osfamily') == 'Solaris') {
|
it("should contain string10\nstring1\nsring2", :unless => fact('osfamily') == 'Solaris') {
|
||||||
|
@ -43,19 +46,19 @@ describe 'concat order' do
|
||||||
context '=> numeric' do
|
context '=> numeric' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/foo':
|
concat { '#{basedir}/foo':
|
||||||
order => 'numeric'
|
order => 'numeric'
|
||||||
}
|
}
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string1',
|
content => 'string1',
|
||||||
}
|
}
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string2',
|
content => 'string2',
|
||||||
}
|
}
|
||||||
concat::fragment { '10':
|
concat::fragment { '10':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string10',
|
content => 'string10',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -65,7 +68,7 @@ describe 'concat order' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/foo') do
|
describe file("#{basedir}/foo") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
#XXX Solaris 10 doesn't support multi-line grep
|
#XXX Solaris 10 doesn't support multi-line grep
|
||||||
it("should contain string1\nstring2\nsring10", :unless => fact('osfamily') == 'Solaris') {
|
it("should contain string1\nstring2\nsring10", :unless => fact('osfamily') == 'Solaris') {
|
||||||
|
@ -76,27 +79,30 @@ describe 'concat order' do
|
||||||
end # concat order
|
end # concat order
|
||||||
|
|
||||||
describe 'concat::fragment order' do
|
describe 'concat::fragment order' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
end
|
end
|
||||||
|
|
||||||
context '=> reverse order' do
|
context '=> reverse order' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/foo': }
|
concat { '#{basedir}/foo': }
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string1',
|
content => 'string1',
|
||||||
order => '15',
|
order => '15',
|
||||||
}
|
}
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string2',
|
content => 'string2',
|
||||||
# default order 10
|
# default order 10
|
||||||
}
|
}
|
||||||
concat::fragment { '3':
|
concat::fragment { '3':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string3',
|
content => 'string3',
|
||||||
order => '1',
|
order => '1',
|
||||||
}
|
}
|
||||||
|
@ -107,7 +113,7 @@ describe 'concat::fragment order' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/foo') do
|
describe file("#{basedir}/foo") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
#XXX Solaris 10 doesn't support multi-line grep
|
#XXX Solaris 10 doesn't support multi-line grep
|
||||||
it("should contain string3\nstring2\nsring1", :unless => fact('osfamily') == 'Solaris') {
|
it("should contain string3\nstring2\nsring1", :unless => fact('osfamily') == 'Solaris') {
|
||||||
|
@ -119,19 +125,19 @@ describe 'concat::fragment order' do
|
||||||
context '=> normal order' do
|
context '=> normal order' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/foo': }
|
concat { '#{basedir}/foo': }
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string1',
|
content => 'string1',
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string2',
|
content => 'string2',
|
||||||
order => '02'
|
order => '02'
|
||||||
}
|
}
|
||||||
concat::fragment { '3':
|
concat::fragment { '3':
|
||||||
target => '/tmp/concat/foo',
|
target => '#{basedir}/foo',
|
||||||
content => 'string3',
|
content => 'string3',
|
||||||
order => '03',
|
order => '03',
|
||||||
}
|
}
|
||||||
|
@ -142,7 +148,7 @@ describe 'concat::fragment order' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/foo') do
|
describe file("#{basedir}/foo") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
#XXX Solaris 10 doesn't support multi-line grep
|
#XXX Solaris 10 doesn't support multi-line grep
|
||||||
it("should contain string1\nstring2\nsring3", :unless => fact('osfamily') == 'Solaris') {
|
it("should contain string1\nstring2\nsring3", :unless => fact('osfamily') == 'Solaris') {
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
describe 'replacement of' do
|
describe 'replacement of' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
context 'file' do
|
context 'file' do
|
||||||
context 'should not succeed' do
|
context 'should not succeed' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell('echo "file exists" > /tmp/concat/file')
|
shell('echo "file exists" > #{basedir}/file')
|
||||||
end
|
end
|
||||||
after(:all) do
|
after(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
replace => false,
|
replace => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -33,7 +36,7 @@ describe 'replacement of' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'file exists' }
|
it { should contain 'file exists' }
|
||||||
it { should_not contain '1' }
|
it { should_not contain '1' }
|
||||||
|
@ -43,26 +46,26 @@ describe 'replacement of' do
|
||||||
|
|
||||||
context 'should succeed' do
|
context 'should succeed' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell('echo "file exists" > /tmp/concat/file')
|
shell("echo "file exists" > #{basedir}/file")
|
||||||
end
|
end
|
||||||
after(:all) do
|
after(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
replace => true,
|
replace => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -72,7 +75,7 @@ describe 'replacement of' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should_not contain 'file exists' }
|
it { should_not contain 'file exists' }
|
||||||
it { should contain '1' }
|
it { should contain '1' }
|
||||||
|
@ -87,26 +90,26 @@ describe 'replacement of' do
|
||||||
# when using ensure => present and source => ... but it will not when using
|
# when using ensure => present and source => ... but it will not when using
|
||||||
# ensure => present and content => ...; this is somewhat confusing behavior
|
# ensure => present and content => ...; this is somewhat confusing behavior
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell('ln -s /tmp/concat/dangling /tmp/concat/file')
|
shell("ln -s #{basedir}/dangling #{basedir}/file")
|
||||||
end
|
end
|
||||||
after(:all) do
|
after(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
replace => false,
|
replace => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -117,11 +120,11 @@ describe 'replacement of' do
|
||||||
end
|
end
|
||||||
|
|
||||||
# XXX specinfra doesn't support be_linked_to on AIX
|
# XXX specinfra doesn't support be_linked_to on AIX
|
||||||
describe file('/tmp/concat/file'), :unless => fact('osfamily') == "AIX" do
|
describe file("#{basedir}/file"), :unless => fact("osfamily") == "AIX" do
|
||||||
it { should be_linked_to '/tmp/concat/dangling' }
|
it { should be_linked_to "#{basedir}/dangling" }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/dangling') do
|
describe file("#{basedir}/dangling") do
|
||||||
# XXX serverspec does not have a matcher for 'exists'
|
# XXX serverspec does not have a matcher for 'exists'
|
||||||
it { should_not be_file }
|
it { should_not be_file }
|
||||||
it { should_not be_directory }
|
it { should_not be_directory }
|
||||||
|
@ -133,26 +136,26 @@ describe 'replacement of' do
|
||||||
# when using ensure => present and source => ... but it will not when using
|
# when using ensure => present and source => ... but it will not when using
|
||||||
# ensure => present and content => ...; this is somewhat confusing behavior
|
# ensure => present and content => ...; this is somewhat confusing behavior
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('mkdir -p /tmp/concat')
|
shell("mkdir -p #{basedir}")
|
||||||
shell('ln -s /tmp/concat/dangling /tmp/concat/file')
|
shell("ln -s #{basedir}/dangling #{basedir}/file")
|
||||||
end
|
end
|
||||||
after(:all) do
|
after(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
replace => true,
|
replace => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -162,7 +165,7 @@ describe 'replacement of' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/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' }
|
||||||
|
@ -173,23 +176,23 @@ describe 'replacement of' do
|
||||||
context 'directory' do
|
context 'directory' do
|
||||||
context 'should not succeed' do
|
context 'should not succeed' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('mkdir -p /tmp/concat/file')
|
shell("mkdir -p #{basedir}/file")
|
||||||
end
|
end
|
||||||
after(:all) do
|
after(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file': }
|
concat { '#{basedir}/file': }
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -199,7 +202,7 @@ describe 'replacement of' do
|
||||||
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/change from directory to file failed/)
|
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/change from directory to file failed/)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_directory }
|
it { should be_directory }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -211,25 +214,25 @@ describe 'replacement of' do
|
||||||
# replacement.
|
# replacement.
|
||||||
context 'should succeed', :pending => 'not yet implemented' do
|
context 'should succeed', :pending => 'not yet implemented' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
shell('mkdir -p /tmp/concat/file')
|
shell("mkdir -p #{basedir}/file")
|
||||||
end
|
end
|
||||||
after(:all) do
|
after(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf #{basedir} #{default.puppet['vardir']}/concat")
|
||||||
end
|
end
|
||||||
|
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
force => true,
|
force => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -239,7 +242,7 @@ describe 'replacement of' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain '1' }
|
it { should contain '1' }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
describe 'symbolic name' do
|
describe 'symbolic name' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { 'not_abs_path':
|
concat { 'not_abs_path':
|
||||||
path => '/tmp/concat/file',
|
path => '#{basedir}/file',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
|
@ -25,7 +28,7 @@ describe 'symbolic name' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/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' }
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
describe 'concat warn =>' do
|
describe 'concat warn =>' do
|
||||||
|
let :basedir do
|
||||||
|
default.tmpdir('concat')
|
||||||
|
end
|
||||||
context 'true should enable default warning message' do
|
context 'true should enable default warning message' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
warn => true,
|
warn => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
order => '02',
|
order => '02',
|
||||||
}
|
}
|
||||||
|
@ -26,7 +29,7 @@ describe 'concat warn =>' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/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' }
|
||||||
|
@ -36,18 +39,18 @@ describe 'concat warn =>' do
|
||||||
context 'false should not enable default warning message' do
|
context 'false should not enable default warning message' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
warn => false,
|
warn => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
order => '02',
|
order => '02',
|
||||||
}
|
}
|
||||||
|
@ -58,7 +61,7 @@ describe 'concat warn =>' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
|
it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
|
||||||
it { should contain '1' }
|
it { should contain '1' }
|
||||||
|
@ -68,18 +71,18 @@ describe 'concat warn =>' do
|
||||||
context '# foo should overide default warning message' do
|
context '# foo should overide default warning message' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '#{basedir}/file':
|
||||||
warn => '# foo',
|
warn => '# foo',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '1':
|
concat::fragment { '1':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '1',
|
content => '1',
|
||||||
order => '01',
|
order => '01',
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
concat::fragment { '2':
|
||||||
target => '/tmp/concat/file',
|
target => '#{basedir}/file',
|
||||||
content => '2',
|
content => '2',
|
||||||
order => '02',
|
order => '02',
|
||||||
}
|
}
|
||||||
|
@ -90,7 +93,7 @@ describe 'concat warn =>' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain '# foo' }
|
it { should contain '# foo' }
|
||||||
it { should contain '1' }
|
it { should contain '1' }
|
||||||
|
|
Loading…
Reference in a new issue