Skip to content

Commit

Permalink
Improve pkill for fark_ipmi and check service before restarting one
Browse files Browse the repository at this point in the history
  • Loading branch information
maximenoel8 committed Oct 22, 2024
1 parent 8959512 commit 423018f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions testsuite/features/step_definitions/command_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,17 @@
raise ScriptError, 'File injection failed' unless success
end
server.run('chmod +x /etc/ipmi/fake_ipmi_host.sh', verbose: true, check_errors: true)
server.run('nohup ipmi_sim -n > /var/log/ipmi_sim.log 2>&1 &', verbose: true, check_errors: true)
# Check if ipmi_sim is already running
if server.run('pgrep -f ipmi_sim', verbose: false, check_errors: false).empty?
server.run('ipmi_sim -n < /dev/null > /dev/null &', verbose: true, check_errors: true)
else
puts 'ipmi_sim is already running; skipping startup.'
end
end

When(/^the server stops mocking an IPMI host$/) do
get_target('server').run('pkill ipmi_sim')
get_target('server').run("ps aux | grep [f]ake_ipmi_host.sh | awk '{print $2}' | xargs kill")
get_target('server').run('pkill --full fake_ipmi_host.sh || :')
end

When(/^the controller starts mocking a Redfish host$/) do
Expand Down

0 comments on commit 423018f

Please sign in to comment.