rspec-puppet failures when calling none standard types

47 views
Skip to first unread message

Danny Roberts

unread,
Nov 21, 2014, 2:15:30 PM11/21/14
to puppet...@googlegroups.com
I am working on adding testing to a module I write (https://github.com/kemra102/puppet-zabbix).

I am currently writing the tests for the 'zabbix::repo' class and I am getting the following error:

  1) zabbix on ubuntu systems 
     Failure/Error: it { should contain_apt__source('ubuntu-zabbix') }
     Puppet::Error:
       Ubuntu  is not supported by this module. at /home/kemra102/projects/puppet-zabbix/spec/fixtures/modules/zabbix/manifests/params.pp:143 on node iacon.cybertron.local
     # ./spec/classes/zabbix_repo_spec.rb:16:in `block (3 levels) in <top (required)>'

Here is the test:

require 'spec_helper'

describe 'zabbix', :type => :class do
  it { should contain_class('zabbix::repo') }

  context 'on redhat family systems' do
    let (:facts) { { :osfamily => 'RedHat' } }

    it { should contain_yumrepo('zabbix') }
    it { should contain_yumrepo('zabbix-non-supported') }
  end

  context 'on ubuntu systems' do
    let (:facts) { { :osfamily => 'Debian', :operatingsystem => 'Ubuntu' } }

    it { should contain_apt__source('ubuntu-zabbix') }
  end

end

I find it strange that the apt::source test for Ubuntu is failing given that the yumrepo ones pass absolutely without error. I can give the missing '::operatingsystemmajrelease' it is looking for but then it just asks for other variables in a seemingly never ending list.

Any ideas why only the apt repo is failing?

Gavin Williams

unread,
Nov 21, 2014, 3:42:54 PM11/21/14
to puppet...@googlegroups.com
You need to add an 'operatingsystemmajrelease' fact, as you're using it in a case statement in params.pp[1].
The error you're getting points you at the cause :) 

Gav

Danny Roberts

unread,
Nov 21, 2014, 7:18:32 PM11/21/14
to puppet...@googlegroups.com
That's what I thought (though it leads to a long string of other facts it wants, one of which my class does not ask for). The thing that makes no sense though is that the statement in params.pp requires 'operatingsystemmajrelease' is also required for the RedHat serversbut my test does not fail there even though I don't provide the 'operatingsystemmajrelease' for the yumrepo tests.

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/Q5zwTl9Zt1E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/b3b1de50-e0de-485c-bd66-d8beab13a1e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Kind Regards
Danny R

Website: http://danny-roberts.info/
Reply all
Reply to author
Forward
0 new messages