I have define function and writing puppet-rspec for this.
define test-define {
$app_type = $name ? {
'type1' => $type1_script_dirs,
'type2' => $type2_script_dirs,
'type3' => $type3_script_dirs,
'type4' => $type4_script_dirs,
default => fail("Unknown app name : ${name}"),
}
exec { "${app_type}" :
command => "some command",
}
}
And from one of the class in the same module this function has been called with values type1, type2, type3 and type4. So there are already 4 exec added to the catalog with type1, type2, type3 and type4.
Now when I write rspec for this define, I am passing title like below:
let(:title) { 'another-type' }
When I execute rspec I am getting the below error,
Function 'fail' does not return a value
Also I can't pass any vales from type1, type2, type3 and type4 because all these 4 values are already added to the catalog from another class. So when I pass type1 I am getting duplicate declaration.
↧