pdk test unit failing due to unknown variable from container class

asked 2018-02-27 09:23:18 -0600

poncos_2018 gravatar image

updated 2018-02-28 11:21:56 -0600

DarylW gravatar image

Hello, I am developing a new module and following another examples, I have a main class which contains another class, and from this second class I try to access the parameters available in the main class. Something like this:

class main_class ( String
$mainparameter ){ contain main_class::second_class }

class main_class::second_class {
  file { $main_class::mainparameter:
    ensure => directory,
    mode => '0755',
    owner => 'root',
    group => 'root'

And the error I get is like this:

failed: rspec: ./spec/classes/simdownload_spec.rb:8: error during compilation: Evaluation Error: Unknown variable: 'mainclass::main_parameter'.

Anyone could help please? Thanks, Esteban Collado

edit retag flag offensive close merge delete


@poncos_2018 can you update your question to include your test file as well?

rodjek gravatar imagerodjek ( 2018-03-06 17:29:17 -0600 )edit