File tree Expand file tree Collapse file tree 6 files changed +56
-86
lines changed
templates/etc/elasticsearch Expand file tree Collapse file tree 6 files changed +56
-86
lines changed Original file line number Diff line number Diff line change 243243 mode => ' 0440' ,
244244 }
245245
246- # Configure JVM options
247- file { "${::elasticsearch::configdir}/jvm.options" :
248- content => template (" ${module_name} /etc/elasticsearch/jvm.options.erb" ),
249- group => $::elasticsearch::elasticsearch_group ,
250- notify => $::elasticsearch::_notify_service ,
251- owner => $::elasticsearch::elasticsearch_user ,
246+ # Add any additional JVM options
247+ $elasticsearch::jvm_options .each |String $jvm_option | {
248+ file_line { "jvm_option_${jvm_option}" :
249+ ensure => present ,
250+ path => " ${elasticsearch::configdir} /jvm.options" ,
251+ line => $jvm_option ,
252+ notify => $::elasticsearch::_notify_service ,
253+ }
252254 }
253255
254256 if $::elasticsearch::system_key != undef {
Original file line number Diff line number Diff line change 339339 . with ( :owner => 'myesuser' ) if facts [ :os ] [ 'family' ] == 'RedHat' }
340340 end
341341
342+ describe 'setting jvm_options' do
343+ jvm_options = [
344+ '-Xms16g' ,
345+ '-Xmx16g'
346+ ]
347+
348+ let ( :params ) do
349+ default_params . merge (
350+ :jvm_options => jvm_options
351+ )
352+ end
353+
354+ jvm_options . each do |jvm_option |
355+ it { should contain_file_line ( "jvm_option_#{ jvm_option } " )
356+ . with (
357+ :ensure => 'present' ,
358+ :path => '/etc/elasticsearch/jvm.options' ,
359+ :line => jvm_option
360+ ) }
361+ end
362+ end
363+
364+ context 'with restart_on_change => true' do
365+ let ( :params ) do
366+ default_params . merge (
367+ :restart_on_change => true
368+ )
369+ end
370+
371+ describe 'should restart elasticsearch' do
372+ it { should contain_file ( '/etc/elasticsearch/elasticsearch.yml' )
373+ . that_notifies ( 'Service[elasticsearch]' ) }
374+ end
375+
376+ describe 'setting jvm_options triggers restart' do
377+ let ( :params ) do
378+ super ( ) . merge (
379+ :jvm_options => [ '-Xmx16g' ]
380+ )
381+ end
382+
383+ it { should contain_file_line ( 'jvm_option_-Xmx16g' )
384+ . that_notifies ( 'Service[elasticsearch]' ) }
385+ end
386+ end
387+
342388 # This check helps catch dependency cycles.
343389 context 'create_resource' do
344390 # Helper for these tests
Original file line number Diff line number Diff line change 5858 :enable => true
5959 ) }
6060
61- %w[ elasticsearch.yml jvm.options log4j2.properties ] . each do |file |
61+ %w[ elasticsearch.yml log4j2.properties ] . each do |file |
6262 it { should contain_file ( "/etc/elasticsearch/#{ file } " ) }
6363 end
6464 end # of config
Original file line number Diff line number Diff line change 55 it { should contain_datacat_fragment ( 'main_config' ) }
66 it { should contain_service ( 'elasticsearch' ) }
77
8- %w[ elasticsearch.yml jvm.options log4j2.properties ] . each do |file |
8+ %w[ elasticsearch.yml log4j2.properties ] . each do |file |
99 it { should contain_file ( "/etc/elasticsearch/#{ file } " ) }
1010 end
1111
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments