Ask Your Question
0

rspec-puppet giving error that all parameters are invalid

asked 2014-02-27 15:50:46 -0600

dgutierrez1287 gravatar image

I'm getting an error in rspec-puppet tests that are paramters are invalid however I believe I'm declaring them properly

in my test I have:

let :params do {
    :adjoin_user => 'centrify-join',
    :adjoin_password => 'join123',
    :adjoin_domain => 'ad.example.com',
    :adjoin_server => 'ad1.ad.example.com',
    :auth_servers => ['ad1.ad.exmaple.com'],
    :users_allow => ['user1'],
    :auto_join => false,
}
end

and then In my params class (which is inherited by my main class)

class centrify::params {

$authservers = [] $usersallow = [] $adjoinuser = ''" $adjoinpassword = ''" $adjoindomain = ''" $adjoinserver = ''" $privategroup = true $autojoin = true }

Thank you in advance for any help.

edit retag flag offensive close merge delete

Comments

the formatting got a bit messed up but in the params class those are all on separate lines

dgutierrez1287 gravatar imagedgutierrez1287 ( 2014-02-27 15:55:40 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-02-28 02:28:45 -0600

doc75 gravatar image

updated 2014-02-28 03:42:57 -0600

The interesting part is not the param class, it defines the default values and will not use the params provided in rspec-puppet. Normally your main class should take parameters like this:

class centrify( $adjoin_user     = $centrify::params::adjoin_user,
                $adjoin_password = $centrify::params::adjoin_password,
                $adjoin_domain   = $centrify::params::adjoin_domain,
                $adjoin_server   = $centrify::params::adjoin_server,
                $auth_servers    = $centrify::params::auth_servers,
                $users_allow     = $centrify::params::users_allow,
                $auto_join       = $centrify::params::auto_join ) inherits centrify::params {
...
}

With this your params defined in rspec-puppet will be provided as input of your main class, assuming that in the rspec-puppet files you have something like:

require 'spec_helper'

describe 'centrify' do
  let :params do {
    ...
  }
  end

...

end ...
(more)
edit flag offensive delete link more

Comments

I'll have to give that a try, my main class does take in the params from the params class like you have shown. I think my mistake was that ...(more)

dgutierrez1287 gravatar imagedgutierrez1287 ( 2014-02-28 06:16:42 -0600 )edit

This is giving me the error that the rspec tests for the install class is not seeing the params

dgutierrez1287 gravatar imagedgutierrez1287 ( 2014-03-07 19:09:20 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-02-27 15:50:46 -0600

Seen: 567 times

Last updated: Feb 28 '14