File tree 6 files changed +56
-86
lines changed
templates/etc/elasticsearch
6 files changed +56
-86
lines changed Original file line number Diff line number Diff line change 243
243
mode => ' 0440' ,
244
244
}
245
245
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
+ }
252
254
}
253
255
254
256
if $::elasticsearch::system_key != undef {
Original file line number Diff line number Diff line change 339
339
. with ( :owner => 'myesuser' ) if facts [ :os ] [ 'family' ] == 'RedHat' }
340
340
end
341
341
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
+
342
388
# This check helps catch dependency cycles.
343
389
context 'create_resource' do
344
390
# Helper for these tests
Original file line number Diff line number Diff line change 58
58
:enable => true
59
59
) }
60
60
61
- %w[ elasticsearch.yml jvm.options log4j2.properties ] . each do |file |
61
+ %w[ elasticsearch.yml log4j2.properties ] . each do |file |
62
62
it { should contain_file ( "/etc/elasticsearch/#{ file } " ) }
63
63
end
64
64
end # of config
Original file line number Diff line number Diff line change 5
5
it { should contain_datacat_fragment ( 'main_config' ) }
6
6
it { should contain_service ( 'elasticsearch' ) }
7
7
8
- %w[ elasticsearch.yml jvm.options log4j2.properties ] . each do |file |
8
+ %w[ elasticsearch.yml log4j2.properties ] . each do |file |
9
9
it { should contain_file ( "/etc/elasticsearch/#{ file } " ) }
10
10
end
11
11
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments