require 'spec_helper'

describe 'lma_logging_analytics::elasticsearch', :type => :class do
    let(:facts) do
        {:kernel => 'Linux', :operatingsystem => 'Ubuntu'}
    end

    describe 'minimal parameters' do
        let(:params) do
            {:listen_address => '127.0.0.1',
             :data_dir => '/tmp/es-data',
             :node_name => 'foo-host',
             :cluster_name => 'es-cluster',
             :instance_name => 'es-42',
             :nodes => ['node-1', 'node-2', 'foo-host'],
             :version => '5.0.0',
            }
        end

        it { is_expected.to contain_class('elasticsearch').with(
             :version => '5.0.0'
        )}

        it { is_expected.to contain_elasticsearch__instance('es-42') }
        it { is_expected.to contain_file('/tmp/es-data').with(
            :ensure => 'directory'
        )}
        it { is_expected.to contain_file('/etc/logrotate.d/elasticsearch-es-42.conf') }
    end

end
