Issue #15529 has been updated by Dominic Cleal.
I've managed to reproduce this at last and verified Josh's fix works (with an extra line in puppetlabs_spec_helper as suggested above). What threw me is that rspec-puppet's been updated to initialise Puppet settings when running under Puppet 3: [60ec4aef:lib/rspec-puppet.rb](https://github.com/rodjek/rspec-puppet/commit/60ec4aef7b7b15f847425bab8fa5d3cf0511ff5e#L0R9). This means that if you include rspec-puppet (e.g. via the puppetlabs_spec_helper's module_spec_helper versus puppetlabs_spec_helper) then Puppet app settings are getting initialised and the libdir also gets set appropriately. ---------------------------------------- Bug #15529: Puppet settings should be initialized prior to running any tests and reinitialized before each test https://projects.puppetlabs.com/issues/15529#change-78992 Author: Dominic Cleal Status: In Topic Branch Pending Review Priority: Normal Assignee: Category: Target version: 3.1.0 Affected Puppet version: 3.0.0 Keywords: puppetlabs_spec_helper autoload modules Branch: https://github.com/puppetlabs/puppet/pull/1332 Testing modules with Puppet 3 is broken in two ways: 1. Puppet's settings are not initialized prior to the module's specs start. 1. Puppet's TestHelper clears app_default_settings after each test, but never reinitialized prior to running the second, third, etc test. Whenever app_default settings are not initialized, the Autoloader will not be able to load code from the module, such as when a module's type/provider requires utility code from the module, or another module. Users have run into this in a variety of ways: <https://github.com/rodjek/rspec-puppet/pull/41#issuecomment-8023987><br> <https://github.com/rodjek/rspec-puppet/pull/61><br> <https://github.com/rodjek/rspec-puppet/issues/60><br> <https://github.com/rodjek/rspec-puppet/issues/58><br> The TestHelper should ensure that settings are in a consistent state so that module authors don't need to. This is true for puppet itself, since attempting to load a face prior to settings being initiallized, e.g. executing `Puppet::Interface.faces.each { |name| puts name }` as the first and only spec will fail, since settings are never initialized. ---- Original description: I'm trying to create a module (domcleal/augeasproviders) containing a provider for a type supplied by a second module (puppetlabs/mount_providers). When the mount_providers module is installed locally via `puppet module`, this isn't added into RUBYLIB while running specs. This causes references to Puppet::Type.type(:mounttab) from within the spec to return nil. It appears that the branch in the autoloader checking `Puppet.settings.app_defaults_initialized?` (line 136 in master) is returning false and so perhaps some further initialisation of Puppet is required? -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
