How to test apt w/ class that uses apt::source?

16 views
Skip to first unread message

Joaquin Menchaca

unread,
May 3, 2018, 4:12:33 AM5/3/18
to Puppet Users


I am using nginx package from nginx folks.  I used the apt::source like this:



The documentation is fairly decent for standard resources like package and stuff, e.g.

  it { is_expected.to contain_package('nginx').with(ensure: 'present') }

I am wondering how I could go about testing this, adding to my spec/classes/install_spec.rb. for the apt::source in particular. I haven't found anything on this yet.

I scaffolded my classes and spec/ structure using PDK.
Auto Generated Inline Image 1

a...@example42.com

unread,
May 3, 2018, 5:47:38 AM5/3/18
to Puppet Users
You can use rpec puppet expectations for any resource type, so something like this should work:

  it { is_expected.to contain_apt__source('nginx').with( ... }

Joaquin Menchaca

unread,
May 3, 2018, 3:47:08 PM5/3/18
to Puppet Users
Thank you so much.  Worked like a charm. 

Reply all
Reply to author
Forward
0 new messages