Skip to content

Commit

Permalink
Use a fake IPMI container in the CI
Browse files Browse the repository at this point in the history
The CI should never rely on packages being installed in the container.
The OpenIPMI package needed for the simulation is now in a container.
  • Loading branch information
cbosdo committed Jan 22, 2025
1 parent 0e9b42b commit 46b71b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
6 changes: 3 additions & 3 deletions testsuite/features/secondary/srv_power_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Feature: IPMI Power management
And I should see a "Save" button

Scenario: Save power management values
When I enter "127.0.0.1" as "powerAddress"
When I enter "fakeipmi" as "powerAddress"
And I enter "ipmiusr" as "powerUsername"
And I enter "test" as "powerPassword"
And I click on "Save"
Then I should see a "Power settings saved" text
And the cobbler report should contain "Power Management Address : 127.0.0.1" for "sle_minion"
And the cobbler report should contain "Power Management Address : fakeipmi" for "sle_minion"
And the cobbler report should contain "Power Management Username : ipmiusr" for "sle_minion"
And the cobbler report should contain "Power Management Password : test" for "sle_minion"
And the cobbler report should contain "Power Management Type : ipmilan" for "sle_minion"
Expand Down Expand Up @@ -75,7 +75,7 @@ Feature: IPMI Power management
Then I should see a "Configuration successfully saved for 1 system(s)" text
And the cobbler report should contain "Power Management Username : testing" for "sle_minion"
And the cobbler report should contain "Power Management Password : qwertz" for "sle_minion"
And the cobbler report should contain "Power Management Address : 127.0.0.1" for "sle_minion"
And the cobbler report should contain "Power Management Address : fakeipmi" for "sle_minion"
And the cobbler report should contain "Power Management Type : ipmilan" for "sle_minion"

Scenario: Check power management SSM operation
Expand Down
4 changes: 2 additions & 2 deletions testsuite/features/secondary/srv_power_management_api.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Feature: IPMI Power management API
Then power management results should have "ipmilan" for "powerType"

Scenario: Save power management values for API test
When I set power management value "127.0.0.1" for "powerAddress"
When I set power management value "fakeipmi" for "powerAddress"
And I set power management value "ipmiusr" for "powerUsername"
And I set power management value "test" for "powerPassword"
And I set power management value "ipmilan" for "powerType"
Then the cobbler report should contain "Power Management Address : 127.0.0.1" for "sle_minion"
Then the cobbler report should contain "Power Management Address : fakeipmi" for "sle_minion"
And the cobbler report should contain "Power Management Username : ipmiusr" for "sle_minion"
And the cobbler report should contain "Power Management Password : test" for "sle_minion"
And the cobbler report should contain "Power Management Type : ipmilan" for "sle_minion"
Expand Down
18 changes: 2 additions & 16 deletions testsuite/features/step_definitions/command_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -570,25 +570,11 @@

When(/^the server starts mocking an IPMI host$/) do
server = get_target('server')
server.run('mkdir -p /etc/ipmi')
%w[ipmisim1.emu lan.conf fake_ipmi_host.sh].each do |file|
source = "#{File.dirname(__FILE__)}/../upload_files/#{file}"
dest = "/etc/ipmi/#{file}"
success = file_inject(get_target('server'), source, dest)
raise ScriptError, 'File injection failed' unless success
end
server.run('chmod +x /etc/ipmi/fake_ipmi_host.sh', verbose: true, check_errors: true)
# Check if ipmi_sim is already running
if server.run('pgrep -f ipmi_sim', verbose: false, check_errors: false)[1].zero?
log 'ipmi_sim is already running; skipping startup.'
else
server.run('ipmi_sim -n < /dev/null > /dev/null &', verbose: true, check_errors: true)
end
server.run_local('podman run -d --rm --network uyuni -p [::]:623:623/udp -p [::]:9002:9002 --name fakeipmi ghcr.io/uyuni-project/uyuni/ci-fakeipmi:master', verbose: true, check_errors: true)
end

When(/^the server stops mocking an IPMI host$/) do
get_target('server').run('pkill ipmi_sim')
get_target('server').run('pkill --full fake_ipmi_host.sh || :', verbose: false, check_errors: false)
get_target('server').run_local('podman kill fakeipmi')
end

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

0 comments on commit 46b71b3

Please sign in to comment.