rspec-puppet is a framework for testing Puppet code with the rspec BDD framework
Questions tagged [rspec-puppet]
49 questions
1
vote
1 answer
rspec-puppet testing fails due to unavailable gems
I'm trying to write tests for rspec-puppet testing.
The module has the following tree:
|-- manifests
| `-- test_file.pp
|-- Rakefile
`-- spec
|-- classes
|-- defines
| `-- test_file_spec.rb
|--…

Puppeteer
- 63
- 1
- 7
0
votes
1 answer
How do I override hiera_data in rspec-puppet in puppet 6+?
Let's say I have a class that uses automatic hiera lookups:
class foo::file {
file { $foo::file_name:
owner => $foo::owner,
group => $foo::group,
ensure => $foo::ensure,
}
}
The common.yaml for this module contains bindings for…

Cory Ringdahl
- 522
- 5
- 12
0
votes
1 answer
rpsec-puppet functions? Where do they come from?
Obligatory sorry if I'm being a noob but... I'm pretty new to rspec/ruby etc and I'm struggling to figure a few things out. Given the following rspec-puppet snippet:
if os == 'Ubuntu'
let(:facts) do
{
architecture: 'amd64',
…

dwjv
- 1,227
- 9
- 15
0
votes
2 answers
Pupperserver with Adopt-OpenJDK
We are in transition from Puppetmaster 3.8 to Puppet server(OpenSource) 5.3.
As a prerequisite for Puppetserver 5.3 installation requires Java 8 runtime packages. Can we install Adopt-OpenJDK with Pupperserver 5.3?

Yashwanth
- 163
- 1
- 9
0
votes
1 answer
rspec-puppet: cannot find class that is required
So I have a fully functional 'ldap' class.
Now I want to do some stuff for certain users in my ldap directory.
I do this in a new 'users' module, by first making a new defined_type:
define users::admin (
String $sshkey
) {
file…

Falc
- 351
- 2
- 10
0
votes
0 answers
Ruby Undefined method error - Using Beaker
I'm quite new to all of this. I am trying to test out a puppet module using Beaker. I keep getting this:
NoMethodError: undefined method `describe' for…

F. MCF
- 9
- 1
0
votes
1 answer
Why is rspec-puppet behaviour different for hiera lookup using 'lookup' or 'hiera' functions?
Running rake spec tests I am getting:
Warning: The function 'hiera' is deprecated in favor of using 'lookup'. See
https://docs.puppet.com/puppet/4.10/reference/deprecated_language.html
(file & line not available)
So I decided to change to using…

smcp
- 129
- 2
- 8
0
votes
1 answer
Is there a way to match "any value" of a parameter in rspec-puppet
I am testing a resource and I want to check it has exactly the right number of parameters, but one of them is a require, which I haven't figured out how to match in a with. I test that the relationship is correct using that_requires. My current test…

smcp
- 129
- 2
- 8
0
votes
1 answer
rspec-puppet how to test for a define as a member of a class
I have a class which looks like
class addon {
case $::operatingsystem {
'windows': {
Dsc_xfirewall {
dsc_ensure => 'Present',
}
}
'RedHat': {
}
default: { warning "OS : ${::operatingsystem}…

smcp
- 129
- 2
- 8
0
votes
1 answer
puppet-rspec table driven testing
I am trying to to test a type and I have a question: is table driven testing at all possible? I have a class which gets a hash passed to it and I would like to check it with different hash contents, so I would like my test to look…

smcp
- 129
- 2
- 8
0
votes
1 answer
Rspec + puppet: nested fixtures?
i am trying to start using rspec to test some already made (and in production) puppet modules, but this thing keep trying to make me mad.
First off, i am doing a "complete" test with rake. The task is:
Rakefile:
desc 'Validate manifests, templates,…

Techmago
- 380
- 4
- 18
0
votes
1 answer
Can you read the contents of params.pp into a hash in Rspec-puppet?
We'd like to have our Rspec Puppet tests read in the contents of params.pp into a hash and verify there are no unexpected elements in that hash.
All the info I've found describes how to set parameters for testing via let (:params).
We are doing that…

Kenny Drobnack
- 171
- 2
- 12
0
votes
1 answer
Why does rspec-puppet not find my class?
I've created a Puppet module to install AWS Cloudwatch monitoring scripts and set them up. The Puppet module is available here.
When I run rake spec, my test suite fails with:
rspec ./spec/classes/init_spec.rb:4 # cloudwatch with default values for…

JoeNyland
- 280
- 2
- 22
0
votes
1 answer
Rspec Puppet: Defined Type iteration
Using Puppet 3
Testing using rspec-puppet
Iterating over an array of hashes using a Defined Type
Getting an Error, telling me that my parameter (which defaults to the value of $title) cannot be accessed the way I am because it is not an Array or…

CRThaze
- 544
- 3
- 16
0
votes
0 answers
undefined local variable or method `is_expected' for #
I wrote a test as follows:
context "on #{os}" do
it { is_expected.to compile.with_all_deps }
it { is_expected.to create_class('acpid') }
context 'base' do
it { is_expected.to contain_package('acpid').with( :ensure =>…

DWParker
- 1
- 1