On 8/14/14 4:58 PM, Sebastian Otaegui wrote: > Hi Garrett, > > thanks, just to clarify and make sure I understood, so it is not running > the spec.rb files in apt/spec/* but it is just evaluating the facts > within the puppet runtime in the apt/manifest/*.pp, right? > > Thanks > > On Thu, Aug 14, 2014 at 3:27 PM, Garrett Honeycutt > <g...@garretthoneycutt.com <mailto:g...@garretthoneycutt.com>> wrote: > > On 8/14/14 3:56 PM, Sebastian Otaegui wrote: > > I created a small POC module using puppet from master and `puppet > module > > generate` > > > > I still have rspec-puppet go inside the apt module in fixtures and > > execute the tests: > > > > Failures: > > > > 1) poc with defaults for all parameters should contain Class[poc] > > Failure/Error: it { should contain_class('poc') } > > Puppet::Error: > > This module only works on Debian or derivatives like Ubuntu at > > > > /Users/otaeguis/projects/src/test-poc/spec/fixtures/modules/apt/manifests/init.pp:43 > > on node feniixhq.10.208.50.91 > > # ./spec/classes/init_spec.rb:5:in `block (3 levels) in <top > > (required)>' > > > > Here is a link to the puppet module with the > > POC https://github.com/feniix/puppet-module-rspec-issue > > > > Appreciate some guidance on how to solve this. > > > > > > > > On Wed, Aug 13, 2014 at 10:30 PM, Garrett Honeycutt > > <g...@garretthoneycutt.com <mailto:g...@garretthoneycutt.com> > <mailto:g...@garretthoneycutt.com <mailto:g...@garretthoneycutt.com>>> > wrote: > > > > On 8/13/14 9:08 PM, Wil Cooley wrote: > > > > > > On Aug 12, 2014 11:57 AM, "Sebastian Otaegui" > <fen...@gmail.com <mailto:fen...@gmail.com> > > <mailto:fen...@gmail.com <mailto:fen...@gmail.com>> > > > <mailto:fen...@gmail.com <mailto:fen...@gmail.com> > <mailto:fen...@gmail.com <mailto:fen...@gmail.com>>>> wrote: > > >> > > >> Hello all, > > >> > > >> I have created this module: > > >> > > >> https://github.com/Spantree/puppet-thrift and everything > worked fine > > > all specs ran fine. > > >> > > >> Now I using the puppetlabs/apt module and when I run the > 'rake spec' > > > it is trying to run the 'apt' tests, and it is failing (I think) > > because > > > I am not providing the appropriate facts. > > >> > > >> Is there a way to ignore the rspecs inside the > fixtures/modules/ > > > directory? > > >> > > >> I tried to do this: > > >> > > >> require 'rake' > > >> require 'rspec/core/rake_task' > > >> > > >> RSpec::Core::RakeTask.new(:spec) do |t| > > >> t.pattern = 'spec/*/*_spec.rb' > > >> end > > >> > > >> But it didn't work. > > >> > > > > > > How about just: > > > > > > require 'puppetlabs_spec_helper/rake_tasks' > > > > Hi, > > > > +1 to Will Cooley. > > > > When you generate a module with `puppet module generate` it > will use > > that single line. > > > > > > https://github.com/puppetlabs/puppet/blob/master/lib/puppet/module_tool/skeleton/templates/generator/spec/spec_helper.rb > > > > Best regards, > > -g > > > > -- > > Garrett Honeycutt > > @learnpuppet > > Puppet Training with LearnPuppet.com > > Mobile: +1.206.414.8658 <tel:%2B1.206.414.8658> > <tel:%2B1.206.414.8658> > > > > Hi Sebastian, > > Your issue is because the module in question is failing if certain facts > are not set. In puppetlabs/apt the module fails[1] if $osfamily is not > 'Debian'. For your spec tests to succeed you need to set the osfamily > fact to Debian. > > [1] - > > https://github.com/puppetlabs/puppetlabs-apt/blob/master/manifests/init.pp#L43-45 > > Best regards, > -g > > -- > Garrett Honeycutt > @learnpuppet > Puppet Training with LearnPuppet.com > Mobile: +1.206.414.8658 <tel:%2B1.206.414.8658> >
Sebastian, Yes. Your manifests include 'apt'. That code needs the osfamily fact and since it is not set to to Debian, the code fails and returns the error to your spec tests. You are not evaluating spec tests under apt. You can see this by changing the output of rspec. Try this before running your spec tests. export SPEC_OPTS="--format documentation" Best regards, -g -- Garrett Honeycutt @learnpuppet Puppet Training with LearnPuppet.com Mobile: +1.206.414.8658 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/53ED2B8E.5090207%40garretthoneycutt.com. For more options, visit https://groups.google.com/d/optout.