rspec-puppet with custom types

41 views
Skip to first unread message

Michael Watters

unread,
Oct 23, 2017, 4:29:52 PM10/23/17
to Puppet Users
Hello,

Does anybody know how to make rspec-puppet work with modules that use custom types for class parameters?  I am getting an error when I run spec tests such as follows.

# Puppet::ParseError:
      #   Expected parameter 'ensure' of 'Class[Logrotate]' to have type Logrotate::Ensurable, got String

The Logrotate::Ensurable type is defined in the logrotate module which is listed in .fixtures.yml. 

As a workaround I can use an older version of the logrotate module which does not include custom types but I'd rather have our tests match the production environment.

Henrik Lindberg

unread,
Oct 24, 2017, 10:15:14 AM10/24/17
to puppet...@googlegroups.com
It sounds like rspec-puppet does not initialize a complete environment
with all required modules on the modulepath.

Suggest filing an issue against rspec-puppet.

- henrik

> --
> 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
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/dcc5425d-9745-4b5d-8b65-cb45666c532a%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/dcc5425d-9745-4b5d-8b65-cb45666c532a%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Gavin Williams

unread,
Oct 24, 2017, 5:00:43 PM10/24/17
to Puppet Users
Michael

Is the logrotate module in your modules metadata.json dependency list? I've had issues in the past with custom datatypes, and that seemed to fix it for me... 

Gav


On Tuesday, 24 October 2017 15:15:14 UTC+1, Henrik Lindberg wrote:
On 23/10/17 22:29, Michael Watters wrote:
> Hello,
>
> Does anybody know how to make rspec-puppet work with modules that use
> custom types for class parameters?  I am getting an error when I run
> spec tests such as follows.
>
> # Puppet::ParseError:
>        #   Expected parameter 'ensure' of 'Class[Logrotate]' to have
> type Logrotate::Ensurable, got String
>
> The Logrotate::Ensurable type is defined in the logrotate module which
> is listed in .fixtures.yml.
>
> As a workaround I can use an older version of the logrotate module which
> does not include custom types but I'd rather have our tests match the
> production environment.
>

It sounds like rspec-puppet does not initialize a complete environment
with all required modules on the modulepath.

Suggest filing an issue against rspec-puppet.

- henrik

> --
> 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

Michael Watters

unread,
Nov 3, 2017, 8:50:29 PM11/3/17
to Puppet Users
Thanks.  I'll create an issue with the rspec-puppet project.


On Tuesday, October 24, 2017 at 10:15:14 AM UTC-4, Henrik Lindberg wrote:
On 23/10/17 22:29, Michael Watters wrote:
> Hello,
>
> Does anybody know how to make rspec-puppet work with modules that use
> custom types for class parameters?  I am getting an error when I run
> spec tests such as follows.
>
> # Puppet::ParseError:
>        #   Expected parameter 'ensure' of 'Class[Logrotate]' to have
> type Logrotate::Ensurable, got String
>
> The Logrotate::Ensurable type is defined in the logrotate module which
> is listed in .fixtures.yml.
>
> As a workaround I can use an older version of the logrotate module which
> does not include custom types but I'd rather have our tests match the
> production environment.
>

It sounds like rspec-puppet does not initialize a complete environment
with all required modules on the modulepath.

Suggest filing an issue against rspec-puppet.

- henrik

> --
> 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
Reply all
Reply to author
Forward
0 new messages