Skip to content

Commit

Permalink
fix(vrrp_instances) Do not duplicate the 'notify_master' script
Browse files Browse the repository at this point in the history
  • Loading branch information
john-scalingo committed Jul 2, 2024
1 parent c88a91a commit ea53aca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
22 changes: 17 additions & 5 deletions spec/resources/vrrp_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,36 @@ def vrrp_instance_file_name(name)
end

it('should render a config file with the notify_stop correctly') do
is_expected.to render_file(file_name).with_content(%r{notify_stop\s/path/to_stop\.sh})
is_expected.to render_file(file_name).with_content{|s|
expect(s.scan(%r{notify_stop\s/path/to_stop\.sh}).size).to eq(1)
}

end

it('should render a config file with the notify_master correctly') do
is_expected.to render_file(file_name).with_content(%r{notify_master\s/path/to_master\.sh})
is_expected.to render_file(file_name).with_content{|s|
expect(s.scan(%r{notify_master\s/path/to_master\.sh}).size).to eq(1)
}
end

it('should render a config file with the notify_backup correctly') do
is_expected.to render_file(file_name).with_content(%r{notify_backup\s/path/to_backup\.sh})
is_expected.to render_file(file_name).with_content{|s|
expect(s.scan(%r{notify_backup\s/path/to_backup\.sh}).size).to eq(1)
}
end

it('should render a config file with the notify_fault correctly') do
is_expected.to render_file(file_name).with_content(%r{notify_fault\s/path/fault\.sh})
is_expected.to render_file(file_name).with_content{|s|
expect(s.scan(%r{notify_fault\s/path/fault\.sh}).size).to eq(1)
}
end

it('should render a config file with the notify correctly') do
is_expected.to render_file(file_name).with_content(%r{notify\s/path/notify\.sh})
is_expected.to render_file(file_name).with_content{|s|
expect(s.scan(%r{notify\s/path/notify\.sh}).size).to eq(1)
}
end

it('should render a config file with the smtp_alert set to true') do
is_expected.to render_file(file_name).with_content(/smtp_alert\strue/)
end
Expand Down
3 changes: 0 additions & 3 deletions templates/vrrp_instance.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ vrrp_instance <%= @instance_name %> {
<% if @notify_master %>
notify_master <%= @notify_master.to_s %>
<% end %>
<% if @notify_master %>
notify_master <%= @notify_master.to_s %>
<% end %>
<% if @notify_backup %>
notify_backup <%= @notify_backup.to_s %>
<% end %>
Expand Down

0 comments on commit ea53aca

Please sign in to comment.