llowder@oreillyauto.com
2012-Jul-19 17:43 UTC
[Puppet Users] puppet-spec-helper / rspec and hiera
I am trying to write some rspec tests for my modules. Most of them now use hiera. I have a .fixures.yml: ----------------------------------------------------------------------------------- fixtures: repositories: stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git hiera-puppet: https://github.com/puppetlabs/hiera-puppet.git symlinks: mongodb: "#{source_dir}" ----------------------------------------------------------------------------------- and a spec/classes/mongodb_spec.rb: ----------------------------------------------------------------------------------- require ''spec_helper'' describe ''mongodb'', :type => ''class'' do context "On an Ubuntu install, admin and single user" do let :facts do { :osfamily => ''Debian'', :operatingsystem => ''Ubuntu'', :operatingsystemrelease => ''12.04'' } end it { should contain_user(''XXXX'').with( { ''uid'' => ''***'' } ) should contain_group(''XXXX'').with( { ''gid'' => ''***'' } ) should contain_package(''mongodb'').with( { ''name'' => ''mongodb'' } ) should contain_service(''mongodb'').with( { ''name'' => ''mongodb'' } ) } end end ----------------------------------------------------------------------------------- but when I run the spec test, I get: ----------------------------------------------------------------------------------- # rake spec /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color F Failures: 1) mongodb On an Ubuntu install, admin and single user Failure/Error: should contain_user(''XXXX'').with( { ''uid'' => ''***'' } ) LoadError: no such file to load -- hiera_puppet # ./spec/fixtures/modules/hiera-puppet/lib/puppet/parser/functions/hiera.rb:3:in `function_hiera'' # ./spec/classes/mongodb_spec.rb:15 Finished in 0.05415 seconds 1 example, 1 failure Failed examples: rspec ./spec/classes/mongodb_spec.rb:14 # mongodb On an Ubuntu install, admin and single user rake aborted! /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color failed Tasks: TOP => spec_standalone (See full trace by running task with --trace) ----------------------------------------------------------------------------------- What did I do wrong? Most of my modules use hiera now, or soon will, so gettng this figured out whould realyl help. I am using Ubuntu 12.04 LTS, puppet 2.7.17 and hiera 0.3.0. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/TpsfjrGkjEYJ. 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.
Bill O''Neill
2012-Jul-19 22:09 UTC
[Puppet Users] Re: puppet-spec-helper / rspec and hiera
I ran into the same issue. The workaround is to checkout the v0.3.0 tag of hiera-puppet. Since I couldn''t figure out a way to do it via the .fixtures.yml file I created a new rake task in Rakefile: desc "Checkout the correct tag release of hiera" task :spec_prep_hiera do Rake::Task[:spec_prep].invoke system("cd spec/fixtures/modules/hiera-puppet && git checkout v0.3.0") end On Thursday, July 19, 2012 1:43:22 PM UTC-4, llo...@oreillyauto.com wrote:> > I am trying to write some rspec tests for my modules. Most of them now use > hiera. > > I have a .fixures.yml: > > > ----------------------------------------------------------------------------------- > > fixtures: > repositories: > stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git > hiera-puppet: https://github.com/puppetlabs/hiera-puppet.git > symlinks: > mongodb: "#{source_dir}" > > > ----------------------------------------------------------------------------------- > > and a spec/classes/mongodb_spec.rb: > > > ----------------------------------------------------------------------------------- > > require ''spec_helper'' > > describe ''mongodb'', :type => ''class'' do > > context "On an Ubuntu install, admin and single user" do > let :facts do > { > :osfamily => ''Debian'', > :operatingsystem => ''Ubuntu'', > :operatingsystemrelease => ''12.04'' > } > end > > it { > should contain_user(''XXXX'').with( { ''uid'' => ''***'' } ) > should contain_group(''XXXX'').with( { ''gid'' => ''***'' } ) > should contain_package(''mongodb'').with( { ''name'' => ''mongodb'' } ) > should contain_service(''mongodb'').with( { ''name'' => ''mongodb'' } ) > } > end > end > > ----------------------------------------------------------------------------------- > > > but when I run the spec test, I get: > > > ----------------------------------------------------------------------------------- > > # rake spec > /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color > F > > Failures: > > 1) mongodb On an Ubuntu install, admin and single user > Failure/Error: should contain_user(''XXXX'').with( { ''uid'' => ''***'' } ) > LoadError: > no such file to load -- hiera_puppet > # > ./spec/fixtures/modules/hiera-puppet/lib/puppet/parser/functions/hiera.rb:3:in > `function_hiera'' > # ./spec/classes/mongodb_spec.rb:15 > > Finished in 0.05415 seconds > 1 example, 1 failure > > Failed examples: > > rspec ./spec/classes/mongodb_spec.rb:14 # mongodb On an Ubuntu install, > admin and single user > rake aborted! > /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color failed > > Tasks: TOP => spec_standalone > (See full trace by running task with --trace) > > ----------------------------------------------------------------------------------- > > What did I do wrong? Most of my modules use hiera now, or soon will, so > gettng this figured out whould realyl help. > > I am using Ubuntu 12.04 LTS, puppet 2.7.17 and hiera 0.3.0. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/5p5FFvrZ_L8J. 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.
llowder@oreillyauto.com
2012-Jul-20 16:45 UTC
[Puppet Users] Re: puppet-spec-helper / rspec and hiera
On Thursday, July 19, 2012 5:09:30 PM UTC-5, Bill O''Neill wrote:> > I ran into the same issue. The workaround is to checkout the v0.3.0 tag of > hiera-puppet. > > Since I couldn''t figure out a way to do it via the .fixtures.yml file I > created a new rake task in Rakefile: > > desc "Checkout the correct tag release of hiera" > task :spec_prep_hiera do > Rake::Task[:spec_prep].invoke > system("cd spec/fixtures/modules/hiera-puppet && git checkout v0.3.0") > end > >I tried this, and I am getting the same error as before.> > On Thursday, July 19, 2012 1:43:22 PM UTC-4, llo...@oreillyauto.com wrote: >> >> I am trying to write some rspec tests for my modules. Most of them now >> use hiera. >> >> I have a .fixures.yml: >> >> >> ----------------------------------------------------------------------------------- >> >> fixtures: >> repositories: >> stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git >> hiera-puppet: https://github.com/puppetlabs/hiera-puppet.git >> symlinks: >> mongodb: "#{source_dir}" >> >> >> ----------------------------------------------------------------------------------- >> >> and a spec/classes/mongodb_spec.rb: >> >> >> ----------------------------------------------------------------------------------- >> >> require ''spec_helper'' >> >> describe ''mongodb'', :type => ''class'' do >> >> context "On an Ubuntu install, admin and single user" do >> let :facts do >> { >> :osfamily => ''Debian'', >> :operatingsystem => ''Ubuntu'', >> :operatingsystemrelease => ''12.04'' >> } >> end >> >> it { >> should contain_user(''XXXX'').with( { ''uid'' => ''***'' } ) >> should contain_group(''XXXX'').with( { ''gid'' => ''***'' } ) >> should contain_package(''mongodb'').with( { ''name'' => ''mongodb'' } ) >> should contain_service(''mongodb'').with( { ''name'' => ''mongodb'' } ) >> } >> end >> end >> >> ----------------------------------------------------------------------------------- >> >> >> but when I run the spec test, I get: >> >> >> ----------------------------------------------------------------------------------- >> >> # rake spec >> /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color >> F >> >> Failures: >> >> 1) mongodb On an Ubuntu install, admin and single user >> Failure/Error: should contain_user(''XXXX'').with( { ''uid'' => ''***'' } ) >> LoadError: >> no such file to load -- hiera_puppet >> # >> ./spec/fixtures/modules/hiera-puppet/lib/puppet/parser/functions/hiera.rb:3:in >> `function_hiera'' >> # ./spec/classes/mongodb_spec.rb:15 >> >> Finished in 0.05415 seconds >> 1 example, 1 failure >> >> Failed examples: >> >> rspec ./spec/classes/mongodb_spec.rb:14 # mongodb On an Ubuntu install, >> admin and single user >> rake aborted! >> /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color failed >> >> Tasks: TOP => spec_standalone >> (See full trace by running task with --trace) >> >> ----------------------------------------------------------------------------------- >> >> What did I do wrong? Most of my modules use hiera now, or soon will, so >> gettng this figured out whould realyl help. >> >> I am using Ubuntu 12.04 LTS, puppet 2.7.17 and hiera 0.3.0. >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/lZt3qBrmgCUJ. 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.
llowder@oreillyauto.com
2012-Jul-30 18:45 UTC
[Puppet Users] Re: puppet-spec-helper / rspec and hiera
Just wanted to bump this and see if anyone else had any ideas I could try... Still unable to get any tests functioning at this point. Full details are in this thread, and also at http://serverfault.com/q/409297/121905 Thank you. On Friday, July 20, 2012 11:45:47 AM UTC-5, llo...@oreillyauto.com wrote:> > > > On Thursday, July 19, 2012 5:09:30 PM UTC-5, Bill O''Neill wrote: >> >> I ran into the same issue. The workaround is to checkout the v0.3.0 tag >> of hiera-puppet. >> >> Since I couldn''t figure out a way to do it via the .fixtures.yml file I >> created a new rake task in Rakefile: >> >> desc "Checkout the correct tag release of hiera" >> task :spec_prep_hiera do >> Rake::Task[:spec_prep].invoke >> system("cd spec/fixtures/modules/hiera-puppet && git checkout v0.3.0") >> end >> >> > I tried this, and I am getting the same error as before. > > >> >> On Thursday, July 19, 2012 1:43:22 PM UTC-4, llo...@oreillyauto.comwrote: >>> >>> I am trying to write some rspec tests for my modules. Most of them now >>> use hiera. >>> >>> I have a .fixures.yml: >>> >>> >>> ----------------------------------------------------------------------------------- >>> >>> fixtures: >>> repositories: >>> stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git >>> hiera-puppet: https://github.com/puppetlabs/hiera-puppet.git >>> symlinks: >>> mongodb: "#{source_dir}" >>> >>> >>> ----------------------------------------------------------------------------------- >>> >>> and a spec/classes/mongodb_spec.rb: >>> >>> >>> ----------------------------------------------------------------------------------- >>> >>> require ''spec_helper'' >>> >>> describe ''mongodb'', :type => ''class'' do >>> >>> context "On an Ubuntu install, admin and single user" do >>> let :facts do >>> { >>> :osfamily => ''Debian'', >>> :operatingsystem => ''Ubuntu'', >>> :operatingsystemrelease => ''12.04'' >>> } >>> end >>> >>> it { >>> should contain_user(''XXXX'').with( { ''uid'' => ''***'' } ) >>> should contain_group(''XXXX'').with( { ''gid'' => ''***'' } ) >>> should contain_package(''mongodb'').with( { ''name'' => ''mongodb'' } ) >>> should contain_service(''mongodb'').with( { ''name'' => ''mongodb'' } ) >>> } >>> end >>> end >>> >>> ----------------------------------------------------------------------------------- >>> >>> >>> but when I run the spec test, I get: >>> >>> >>> ----------------------------------------------------------------------------------- >>> >>> # rake spec >>> /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color >>> F >>> >>> Failures: >>> >>> 1) mongodb On an Ubuntu install, admin and single user >>> Failure/Error: should contain_user(''XXXX'').with( { ''uid'' => ''***'' } >>> ) >>> LoadError: >>> no such file to load -- hiera_puppet >>> # >>> ./spec/fixtures/modules/hiera-puppet/lib/puppet/parser/functions/hiera.rb:3:in >>> `function_hiera'' >>> # ./spec/classes/mongodb_spec.rb:15 >>> >>> Finished in 0.05415 seconds >>> 1 example, 1 failure >>> >>> Failed examples: >>> >>> rspec ./spec/classes/mongodb_spec.rb:14 # mongodb On an Ubuntu install, >>> admin and single user >>> rake aborted! >>> /usr/bin/ruby1.8 -S rspec spec/classes/mongodb_spec.rb --color failed >>> >>> Tasks: TOP => spec_standalone >>> (See full trace by running task with --trace) >>> >>> ----------------------------------------------------------------------------------- >>> >>> What did I do wrong? Most of my modules use hiera now, or soon will, so >>> gettng this figured out whould realyl help. >>> >>> I am using Ubuntu 12.04 LTS, puppet 2.7.17 and hiera 0.3.0. >>> >>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/Qqxs3wzSBEUJ. 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.