Have a look at rpec-pupept and the .fixture.yaml file.

http://puppetlabs.com/blog/the-next-generation-of-puppet-module-testing

an expert from the text :

*.fixtures.yml*. This file is used by the common rake tasks to automatically install dependencies for test runs. For our example, its contents should be:

fixtures:
  repositories:
    stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git
  symlinks:
    apache: "#{source_dir}"

This defines a testing environment with two modules: one called ‘stdlib’ fetched from a Github repository, and one called ‘apache’ (our module) which will be a symlink to the current source directory.

Grts

Jo



On 02/22/2014 05:02 AM, John Julien wrote:
Hi,
I am attempting to write spec tests for a trac module I'm working on that has several dependencies, one of which is puppetlabs-postgresql. I am running into an issue with my spec tests as the puppet code fails to compile because it can't' find the classes/defined types/functions from my calls out to other modules.

So, for example, this particular bit of code throws the error: Could not find class postgresql::server

define trac::db($db_user,
                $db_pass,
                $db_name) {

  include 'postgresql::server'
  postgresql::server::db {$db_name:
     user     => $db_user,
     password => postgresql_password($db_user, $db_pass),
  }
  if ( ! defined(Postgresql::Server::Role[$db_user])) {
    postgresql::server::role {$db_user:
      password_hash => postgresql_password($db_user, $db_pass)
    }
  }
}

I also have dependencies on apache. So, in the define I do want to test, trac::project, I find myself doing things like this:

  let(:pre_condition) {
    "class apache {}
     define apache::mod() {}
     define trac::db() {}
    "
  }

Is there a more sane way of doing this? Is my thinking completely off? Any help is appreciated.

Thanks,
John
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/f05a050a-a614-4d15-bf9c-1f3ae541770c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Next Events:
Zabbix Certified Training | 
http://www.open-future.be/zabbix-certified-training-10-till-12th-march
Zabbix for Large Environments Training | 
http://www.open-future.be/zabbix-large-environments-training-13-till-14th-march
Puppet Intruction Course | 
http://www.open-future.be/puppet-introduction-course-14th-april
Puppet Advanced Training | 
http://www.open-future.be/puppet-advanced-training-15-till-17th-april
Subscribe to our newsletter | http://eepurl.com/BUG8H

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/53087643.10402%40open-future.be.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to