Skip to content

Commit

Permalink
Merge pull request #281 from puppetlabs/dependabot/bundler/puppetlabs…
Browse files Browse the repository at this point in the history
…_spec_helper-tw-3.0

Update puppetlabs_spec_helper requirement from ~> 2.7 to ~> 3.0
  • Loading branch information
sanfrancrisko authored Feb 22, 2021
2 parents 7375f33 + 8cd54fe commit bd93dba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ group :tests do
gem 'simplecov-console'

# the test gems required for module testing
gem 'puppetlabs_spec_helper', '~> 2.7'
gem 'puppetlabs_spec_helper', '~> 3.0'
gem 'rspec-puppet'

# since the Resource API runs inside the puppetserver, test against the JRuby versions we ship
Expand Down
22 changes: 11 additions & 11 deletions spec/acceptance/sensitive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@

describe 'using `puppet apply`' do
it 'is not exposed by notify' do
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"notice(Sensitive('foo'))\"")
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"notice(Sensitive('sesitive_data'))\"")
expect(stdout_str).to match %r{redacted}
expect(stdout_str).not_to match %r{foo}
expect(stdout_str).not_to match %r{sesitive_data}
expect(stdout_str).not_to match %r{warn|error}i
end

it 'is not exposed by a provider' do
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"test_sensitive { bar: secret => Sensitive('foo'), "\
"optional_secret => Sensitive('optional foo'), array_secret => [Sensitive('array foo')] }\"")
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"test_sensitive { test_resource: secret => Sensitive('sesitive_data'), "\
"optional_secret => Sensitive('optional sesitive_data'), array_secret => [Sensitive('array sesitive_data')] }\"")
expect(stdout_str).to match %r{redacted}
expect(stdout_str).not_to match %r{foo}
expect(stdout_str).not_to match %r{sesitive_data}
expect(stdout_str).not_to match %r{warn|error}i
end

context 'when a sensitive value is not the top level type' do
it 'is not exposed by a provider' do
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"test_sensitive { bar: secret => Sensitive('foo'), "\
"optional_secret => Sensitive('optional foo'), variant_secret => [Sensitive('variant foo')] }\"")
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"test_sensitive { test_resource: secret => Sensitive('sesitive_data'), "\
"optional_secret => Sensitive('optional sesitive_data'), variant_secret => [Sensitive('variant sesitive_data')] }\"")
expect(stdout_str).to match %r{redacted}
expect(stdout_str).not_to match %r{variant foo}
expect(stdout_str).not_to match %r{variant sesitive_data}
expect(stdout_str).not_to match %r{warn|error}i
end
it 'properly validates the sensitive type value' do
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"test_sensitive { bar: secret => Sensitive('foo'), "\
"optional_secret => Sensitive('optional foo'), variant_secret => [Sensitive(134679)] }\"")
stdout_str, _status = Open3.capture2e("puppet apply #{common_args} -e \"test_sensitive { test_resource: secret => Sensitive('sesitive_data'), "\
"optional_secret => Sensitive('optional sesitive_data'), variant_secret => [Sensitive(134679)] }\"")
expect(stdout_str).to match %r{Sensitive\[String\]( value)?, got Sensitive\[Integer\]}
expect(stdout_str).not_to match %r{134679}
end
Expand All @@ -43,7 +43,7 @@
it 'is not exposed in the output' do
stdout_str, _status = Open3.capture2e("puppet resource #{common_args} test_sensitive")
expect(stdout_str).to match %r{redacted}
expect(stdout_str).not_to match %r{(foo|bar)secret}
expect(stdout_str).not_to match %r{(sesitive_data|test_resource)secret}
expect(stdout_str).not_to match %r{warn|error}i
end
end
Expand Down

0 comments on commit bd93dba

Please sign in to comment.