mirror of
				https://github.com/krislamo/puppet-fluentd
				synced 2025-11-04 02:38:35 +00:00 
			
		
		
		
	added gem plugin installation to acceptance test
This commit is contained in:
		
							
								
								
									
										10
									
								
								examples/test.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								examples/test.pp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					# This file is use for the beaker tests.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# basic installation
 | 
				
			||||||
 | 
					include '::fluentd'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# install a gem plugin
 | 
				
			||||||
 | 
					::fluentd::plugin { 'fluent-plugin-elasticsearch':
 | 
				
			||||||
 | 
					  type    => 'gem',
 | 
				
			||||||
 | 
					  require => Class['::fluentd']
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -2,17 +2,19 @@ require 'spec_helper_acceptance'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
RSpec.describe 'fluentd' do
 | 
					RSpec.describe 'fluentd' do
 | 
				
			||||||
  it 'runs successfully' do
 | 
					  it 'runs successfully' do
 | 
				
			||||||
    manifest = File.read(File.expand_path('../../examples/init.pp', File.dirname(__FILE__)))
 | 
					    manifest = File.read(File.expand_path('../../examples/test.pp', File.dirname(__FILE__)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Run it twice and test for idempotency
 | 
					    # Run it twice and test for idempotency
 | 
				
			||||||
    apply_manifest(manifest, catch_failures: true)
 | 
					    apply_manifest(manifest, catch_failures: true)
 | 
				
			||||||
    expect(apply_manifest(manifest, catch_failures: true).exit_code).to be_zero
 | 
					    expect(apply_manifest(manifest, catch_failures: true).exit_code).to be_zero
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # test package
 | 
				
			||||||
  describe package('td-agent') do
 | 
					  describe package('td-agent') do
 | 
				
			||||||
    it { is_expected.to be_installed }
 | 
					    it { is_expected.to be_installed }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # test service
 | 
				
			||||||
  describe service('td-agent') do
 | 
					  describe service('td-agent') do
 | 
				
			||||||
    it { is_expected.to be_running }
 | 
					    it { is_expected.to be_running }
 | 
				
			||||||
    # @todo
 | 
					    # @todo
 | 
				
			||||||
@@ -34,4 +36,10 @@ RSpec.describe 'fluentd' do
 | 
				
			|||||||
      it { is_expected.to be_enabled }
 | 
					      it { is_expected.to be_enabled }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # test gem installed plugin
 | 
				
			||||||
 | 
					  describe command('/opt/td-agent/embedded/bin/gem list') do
 | 
				
			||||||
 | 
					    its(:stdout) { should contain('fluent-plugin-elasticsearch') }
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user