Bug 787350 - Review Request: rubygem-rspec-puppet - RSpec tests for your Puppet manifests
Summary: Review Request: rubygem-rspec-puppet - RSpec tests for your Puppet manifests
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bohuslav "Slavek" Kabrda
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-04 10:32 UTC by Michael S.
Modified: 2021-04-28 14:53 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-02 09:47:34 UTC
Type: ---
bkabrda: fedora-review?


Attachments (Terms of Use)

Description Michael S. 2012-02-04 10:32:13 UTC
Spec URL: http://www.ephaone.org/~misc/specs/rubygem-rspec-puppet.spec
SRPM URL: http://www.ephaone.org/~misc/specs/rubygem-rspec-puppet-0.1.1-1.fc16.src.rpm
Description: RSpec tests for your Puppet manifests 

This package add various modules used to create non regression tests based on RSpec for puppet manifests.

Comment 1 Bohuslav "Slavek" Kabrda 2012-05-07 08:03:07 UTC
Taking this one.

Comment 2 Bohuslav "Slavek" Kabrda 2012-05-07 08:13:06 UTC
Ok, so first of all, you should use the macros from rubygem-devel package, which is available from F17 above. [1] Also, please note, that ruby(abi) is 1.9.1 for these.
- If you want to use the package in F16 and below or EPEL, you will need to define the all the macros (gem_name, gem_dir, ...) conditionally.
- You should mark the LICENSE file as %doc (but leave it in the main package).
- You should also mark the README file as %doc, but probably move it to the -doc subpackage.

- Otherwise, it would be good to proceed once you convert the specfile to the F17 way (you can use the newest gem2rpm for that).


[1] https://fedoraproject.org/wiki/Packaging:Ruby#Macros

Comment 3 Michael S. 2012-05-21 20:14:09 UTC
Ok, i first need to review the new ruby policy, I have put aside this package until the release of fedora 17 ( waiting until the policy got a little bit more stable and having more time ).

Comment 4 Greg Swift 2012-10-09 23:33:31 UTC
Spec URL: http://nytefyre.net/rpms/rubygem-rspec-puppet.spec
SRPM URL: http://http://nytefyre.net/rpms/rubygem-rspec-puppet-0.1.5-1.fc17.src.rpm

So I checked this out and think I've got a revised version working.  I've tested the build on f17 and centos6 (centos5 blew up.. gem had a buffer overflow )

I'm willing to go forward with this package, if you aren't available to continue reviewing this can you let me know so that I can look for a reviewer.  thanks!

Comment 5 Bohuslav "Slavek" Kabrda 2012-10-10 05:55:28 UTC
Looks much better now, but still some comments:
- License is MIT (see the LICENSE file)
- Please run specs in %check section, it's always good to make sure that the tests provided with package work on Fedora

Comment 6 Vít Ondruch 2012-10-10 13:42:17 UTC
* puppet dependency
  - It seems that there should be Require: puppet, otherwise I get these errors:

$ rspec-puppet-init 
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': cannot load such file -- puppet (LoadError)
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/gems/gems/rspec-puppet-0.1.5/lib/rspec-puppet.rb:1:in `<top (required)>'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/gems/gems/rspec-puppet-0.1.5/bin/rspec-puppet-init:5:in `<top (required)>'
	from /usr/bin/rspec-puppet-init:23:in `load'
	from /usr/bin/rspec-puppet-init:23:in `<main>'

$ irb
irb(main):001:0> require 'rspec-puppet'
LoadError: cannot load such file -- puppet
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/gems/gems/rspec-puppet-0.1.5/lib/rspec-puppet.rb:1:in `<top (required)>'
	from /usr/share/rubygems/rubygems/custom_require.rb:60:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:60:in `rescue in require'
	from /usr/share/rubygems/rubygems/custom_require.rb:35:in `require'
	from (irb):2
	from /usr/bin/irb:12:in `<main>'

* Missing puppetlabs_spec_helper dependency
  - After installing puppet, I got another error (show bellow). So it seems
    there is missing another prerequisite in Fedora. However it looks like to
    be circular dependency and bootstrap might be required :/

