3434
3535 # Test default behavior (no restart)
3636 context 'with default configuration' do
37- let ( :chef_run ) do
38- ChefSpec ::ServerRunner . new ( platform : 'ubuntu' , version : '20.04' , step_into : [ 'elasticsearch_service' ] ) do |node , server |
39- node_resources ( node )
40- stub_chef_zero ( 'ubuntu' , '20.04' , server )
41- end . converge_dsl ( 'test' ) do
42- elasticsearch_user 'elasticsearch'
43- elasticsearch_install 'elasticsearch' do
44- type 'package'
37+ supported_platforms . each do |platform , versions |
38+ versions . each do |version |
39+ context "on #{ platform . capitalize } #{ version } " do
40+ let ( :chef_run ) do
41+ ChefSpec ::ServerRunner . new ( platform : platform , version : version , step_into : [ 'elasticsearch_service' ] ) do |node , server |
42+ node_resources ( node )
43+ stub_chef_zero ( platform , version , server )
44+ end . converge ( 'test::default_service' )
45+ end
46+
47+ it 'creates systemd unit without restart policy' do
48+ systemd_unit = chef_run . systemd_unit ( 'elasticsearch' )
49+ expect ( systemd_unit . content [ :Service ] ) . not_to have_key ( :Restart )
50+ expect ( systemd_unit . content [ :Service ] ) . not_to have_key ( :RestartSec )
51+ end
4552 end
46- elasticsearch_configure 'elasticsearch'
47- elasticsearch_service 'elasticsearch'
4853 end
4954 end
50-
51- it 'creates systemd unit without restart policy' do
52- systemd_unit = chef_run . systemd_unit ( 'elasticsearch' )
53- expect ( systemd_unit . content [ :Service ] ) . not_to have_key ( :Restart )
54- expect ( systemd_unit . content [ :Service ] ) . not_to have_key ( :RestartSec )
55- end
5655 end
5756end
0 commit comments