Hi all, Firstly, I''m using 2.6.9 and have updated to the latest cucumber puppet gems (cucumber-puppet 0.3.5) that allow for storeconfigs to be tested - thanks to Nikolay and his post (http://blog.nistu.de/ 2011/09/04/testing-exported-resources-with-cucumber-puppet/). Yay! I have been trying to get some testing of a ''testnode'' which would be a generic node that I can use to test all the developer contributed modules against before they get merged into trunk. I want to run a test like this: Feature: php In order to run a client webserver As an admin I want zend php to be installed Scenario: Installing PHP Given a node of class "roles::prod_webserver" with parameters: | name | value | | php_type | php_zend | When I compile the catalog Then package "zend-server-ce-php-5.3" should be "present" ...... ...... The issue here is that class roles::prod_webserver doesn''t expect to be passed any values, but there is a bunch of ymllookups that pull values in from local yaml files. This causes errors when it complains about either invalid parameter (which it is in the above example) or failed lookup of value when I remove those parameters. Is there a way that I can express those values in my features file or are there any hints anyone can provide to get around this? TIA Den -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
* denmat [2011-09-12]:> The issue here is that class roles::prod_webserver doesn''t expect to > be passed any values, but there is a bunch of ymllookups that pull > values in from local yaml files. This causes errors when it complains > about either invalid parameter (which it is in the above example) or > failed lookup of value when I remove those parameters.Please provide me with a minimal example to reproduce your problem and I''ll have a look. cheers, Nikolay -- "It''s all part of my Can''t-Do approach to life." Wally -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
tu2Bgone@gmail.com
2011-Sep-15 00:44 UTC
Re: Re: [Puppet Users] cucumber puppet - ymllookups
Thanks for the reply Nikolay, If I have a class like the following: class role { $myrole = ymllookup(''web_role'') notify{"this is my role: $myrole": } } I then use the ymllookup parser that I grabbed from http://projects.puppetlabs.com/attachments/1297/ymllookup.rb which will parse my /etc/puppet/manifest/extdata directory looking for assignments of the ''web_role'' - using the following precedence. # For external lookups $ymllookup_datadir = "/etc/puppet/manifests/extdata" $ymllookup_precedence = ["node/%{fqdn}", "location/%{location}", "role/%{hitwise_role}", "common/common"] So I would have something like cat /etc/puppet/manifest/extdata/node/testnode.yml web_role: ''php_zend'' I create the module feature like so: cat features/modules/role/role.feature Feature: role In order to run a client webserver As a admin I want role to be installed Scenario: testing role Given a node specified by "features/yaml/testnode.yaml" Given a node of class "role" When I compile the catalog Then the node should notify "this is my role: php_zend" and it runs like this: Feature: role In order to run a client webserver As a admin I want role to be installed Scenario: testing role # features/modules/role/role.feature:6 Given a node specified by "features/yaml/testnode.yaml" # cucumber-puppet-0.3.5/lib/cucumber-puppet/steps.rb:1 Given a node of class "role" # features/steps/puppet.rb:1 When I compile the catalog # features/steps/puppet.rb:25 No match found for ''web_role'' in any data file during ymllookup() at /home/dennism/workspace/ChangeControl/puppet/trunk/modules/role/manifests/init.pp:2 on node testnode (Puppet::Error) /usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:30:in `compile'' /usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:198:in `benchmark'' /usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'' /usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'' /usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:188:in `find'' ./features/steps/puppet.rb:26:in `/^I compile the catalog$/'' features/modules/role/role.feature:9:in `When I compile the catalog'' Then the node should notify "this is my role: php_zend" # features/steps/puppet.rb:41 Failing Scenarios: cucumber features/modules/role/role.feature:6 # Scenario: testing role 1 scenario (1 failed) 4 steps (1 failed, 1 skipped, 2 passed) That help? Cheers, Den On , Nikolay Sturm <google@erisiandiscord.de> wrote:> * denmat [2011-09-12]:> > The issue here is that class roles::prod_webserver doesn''t expect to> > be passed any values, but there is a bunch of ymllookups that pull> > values in from local yaml files. This causes errors when it complains> > about either invalid parameter (which it is in the above example) or> > failed lookup of value when I remove those parameters.> Please provide me with a minimal example to reproduce your problem and> I''ll have a look.> cheers,> Nikolay> --> "It''s all part of my Can''t-Do approach to life." Wally> --> You received this message because you are subscribed to the Google > Groups "Puppet Users" group.> To post to this group, send email to puppet-users@googlegroups.com.> To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com.> For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
* tu2Bgone@gmail.com [2011-09-15]:> # For external lookups > $ymllookup_datadir = "/etc/puppet/manifests/extdata" > $ymllookup_precedence = ["node/%{fqdn}", "location/%{location}", > "role/%{hitwise_role}", "common/common"]From the error message I guess that features/yaml/testnode.yaml defines the node''s fqdn to something other than ''testnode''.> Scenario: testing role > Given a node specified by "features/yaml/testnode.yaml" > Given a node of class "role"This should not work as the yaml specification takes precedence over explicit class. Instead I''d use Given a node of class "role" And an "fqdn" of "testnode" with Given /^an? "([^\"]*)" of "([^\"]*)"$/ |fact, value| @facts[fact] = value end HTH, Nikolay -- "It''s all part of my Can''t-Do approach to life." Wally -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.