diff --git a/examples/test.pp b/examples/test.pp new file mode 100644 index 0000000..710c9a2 --- /dev/null +++ b/examples/test.pp @@ -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'] +} diff --git a/spec/acceptance/fluentd_spec.rb b/spec/acceptance/fluentd_spec.rb index 5752a4f..5547e0c 100644 --- a/spec/acceptance/fluentd_spec.rb +++ b/spec/acceptance/fluentd_spec.rb @@ -2,17 +2,19 @@ require 'spec_helper_acceptance' RSpec.describe 'fluentd' 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 apply_manifest(manifest, catch_failures: true) expect(apply_manifest(manifest, catch_failures: true).exit_code).to be_zero end + # test package describe package('td-agent') do it { is_expected.to be_installed } end + # test service describe service('td-agent') do it { is_expected.to be_running } # @todo @@ -34,4 +36,10 @@ RSpec.describe 'fluentd' do it { is_expected.to be_enabled } 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