puppet testing

128 views
Skip to first unread message

Raj kumar V

unread,
Nov 20, 2013, 5:34:31 AM11/20/13
to puppet...@googlegroups.com
Hi There,

   I am kind of lost, understood something wrong. I have written a module. Now how can I test this module? Do I need to copy it to agent or server? Is it possible to test it as a standalone module where I have a machine with puppet agent or server installed? It is a simple module I dont want complicate things with cucumber or some rspec etc. 

   How can I test it with puppet apply command? When I run this it say everything complied but no work done and no errors too.

Thanks
Raj

Martin Alfke

unread,
Nov 20, 2013, 5:44:33 AM11/20/13
to puppet...@googlegroups.com
Hi Raj,

you can do smoketsts for your module
http://docs.puppetlabs.com/guides/tests_smoke.html

Simply use your module (e.g. by include <modulename>)

The you run a local puppet apply <smoketestfile> —noop

—noop ensures that you simulate the puppet run only.

hth,

Martin
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5ef065b1-8a57-4f40-a43c-3e989da23101%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Raj kumar V

unread,
Nov 20, 2013, 5:59:28 AM11/20/13
to puppet...@googlegroups.com
Martin,

   Still same no work done or no errors.

To explain further, simply I wrote a module. Nad it is inside /etc/puppetlabs/puppet/modules/<mymodule>

2 files: init.pp and params.pp

when I compile or execute it

root@nfaxen-ubu1:/etc/puppetlabs/puppet/modules/site24x7# puppet apply init.pp
Notice: Compiled catalog for nfaxen-ubu1.csez.zohocorpin.com in environment production in 0.06 seconds
Notice: Finished catalog run in 0.27 seconds

Thts the output and no work done.

Are you saying I have to create a another pp file and add this in <include mymodule> and execute it with --noop?

Martin Alfke

unread,
Nov 20, 2013, 7:06:47 AM11/20/13
to puppet...@googlegroups.com
Hi Raj,

when running puppet apply on your module init.pp you will only compile the module but you will not instantiate the module.
(google for definition vs. declaration)

You need to create another init.pp file (normally you put them into <yourmodule>/tests/init.pp).
In this file you declare the module (e.g. using include <yourmodule>)

hth,

Martin
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3e6e08c5-2047-4424-9581-435909d23fbc%40googlegroups.com.

Martin Alfke

unread,
Nov 20, 2013, 7:07:08 AM11/20/13
to puppet...@googlegroups.com
Hi Raj,

when running puppet apply on your module init.pp you will only compile the module but you will not instantiate the module.
(google for definition vs. declaration)

You need to create another init.pp file (normally you put them into <yourmodule>/tests/init.pp).
In this file you declare the module (e.g. using include <yourmodule>)

hth,

Martin
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3e6e08c5-2047-4424-9581-435909d23fbc%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages