FAQ
I'm writing a test for a module which declares a service resource that has
a require parameter. However, when I run the test it throws an error on
this require as it seems that I have the syntax wrong. I've tried a few
different combinations but nothing seems to work. The error is below:

*/usr/bin/ruby1.8 -S rspec spec/classes/init_spec.rb
spec/classes/server_spec.rb*
*..F*
*
*
*Failures:*
*
*
* 1) couchbase::server should include Class[couchbase::server::install]*
* Failure/Error: 'require' => Class['couchbase::server::install']*
* NoMethodError:*
* undefined method `[]' for Class:Class*
* # ./spec/classes/server_spec.rb:9*
*
*
*Finished in 8.95 seconds*
*3 examples, 1 failure*
*
*
*Failed examples:*
*
*
*rspec ./spec/classes/server_spec.rb:4 # couchbase::server should include
Class[couchbase::server::install]*
*
*
I tried enclosing the entire Class[] string in double quotes (leaving the
single quotes surrounding the class name) but then I get this error:

*Failures:*
*
*
* 1) couchbase::server should contain Service[couchbase-server] with
ensure => "running", enable => "true" and require =>
"Class['couchbase::server::install']"*
* Failure/Error: )*
* expected that the catalogue would contain Service[couchbase-server]
with require set to `"Class['couchbase::server::install']"` but it is set
to `Class[Couchbase::Server::Install]{:name=>"Couchbase::Server::Install"}`
in the catalogue*
* # ./spec/classes/server_spec.rb:10*
*
*
So I tried changing it to the exact syntax it mentions in the catalogue,
but it still doesn't work. What is the correct way to specify a require
parameter as part of a "with" chain?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Guy Knights at Sep 2, 2013 at 6:54 pm
    I just worked this out shortly after my original post. The syntax I found
    that works is

    *'require' => 'Class[Couchbase::Server::Install]'*
    On Monday, 2 September 2013 11:46:34 UTC-7, Guy Knights wrote:

    I'm writing a test for a module which declares a service resource that has
    a require parameter. However, when I run the test it throws an error on
    this require as it seems that I have the syntax wrong. I've tried a few
    different combinations but nothing seems to work. The error is below:

    */usr/bin/ruby1.8 -S rspec spec/classes/init_spec.rb
    spec/classes/server_spec.rb*
    *..F*
    *
    *
    *Failures:*
    *
    *
    * 1) couchbase::server should include Class[couchbase::server::install]*
    * Failure/Error: 'require' => Class['couchbase::server::install']*
    * NoMethodError:*
    * undefined method `[]' for Class:Class*
    * # ./spec/classes/server_spec.rb:9*
    *
    *
    *Finished in 8.95 seconds*
    *3 examples, 1 failure*
    *
    *
    *Failed examples:*
    *
    *
    *rspec ./spec/classes/server_spec.rb:4 # couchbase::server should include
    Class[couchbase::server::install]*
    *
    *
    I tried enclosing the entire Class[] string in double quotes (leaving the
    single quotes surrounding the class name) but then I get this error:

    *Failures:*
    *
    *
    * 1) couchbase::server should contain Service[couchbase-server] with
    ensure => "running", enable => "true" and require =>
    "Class['couchbase::server::install']"*
    * Failure/Error: )*
    * expected that the catalogue would contain
    Service[couchbase-server] with require set to
    `"Class['couchbase::server::install']"` but it is set to
    `Class[Couchbase::Server::Install]{:name=>"Couchbase::Server::Install"}` in
    the catalogue*
    * # ./spec/classes/server_spec.rb:10*
    *
    *
    So I tried changing it to the exact syntax it mentions in the catalogue,
    but it still doesn't work. What is the correct way to specify a require
    parameter as part of a "with" chain?
    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedSep 2, '13 at 6:46p
activeSep 2, '13 at 6:54p
posts2
users1
websitepuppetlabs.com

1 user in discussion

Guy Knights: 2 posts

People

Translate

site design / logo © 2022 Grokbase