mirror of
				https://github.com/krislamo/puppet-fluentd
				synced 2025-11-04 02:38:35 +00:00 
			
		
		
		
	use rspec-puppet-facts for fluentd_repo_yum_spec
This commit is contained in:
		@@ -1,27 +1,33 @@
 | 
			
		||||
require 'spec_helper'
 | 
			
		||||
 | 
			
		||||
describe 'fluentd::repo::yum', :type => :class do
 | 
			
		||||
  let(:facts) {
 | 
			
		||||
    {
 | 
			
		||||
      :osfamily => 'RedHat',
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  on_supported_os.each do |os, facts|
 | 
			
		||||
    context "on #{os}" do
 | 
			
		||||
      let :facts do
 | 
			
		||||
        facts
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
  describe 'when called with no parameters on RedHat' do
 | 
			
		||||
    it {
 | 
			
		||||
      should contain_yumrepo('treasure-data').with({
 | 
			
		||||
        'ensure'   => 'present',
 | 
			
		||||
        'baseurl'  => 'https://packages.treasuredata.com/2/redhat/$releasever/$basearch',
 | 
			
		||||
        'descr'    => 'TreasureData',
 | 
			
		||||
        'enabled'  => '1',
 | 
			
		||||
        'gpgcheck' => '1'
 | 
			
		||||
      }).that_notifies('Exec[add GPG key]')
 | 
			
		||||
 | 
			
		||||
      should contain_exec('add GPG key').with({
 | 
			
		||||
        'command'     => 'rpm --import https://packages.treasuredata.com/GPG-KEY-td-agent',
 | 
			
		||||
        'path'        => '/bin:/usr/bin/',
 | 
			
		||||
        'refreshonly' => 'true'
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
      describe 'when called with no parameters' do
 | 
			
		||||
        case facts[:osfamily]
 | 
			
		||||
        when 'RedHat'
 | 
			
		||||
          it {
 | 
			
		||||
            should contain_yumrepo('treasure-data').with({
 | 
			
		||||
              'ensure'   => 'present',
 | 
			
		||||
              'baseurl'  => 'https://packages.treasuredata.com/2/redhat/$releasever/$basearch',
 | 
			
		||||
              'descr'    => 'TreasureData',
 | 
			
		||||
              'enabled'  => '1',
 | 
			
		||||
              'gpgcheck' => '1'
 | 
			
		||||
            }).that_notifies('Exec[add GPG key]')
 | 
			
		||||
 | 
			
		||||
            should contain_exec('add GPG key').with({
 | 
			
		||||
              'command'     => 'rpm --import https://packages.treasuredata.com/GPG-KEY-td-agent',
 | 
			
		||||
              'path'        => '/bin:/usr/bin/',
 | 
			
		||||
              'refreshonly' => 'true'
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user