Acceptance tests for show_diff
This commit is contained in:
parent
4853927093
commit
af4b3f287a
2 changed files with 55 additions and 12 deletions
|
@ -282,33 +282,39 @@ describe 'ini_setting resource' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'keep_secret parameter and logging:' do
|
describe 'show_diff parameter and logging:' do
|
||||||
[ {:value => "initial_value", :matcher => "created", :keep_secret => :false},
|
[ {:value => "initial_value", :matcher => "created", :show_diff => true},
|
||||||
{:value => "public_value", :matcher => /initial_value.*public_value/, :keep_secret => :false},
|
{:value => "public_value", :matcher => /initial_value.*public_value/, :show_diff => true},
|
||||||
{:value => "secret_value", :matcher => /redacted sensitive information.*redacted sensitive information/, :keep_secret => :true},
|
{:value => "secret_value", :matcher => /redacted sensitive information.*redacted sensitive information/, :show_diff => false},
|
||||||
{:value => "md5_value", :matcher => /{md5}881671aa2bbc680bc530c4353125052b.*{md5}ed0903a7fa5de7886ca1a7a9ad06cf51/, :keep_secret => :md5}
|
{:value => "md5_value", :matcher => /{md5}881671aa2bbc680bc530c4353125052b.*{md5}ed0903a7fa5de7886ca1a7a9ad06cf51/, :show_diff => :md5}
|
||||||
].each do |i|
|
].each do |i|
|
||||||
context "keep_secret => #{i[:keep_secret]}" do
|
context "show_diff => #{i[:show_diff]}" do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
ini_setting { 'test_keep_secret':
|
ini_setting { 'test_show_diff':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
section => 'test',
|
section => 'test',
|
||||||
setting => 'something',
|
setting => 'something',
|
||||||
value => '#{i[:value]}',
|
value => '#{i[:value]}',
|
||||||
path => "#{tmpdir}/test_keep_secret.ini",
|
path => "#{tmpdir}/test_show_diff.ini",
|
||||||
keep_secret => #{i[:keep_secret]}
|
show_diff => #{i[:show_diff]}
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
it "applies manifest and expects changed value to be logged in proper form" do
|
it "applies manifest and expects changed value to be logged in proper form" do
|
||||||
|
config = {
|
||||||
|
'main' => {
|
||||||
|
'show_diff' => true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
configure_puppet_on(default, config)
|
||||||
|
|
||||||
res = apply_manifest(pp, :expect_changes => true)
|
res = apply_manifest(pp, :expect_changes => true)
|
||||||
expect(res.stdout).to match(i[:matcher])
|
expect(res.stdout).to match(i[:matcher])
|
||||||
expect(res.stdout).not_to match(i[:value]) unless (i[:keep_secret] == :false)
|
expect(res.stdout).not_to match(i[:value]) unless (i[:show_diff] == true)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -197,4 +197,41 @@ describe 'ini_subsetting resource' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'show_diff parameter and logging:' do
|
||||||
|
[ {:value => "initial_value", :matcher => "created", :show_diff => true},
|
||||||
|
{:value => "public_value", :matcher => /initial_value.*public_value/, :show_diff => true},
|
||||||
|
{:value => "secret_value", :matcher => /redacted sensitive information.*redacted sensitive information/, :show_diff => false},
|
||||||
|
{:value => "md5_value", :matcher => /{md5}881671aa2bbc680bc530c4353125052b.*{md5}ed0903a7fa5de7886ca1a7a9ad06cf51/, :show_diff => :md5}
|
||||||
|
].each do |i|
|
||||||
|
context "show_diff => #{i[:show_diff]}" do
|
||||||
|
pp = <<-EOS
|
||||||
|
ini_subsetting { 'test_show_diff':
|
||||||
|
ensure => present,
|
||||||
|
section => 'test',
|
||||||
|
setting => 'something',
|
||||||
|
subsetting => 'xxx',
|
||||||
|
value => '#{i[:value]}',
|
||||||
|
path => "#{tmpdir}/test_show_diff.ini",
|
||||||
|
show_diff => #{i[:show_diff]}
|
||||||
|
}
|
||||||
|
EOS
|
||||||
|
|
||||||
|
it "applies manifest and expects changed value to be logged in proper form" do
|
||||||
|
config = {
|
||||||
|
'main' => {
|
||||||
|
'show_diff' => true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
configure_puppet_on(default, config)
|
||||||
|
|
||||||
|
res = apply_manifest(pp, :expect_changes => true)
|
||||||
|
expect(res.stdout).to match(i[:matcher])
|
||||||
|
expect(res.stdout).not_to match(i[:value]) unless (i[:show_diff] == true)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue