Unit-Testing/test: recommended method?

107 views
Skip to first unread message

Andreas Haerter

unread,
Dec 13, 2012, 2:01:01 PM12/13/12
to puppet...@googlegroups.com
Hi,

is there any "officially" recommended default/standard method to realize
Puppet module unit test beyond linting (puppet-lint)? Compatibility to
version < 3.x is nice but NOT needed.


My main questions are:

1) I know there are different, well-known methods:
- Test::Unit
- rspec-puppet
- cucumber-puppet

Is there anything missing worth a look? Which are deprecated, wich are
future-proof?



2) There are helpful blog postings and articles out there [1] [2] [3]
[4]. However, none of them gives me a clue if there is a commonly
recommended tool/method to implement Unit test, some kind of
"use X because everybody is using it, you won't get compatibility issues
and the dev-community behind is healthy".

A hint out of e.g. Puppet Labs or experienced community members
Point-of-View would be very helpful. Are there any recommendations?
Getting familiar with testing needs some work which I don't want to
invest into the wrong candidate/method/tools. ;-)



[1] <http://puppetlabs.com/blog/testing-modules-in-the-puppet-forge/>
[2]
<http://bombasticmonkey.com/2012/03/02/automatically-test-your-puppet-modules-with-travis-ci/>
[3] <http://puppetlabs.com/blog/testing-modules-in-the-puppet-forge/>
[4]
<http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests>


--
Andreas <http://blog.andreas-haerter.com>

signature.asc

Nan Liu

unread,
Dec 13, 2012, 2:42:19 PM12/13/12
to puppet...@googlegroups.com
On Thu, Dec 13, 2012 at 11:01 AM, Andreas Haerter <list+pup...@mail-node.com> wrote:
Hi,

is there any "officially" recommended default/standard method to realize
Puppet module unit test beyond linting (puppet-lint)? Compatibility to
version < 3.x is nice but NOT needed.


My main questions are:

1) I know there are different, well-known methods:
- Test::Unit
- rspec-puppet
- cucumber-puppet

Is there anything missing worth a look? Which are deprecated, wich are
future-proof?

Not aware of Test::Unit. Cucumber Puppet is deprecated [1]. rspec-puppet is the way to go.

2) There are helpful blog postings and articles out there [1] [2] [3]
[4]. However, none of them gives me a clue if there is a commonly
recommended tool/method to implement Unit test, some kind of
"use X because everybody is using it, you won't get compatibility issues
and the dev-community behind is healthy".

A hint out of e.g. Puppet Labs or experienced community members
Point-of-View would be very helpful. Are there any recommendations?
Getting familiar with testing needs some work which I don't want to
invest into the wrong  candidate/method/tools. ;-)

The blog posts you referenced are slightly out of date. I would start with Branan's post on Puppet Labs spec_helper [2]. It's used in all puppet labs modules. You can see it in action both in travis-ci [3] and puppet labs public Jenkins CI [4].


Thanks,

Nan

Matthias Viehweger

unread,
Dec 13, 2012, 4:23:15 PM12/13/12
to puppet...@googlegroups.com
Hi!

On Thu, Dec 13, 2012 at 11:42:19AM -0800, Nan Liu wrote:
> On Thu, Dec 13, 2012 at 11:01 AM, Andreas Haerter <list+pup...@mail-node.com> wrote:
> > 1) I know there are different, well-known methods:
> > - Test::Unit
> > - rspec-puppet
> > - cucumber-puppet
> >
> > Is there anything missing worth a look? Which are deprecated, wich are
> > future-proof?
>
> Not aware of Test::Unit. Cucumber Puppet is deprecated. rspec-puppet is
> the way to go.

rspec-puppet is great for testing an isolated module.

For testing a complete machine or all of the catalog, I very much prefer
cucumber-puppet. That's why I forked the repo and develop it further [1].
ruby 1.9 and puppet 3 are supported by my fork.

If you use Puppet 2.7 and Ruby 1.8, I recommend the official gem. If you
have puppet 3, the you could give my fork a try. Up until now, it's just
a few fixes, I haven't had the time to integrate them into the bigger
picture with backwards compatibility and so on.

I have puppet-lint and cucumber-puppet integrated into my Jenkins-setup.

Cheers,
Matthias Viehweger

[1] https://github.com/kronn/cucumber-puppet
--
Serververwaltung und Softwareentwicklung

https://www.heute-kaufen.de
Prinzessinnenstraße 20 - 10969 Berlin
signature.asc

Andreas Haerter

unread,
Dec 16, 2012, 2:57:55 PM12/16/12
to puppet...@googlegroups.com
On 13.12.2012 20:42, Nan Liu wrote:
> The blog posts you referenced are slightly out of date. I would start
> with Branan's post on Puppet Labs spec_helper [2]. It's used in all
> puppet labs modules. You can see it in action both in travis-ci [3] and
> puppet labs public Jenkins CI [4].
>
> [1] <https://github.com/nistude/cucumber-puppet#readme>
> [2] <http://puppetlabs.com/blog/the-next-generation-of-puppet-module-testing/>
> [3] <https://travis-ci.org/puppetlabs/puppetlabs-openstack/builds/3551120>
> [4] <https://jenkins.puppetlabs.com/view/Puppet%20Modules/>

Thanks for the prompt reply, your info was *very* helpful. Going for
rspec-puppet with help of the "puppetlabs_spec_helper" gem now.

--
Andreas <http://blog.andreas-haerter.com>

signature.asc
Reply all
Reply to author
Forward
0 new messages