Skip to content

Commit

Permalink
QE: refactor and fix "Create and modify a System profile using the XM…
Browse files Browse the repository at this point in the history
…L-RPC API" scenario (#8218)

* QE: refactor and fix "Create and modify a System profile using the XML-RPC API" scenario

Implement and add an API call to system.createSystemRecord using the SID and kickstart label

* QE: typo

Co-authored-by: Dominik Gedon <[email protected]>

---------

Co-authored-by: Dominik Gedon <[email protected]>
  • Loading branch information
NamelessOne91 and nodeg authored Jan 29, 2024
1 parent 66f59af commit 1565c16
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
4 changes: 1 addition & 3 deletions testsuite/features/secondary/srv_cobbler_profile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ Feature: Edit Cobbler profiles
When I create a system record with name "isesystem_api" and kickstart label "iseprofile_api"

Scenario: Create and modify a System profile using the XML-RPC API
# This should intentionally fail and XML-RPC should return an error here until
# https://github.com/uyuni-project/uyuni/pull/6676 gets merged by Ion
When I create and modify the kickstart system "isesystem_api" with hostname "ise-system.test" via XML-RPC
When I create and modify the kickstart system "isesystem_api" with kickstart label "iseprofile_api" and hostname "ise-system.test" via XML-RPC
| inst.repo | http://ise.cobbler.test |
| self_update | http://ise.cobbler.test |

Expand Down
10 changes: 7 additions & 3 deletions testsuite/features/step_definitions/api_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,13 @@
assert($output.select { |p| p['name'] == profile_name }.count == 1)
end

When(/^I create and modify the kickstart system "([^"]*)" with hostname "([^"]*)" via XML-RPC$/) do |name, hostname, values|
system_id = $api_test.system.create_system_profile(name, 'hostname' => hostname)
$stdout.puts "system_id: #{system_id}"
When(/^I create and modify the kickstart system "([^"]*)" with kickstart label "([^"]*)" and hostname "([^"]*)" via XML-RPC$/) do |name, kslabel, hostname, values|
# even though it should not happen during a testsuite run, it is useful to know when debugging that
# this call will raise a SystemCallError if matching systems already exist, the Error message will include a list of the matchings system IDs
sid = $api_test.system.create_system_profile(name, 'hostname' => hostname)
$stdout.puts "system_id: #{sid}"

$api_test.system.create_system_record_with_sid(sid, kslabel)
# this works only with a 2 column table where the key is in the left column
variables = values.rows_hash
$api_test.system.set_variables(system_id, variables)
Expand Down
12 changes: 11 additions & 1 deletion testsuite/features/support/namespaces/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def schedule_script_run(server, uid, gid, timeout, script, date)
end

##
# Creates a system record on the SUMA server.
# Creates a Cobbler system record for a system that is not registered on the SUMA server.
#
# Args:
# name: The name of the system record.
Expand All @@ -138,6 +138,16 @@ def create_system_record(name, kslabel, koptions, comment, netdevices)
@test.call('system.createSystemRecord', sessionKey: @test.token, systemName: name, ksLabel: kslabel, kOptions: koptions, comment: comment, netDevices: netdevices)
end

##
# Creates a Cobbler system record with the specified kickstart label
#
# Args:
# sid: The system id
# kslabel: The kickstart label you want to use.
def create_system_record_with_sid(sid, kslabel)
@test.call('system.createSystemRecord', sessionKey: @test.token, sid: sid, ksLabel: kslabel)
end

##
# Creates a system profile with the given name and data.
#
Expand Down

0 comments on commit 1565c16

Please sign in to comment.