Add unit tests for validate_cmd parameter.
This commit is contained in:
parent
09a01d8087
commit
79c5e45a24
1 changed files with 27 additions and 9 deletions
|
@ -19,6 +19,7 @@ describe 'concat', :type => :define do
|
||||||
:replace => true,
|
:replace => true,
|
||||||
:order => 'alpha',
|
:order => 'alpha',
|
||||||
:ensure_newline => false,
|
:ensure_newline => false,
|
||||||
|
:validate_cmd => nil,
|
||||||
}.merge(params)
|
}.merge(params)
|
||||||
|
|
||||||
safe_name = title.gsub('/', '_')
|
safe_name = title.gsub('/', '_')
|
||||||
|
@ -76,15 +77,16 @@ describe 'concat', :type => :define do
|
||||||
|
|
||||||
it do
|
it do
|
||||||
should contain_file(title).with(file_defaults.merge({
|
should contain_file(title).with(file_defaults.merge({
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:owner => p[:owner],
|
:owner => p[:owner],
|
||||||
:group => p[:group],
|
:group => p[:group],
|
||||||
:mode => p[:mode],
|
:mode => p[:mode],
|
||||||
:replace => p[:replace],
|
:replace => p[:replace],
|
||||||
:path => p[:path],
|
:path => p[:path],
|
||||||
:alias => "concat_#{title}",
|
:alias => "concat_#{title}",
|
||||||
:source => "#{fragdir}/#{concat_name}",
|
:source => "#{fragdir}/#{concat_name}",
|
||||||
:backup => p[:backup],
|
:validate_cmd => p[:validate_cmd],
|
||||||
|
:backup => p[:backup],
|
||||||
}))
|
}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -380,6 +382,22 @@ describe 'concat', :type => :define do
|
||||||
end
|
end
|
||||||
end # ensure_newline =>
|
end # ensure_newline =>
|
||||||
|
|
||||||
|
context 'validate_cmd =>' do
|
||||||
|
context '/usr/bin/test -e %' do
|
||||||
|
it_behaves_like 'concat', '/etc/foo.bar', { :validate_cmd => '/usr/bin/test -e %' }
|
||||||
|
end
|
||||||
|
|
||||||
|
[ 1234, true ].each do |cmd|
|
||||||
|
context cmd do
|
||||||
|
let(:title) { '/etc/foo.bar' }
|
||||||
|
let(:params) {{ :validate_cmd => cmd }}
|
||||||
|
it 'should fail' do
|
||||||
|
expect { should }.to raise_error(Puppet::Error, /\$validate_cmd must be a string/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end # validate_cmd =>
|
||||||
|
|
||||||
describe 'deprecated parameter' do
|
describe 'deprecated parameter' do
|
||||||
context 'gnu =>' do
|
context 'gnu =>' do
|
||||||
context 'foo' do
|
context 'foo' do
|
||||||
|
|
Loading…
Reference in a new issue