FAQ
I am adding spec tests to my modules and have run into an issue I can't seem to figure out.

I have a simple class: (ruby/manifests/init.pp)
class ruby {
include common
$blah = dirname('/tmp/test/file.txt')
file { $blah: ensure => director }
}

And a spec file: (spec/classes/ruby_init_spec.rb)
require 'spec_helper'
describe 'ruby', :type => :class do
it { should contain_file('/tmp/test') }
end

I have a simple define: (ruby/manifests/thin.pp)
define ruby::thin {
include common
$blah = dirname('/tmp/test/file.txt')
file { $blah: ensure => director }
}

And a spec file: (spec/defines/ruby_thin_spec.rb)
require 'spec_helper'
describe 'ruby::thin', :type => :define do
let(:title) { 'test_site' }
it { should contain_file('/tmp/test') }
end

My .fixtures.yml contains:
fixtures:
repositories:
common: gitolite@git.mycompany.com:puppet/mycompany-common.git
symlinks:
ruby: "#{source_dir}"

common/lib/puppet/parser/functions/dirname.rb exists and is based off of https://github.com/camptocamp/puppet-common/blob/master/lib/puppet/parser/functions/dirname.rb. I've been using it for a very long time without issue.


Any thoughts as to what I'm missing? I think I've narrowed it down to a class works and the define does not.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Justin Lambert at Oct 31, 2012 at 4:58 pm
    One other issue I have I can't figure out (that is potentially related), I have a module backups which passes all tests and uses the concat module. Anything else that uses a backups define fails with the error:

    Failure/Error: it { should create_exec('initialize repo') }
    Puppet::Error:
    Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type concat at /Users/jlambert/Documents/puppet/gitolite/spec/fixtures/modules/backups/manifests/archive.pp:16 on node jlambertmbp.local

    Concat is included in the .fixtures for both the backups module and everything using it.


    On Oct 30, 2012, at 11:54 AM, Justin Lambert wrote:

    I am adding spec tests to my modules and have run into an issue I can't seem to figure out.

    I have a simple class: (ruby/manifests/init.pp)
    class ruby {
    include common
    $blah = dirname('/tmp/test/file.txt')
    file { $blah: ensure => director }
    }

    And a spec file: (spec/classes/ruby_init_spec.rb)
    require 'spec_helper'
    describe 'ruby', :type => :class do
    it { should contain_file('/tmp/test') }
    end

    I have a simple define: (ruby/manifests/thin.pp)
    define ruby::thin {
    include common
    $blah = dirname('/tmp/test/file.txt')
    file { $blah: ensure => director }
    }

    And a spec file: (spec/defines/ruby_thin_spec.rb)
    require 'spec_helper'
    describe 'ruby::thin', :type => :define do
    let(:title) { 'test_site' }
    it { should contain_file('/tmp/test') }
    end

    My .fixtures.yml contains:
    fixtures:
    repositories:
    common: gitolite@git.mycompany.com:puppet/mycompany-common.git
    symlinks:
    ruby: "#{source_dir}"

    common/lib/puppet/parser/functions/dirname.rb exists and is based off of https://github.com/camptocamp/puppet-common/blob/master/lib/puppet/parser/functions/dirname.rb. I've been using it for a very long time without issue.


    Any thoughts as to what I'm missing? I think I've narrowed it down to a class works and the define does not.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jeff McCune at Oct 31, 2012 at 10:03 pm
    I'm not entirely certain, but do you think this could be a variant of this
    bug:

    http://projects.puppetlabs.com/issues/show/15529

    If so, could you please upvote the bug, watch it, and update it with
    information about how it's impacting you?

    Thanks,
    -Jeff

    On Wed, Oct 31, 2012 at 9:52 AM, Justin Lambert wrote:

    One other issue I have I can't figure out (that is potentially related), I
    have a module backups which passes all tests and uses the concat module.
    Anything else that uses a backups define fails with the error:

    Failure/Error: it { should create_exec('initialize repo') }
    Puppet::Error:
    Puppet::Parser::AST::Resource failed with error ArgumentError:
    Invalid resource type concat at
    /Users/jlambert/Documents/puppet/gitolite/spec/fixtures/modules/backups/manifests/archive.pp:16
    on node jlambertmbp.local

    Concat is included in the .fixtures for both the backups module and
    everything using it.



    On Oct 30, 2012, at 11:54 AM, Justin Lambert <
    jlambert@infiniteviewtech.com> wrote:

    I am adding spec tests to my modules and have run into an issue I can't
    seem to figure out.

    I have a simple class: (ruby/manifests/init.pp)
    class ruby {
    include common
    $blah = dirname('/tmp/test/file.txt')
    file { $blah: ensure => director }
    }

    And a spec file: (spec/classes/ruby_init_spec.rb)
    require 'spec_helper'
    describe 'ruby', :type => :class do
    it { should contain_file('/tmp/test') }
    end

    I have a simple define: (ruby/manifests/thin.pp)
    define ruby::thin {
    include common
    $blah = dirname('/tmp/test/file.txt')
    file { $blah: ensure => director }
    }

    And a spec file: (spec/defines/ruby_thin_spec.rb)
    require 'spec_helper'
    describe 'ruby::thin', :type => :define do
    let(:title) { 'test_site' }
    it { should contain_file('/tmp/test') }
    end

    My .fixtures.yml contains:
    fixtures:
    repositories:
    common: gitolite@git.mycompany.com:puppet/mycompany-common.git
    symlinks:
    ruby: "#{source_dir}"

    common/lib/puppet/parser/functions/dirname.rb exists and is based off of
    https://github.com/camptocamp/puppet-common/blob/master/lib/puppet/parser/functions/dirname.rb.
    I've been using it for a very long time without issue.


    Any thoughts as to what I'm missing? I think I've narrowed it down to a
    class works and the define does not.

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.


    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Justin Lambert at Nov 2, 2012 at 4:09 pm
    Jeff,

    Thanks for your response. It is possible, but I'm not sure. Would uploading some sample modules that show the breakage help?

    Thanks,
    jl

    On Oct 31, 2012, at 3:37 PM, Jeff McCune wrote:

    I'm not entirely certain, but do you think this could be a variant of this bug:

    http://projects.puppetlabs.com/issues/show/15529

    If so, could you please upvote the bug, watch it, and update it with information about how it's impacting you?

    Thanks,
    -Jeff


    On Wed, Oct 31, 2012 at 9:52 AM, Justin Lambert wrote:
    One other issue I have I can't figure out (that is potentially related), I have a module backups which passes all tests and uses the concat module. Anything else that uses a backups define fails with the error:

    Failure/Error: it { should create_exec('initialize repo') }
    Puppet::Error:
    Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type concat at /Users/jlambert/Documents/puppet/gitolite/spec/fixtures/modules/backups/manifests/archive.pp:16 on node jlambertmbp.local

    Concat is included in the .fixtures for both the backups module and everything using it.


    On Oct 30, 2012, at 11:54 AM, Justin Lambert wrote:

    I am adding spec tests to my modules and have run into an issue I can't seem to figure out.

    I have a simple class: (ruby/manifests/init.pp)
    class ruby {
    include common
    $blah = dirname('/tmp/test/file.txt')
    file { $blah: ensure => director }
    }

    And a spec file: (spec/classes/ruby_init_spec.rb)
    require 'spec_helper'
    describe 'ruby', :type => :class do
    it { should contain_file('/tmp/test') }
    end

    I have a simple define: (ruby/manifests/thin.pp)
    define ruby::thin {
    include common
    $blah = dirname('/tmp/test/file.txt')
    file { $blah: ensure => director }
    }

    And a spec file: (spec/defines/ruby_thin_spec.rb)
    require 'spec_helper'
    describe 'ruby::thin', :type => :define do
    let(:title) { 'test_site' }
    it { should contain_file('/tmp/test') }
    end

    My .fixtures.yml contains:
    fixtures:
    repositories:
    common: gitolite@git.mycompany.com:puppet/mycompany-common.git
    symlinks:
    ruby: "#{source_dir}"

    common/lib/puppet/parser/functions/dirname.rb exists and is based off of https://github.com/camptocamp/puppet-common/blob/master/lib/puppet/parser/functions/dirname.rb. I've been using it for a very long time without issue.


    Any thoughts as to what I'm missing? I think I've narrowed it down to a class works and the define does not.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jeff McCune at Nov 2, 2012 at 9:46 pm

    On Friday, November 2, 2012, Justin Lambert wrote:

    Jeff,

    Thanks for your response. It is possible, but I'm not sure. Would
    uploading some sample modules that show the breakage help?
    Yes, if you publish modules that trigger the issue I'll definitely make an
    effort to reproduce the problem you're running into and offer more
    suggestions to resolve it.

    -Jeff

    >

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Justin Lambert at Dec 17, 2012 at 2:24 am
    Jeff,

    I finally got a few simple modules together to recreate this issue. A 'rake spec' will fail for the 'test' module.

    https://github.com/jlambert121/puppet-rspec-test

    Let me know if I did something incorrect. It seems to be the spec for a function will fail if the function depends on pluginsync to install the function.

    Thanks,
    Justin
    On Nov 2, 2012, at 3:46 PM, Jeff McCune wrote:

    On Friday, November 2, 2012, Justin Lambert wrote:
    Jeff,

    Thanks for your response. It is possible, but I'm not sure. Would uploading some sample modules that show the breakage help?

    Yes, if you publish modules that trigger the issue I'll definitely make an effort to reproduce the problem you're running into and offer more suggestions to resolve it.

    -Jeff


    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Justin Lambert at Jan 14, 2013 at 3:38 pm
    Jeff,

    You haven't by chance had a chance to look at this have you? I'd be curious if I'm just doing something wrong.

    Thanks,
    jl
    On Dec 16, 2012, at 7:24 PM, Justin Lambert wrote:

    Jeff,

    I finally got a few simple modules together to recreate this issue. A 'rake spec' will fail for the 'test' module.

    https://github.com/jlambert121/puppet-rspec-test

    Let me know if I did something incorrect. It seems to be the spec for a function will fail if the function depends on pluginsync to install the function.

    Thanks,
    Justin
    On Nov 2, 2012, at 3:46 PM, Jeff McCune wrote:

    On Friday, November 2, 2012, Justin Lambert wrote:
    Jeff,

    Thanks for your response. It is possible, but I'm not sure. Would uploading some sample modules that show the breakage help?

    Yes, if you publish modules that trigger the issue I'll definitely make an effort to reproduce the problem you're running into and offer more suggestions to resolve it.

    -Jeff


    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 30, '12 at 8:50p
activeJan 14, '13 at 3:38p
posts7
users2
websitepuppetlabs.com

2 users in discussion

Justin Lambert: 5 posts Jeff McCune: 2 posts

People

Translate

site design / logo © 2022 Grokbase