$ irb
irb(main):001:0> require 'rspec-puppet'
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
LoadError: cannot load such file -- puppetlabs_spec_helper/puppetlabs_spec/puppet_internals
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/gems/gems/rspec-puppet-0.1.5/lib/rspec-puppet/example/function_example_group.rb:1:in `<top (required)>'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/gems/gems/rspec-puppet-0.1.5/lib/rspec-puppet/example.rb:4:in `<top (required)>'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/gems/gems/rspec-puppet-0.1.5/lib/rspec-puppet.rb:6:in `<top (required)>'
	from /usr/share/rubygems/rubygems/custom_require.rb:60:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:60:in `rescue in require'
	from /usr/share/rubygems/rubygems/custom_require.rb:35:in `require'
	from (irb):1
	from /usr/bin/irb:12:in `<main>'

Comment 7 Greg Swift 2012-10-10 15:51:29 UTC
So from the original spec file:

%check
# disabled because this segfault in mock
# requires to have a working setup of puppet
# see 
# https://github.com/rodjek/rspec-puppet/issues/15
# https://projects.puppetlabs.com/issues/11191
#mkdir -p ~/.puppet/manifests/
#touch ~/.puppet/manifests/site.pp
#cd %{buildroot}%{geminstdir}
#rake spec --trace

I can add it in commented, and I should have since I saw it in the original, but it doesn't seem to be a 'good' idea to enable based on this.

Thoughts?

Comment 8 Vít Ondruch 2012-10-11 05:41:19 UTC
The test suite pases for me:

$ rspec
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.......................

Finished in 0.69772 seconds
23 examples, 0 failures


However, I had to install the puppet_labs_helper which pulled in other dependencies:

$ gem list

*** LOCAL GEMS ***

bigdecimal (1.1.0)
diff-lcs (1.1.3)
io-console (0.3)
json (1.6.5)
metaclass (0.0.1)
mocha (0.12.6)
puppetlabs_spec_helper (0.3.0)
rake (0.9.2.2)
rdoc (3.12)
rspec (2.11.0, 2.8.0)
rspec-core (2.11.1, 2.8.0)
rspec-expectations (2.11.3, 2.8.0)
rspec-mocks (2.11.3, 2.8.0)
rspec-puppet (0.1.5)

So there is a chance that the test suite will run as soon as the dependencies will be available.

Comment 9 Vít Ondruch 2012-10-11 05:42:39 UTC
Please note that I did not need to create the site.pp file or anything else.

Comment 10 Bohuslav "Slavek" Kabrda 2012-10-11 06:26:10 UTC
As Vit points out, the specs are runnable with the puppetlabs_spec_helper Gem, so I would advise to first package that one. As mentioned in Comment 6, it is also needed to do "require 'rspec-puppet'", e.g. this Gem won't work without it. So please first package puppetlabs_spec_helper.

Comment 11 Russell Harrison 2012-12-06 00:16:48 UTC
(In reply to comment #10)
> As Vit points out, the specs are runnable with the puppetlabs_spec_helper
> Gem, so I would advise to first package that one. As mentioned in Comment 6,
> it is also needed to do "require 'rspec-puppet'", e.g. this Gem won't work
> without it. So please first package puppetlabs_spec_helper.

This is where things get entertaining.  From puppetlabs_spec_helper.gemspec :

s.add_dependency(%q<rspec-puppet>, [">= 0.1.1"])

So in order to install puppetlabs_spec_helper rspec-puppet needs to already be there.  However to actually run rspec-puppet you need puppetlabs_spec_helper...

https://github.com/rodjek/rspec-puppet/issues/56

Is this a full stop issue until upstream sorts things out?

Comment 12 Russell Harrison 2013-02-20 12:29:44 UTC
I've filed an upstream bug against puppetlabs_spec_helper to refactor the gem to no longer require rspec-puppet but it's gotten no response.  https://projects.puppetlabs.com/issues/18913

Thankfully the maintainer of rspec-puppet has committed to refactoring his gem so that it will no longer require puppetlabs_spec_helper in order to resolve the circular dependency issue.
https://github.com/rodjek/rspec-puppet/issues/56#issuecomment-12667834

Comment 13 Vladimir Rusinov 2015-04-25 14:22:05 UTC
Looks like rspec-puppet folks submitted a workaround: https://github.com/rodjek/rspec-puppet/issues/56

It's not ideal but as far as I can see there should be no dependency cycle anymore.

Comment 14 Bohuslav "Slavek" Kabrda 2015-07-02 09:47:34 UTC
Since there seems to be no progress here, I'm closing this bug. Feel free to reopen if you wish to restart the review.

Comment 15 Bogdan Dobrelya 2021-04-28 14:53:03 UTC
We still might want to bring that package into RDO. There is ongoing work with pre-generating puppet catalogs that relies on that puppet-rspec gem to present in puppet config containers...


Note You need to log in before you can comment on or make changes to this bug.