# # Copyright (C) 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # require 'spec_helper' describe 'tripleo::profile::base::logging::fluentd' do shared_examples_for 'tripleo::profile::base::logging::fluentd' do before :each do facts.merge!({ :step => params[:step] }) end context 'with step less than 4' do let(:params) { { :step => 3 } } it 'should do nothing' do is_expected.to_not contain_class('fluentd') is_expected.to_not contain_class('systemd::systemctl::daemon_reload') is_expected.to_not contain_fluentd__plugin('rubygem-fluent-plugin-add') end end context 'with defaults and step greater than 3' do let(:params) { { :step => 4 } } it { is_expected.to contain_class('fluentd') } it { is_expected.to contain_class('systemd::systemctl::daemon_reload') } it { is_expected.to contain_fluentd__plugin('rubygem-fluent-plugin-add').with( :plugin_provider => 'yum', ) } it { is_expected.to contain_fluentd__config('110-monitoring-agent.conf') } it { is_expected.to contain_file('/etc/fluentd/config.d/110-monitoring-agent.conf').with_content( "# This file is managed by Puppet, do not edit manually. bind 127.0.0.1 port 24220 @type monitor_agent " ) } it { is_expected.to contain_fluentd__config('110-system-sources.conf') } it { is_expected.to contain_file('/etc/rsyslog.d/fluentd.conf').with_content( "*.* @127.0.0.1:42185" ) } it { is_expected.to contain_file('/etc/fluentd/config.d/110-system-sources.conf').with_content( "# This file is managed by Puppet, do not edit manually. port 42185 tag system.messages @type syslog " ) } end context 'step greater than 3 and a fluentd source' do let(:params) { { :step => 4, :fluentd_sources => [ { 'format' => '/(?