Sha256: 6f6c3d8ffbf8a9d59a24aa5a48ac073347813ad2c42eb8376e108e3bc743c05e

Contents?: true

Size: 1.27 KB

Versions: 264

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'
require 'puppet_spec/compiler'

describe Puppet::Type.type(:notify) do
  include PuppetSpec::Compiler

  it "logs the title at notice level" do
    apply_compiled_manifest(<<-MANIFEST)
      notify { 'hi': }
    MANIFEST

    expect(@logs).to include(an_object_having_attributes(level: :notice, message: 'hi'))
  end

  it "logs the message property" do
    apply_compiled_manifest(<<-MANIFEST)
      notify { 'title':
        message => 'hello'
      }
    MANIFEST

    expect(@logs).to include(an_object_having_attributes(level: :notice, message: "defined 'message' as 'hello'"))
  end

  it "redacts sensitive message properties" do
    apply_compiled_manifest(<<-MANIFEST)
      $message = Sensitive('secret')
      notify { 'notify1':
        message => $message
      }
    MANIFEST

    expect(@logs).to include(an_object_having_attributes(level: :notice, message: 'changed [redacted] to [redacted]'))
  end

  it "redacts sensitive interpolated message properties" do
    apply_compiled_manifest(<<-MANIFEST)
      $message = Sensitive('secret')
      notify { 'notify2':
        message => "${message}"
      }
    MANIFEST

    expect(@logs).to include(an_object_having_attributes(level: :notice, message: "defined 'message' as 'Sensitive [value redacted]'"))
  end
end

Version data entries

264 entries across 264 versions & 1 rubygems

Version Path
puppet-6.27.0 spec/integration/type/notify_spec.rb
puppet-6.27.0-x86-mingw32 spec/integration/type/notify_spec.rb
puppet-6.27.0-x64-mingw32 spec/integration/type/notify_spec.rb
puppet-6.27.0-universal-darwin spec/integration/type/notify_spec.rb
puppet-7.16.0 spec/integration/type/notify_spec.rb
puppet-7.16.0-x86-mingw32 spec/integration/type/notify_spec.rb
puppet-7.16.0-x64-mingw32 spec/integration/type/notify_spec.rb
puppet-7.16.0-universal-darwin spec/integration/type/notify_spec.rb
puppet-7.15.0 spec/integration/type/notify_spec.rb
puppet-7.15.0-x86-mingw32 spec/integration/type/notify_spec.rb
puppet-7.15.0-x64-mingw32 spec/integration/type/notify_spec.rb
puppet-7.15.0-universal-darwin spec/integration/type/notify_spec.rb
puppet-6.26.0 spec/integration/type/notify_spec.rb
puppet-6.26.0-x86-mingw32 spec/integration/type/notify_spec.rb
puppet-6.26.0-x64-mingw32 spec/integration/type/notify_spec.rb
puppet-6.26.0-universal-darwin spec/integration/type/notify_spec.rb
puppet-7.14.0 spec/integration/type/notify_spec.rb
puppet-7.14.0-x86-mingw32 spec/integration/type/notify_spec.rb
puppet-7.14.0-x64-mingw32 spec/integration/type/notify_spec.rb
puppet-7.14.0-universal-darwin spec/integration/type/notify_spec.rb