Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QE: Improve Cobbler tests and add a new profile test #6628

Merged
merged 9 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions testsuite/features/secondary/proxy_cobbler_pxeboot.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright (c) 2021-2022 SUSE LLC
# Licensed under the terms of the MIT license.
#

@proxy
@private_net
Expand Down Expand Up @@ -78,11 +77,11 @@ Feature: PXE boot a terminal with Cobbler
When I restart cobbler on the server
Then service "cobblerd" is active on "server"

Scenario: Set up tftp installation
Scenario: Set up tftp installation and synchronize it
When I configure tftp on the "server"
And I start tftp on the proxy
And I configure tftp on the "proxy"
And I synchronize the tftp configuration on the proxy with the server
And I run Cobbler sync with error checking

Scenario: Restart squid so proxy.example.org is recognized
When I restart squid service on the proxy
Expand Down
24 changes: 12 additions & 12 deletions testsuite/features/secondary/srv_cobbler_buildiso.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ Feature: Cobbler buildiso

Scenario: Create a dummy distro in the cobbler buildiso context
Given cobblerd is running
When I create distro "testdistro" as user "testing" with password "testing"
When I create distro "buildisodistro" as user "testing" with password "testing"

Scenario: Create dummy profiles in the cobbler buildiso context
Given distro "testdistro" exists
When I create profile "orchid" for distro "testdistro" as user "testing" with password "testing"
And I create profile "flame" for distro "testdistro" as user "testing" with password "testing"
And I create profile "pearl" for distro "testdistro" as user "testing" with password "testing"
Given distro "buildisodistro" exists
When I create profile "orchid" for distro "buildisodistro" as user "testing" with password "testing"
And I create profile "flame" for distro "buildisodistro" as user "testing" with password "testing"
And I create profile "pearl" for distro "buildisodistro" as user "testing" with password "testing"

Scenario: Check cobbler created a distro and profiles in the cobbler buildiso context
When I follow the left menu "Systems > Autoinstallation > Profiles"
Then I should see a "testdistro" text
Then I should see a "buildisodistro" text
And I should see a "orchid" text
And I should see a "flame" text
And I should see a "pearl" text
Expand All @@ -37,29 +37,29 @@ Feature: Cobbler buildiso
When I prepare Cobbler for the buildiso command

Scenario: Run Cobbler buildiso with all profiles and check isolinux config file in the cobbler buildiso context
When I run Cobbler buildiso for distro "testdistro" and all profiles
When I run Cobbler buildiso for distro "buildisodistro" and all profiles
And I check Cobbler buildiso ISO "profile_all" with xorriso
And I check the Cobbler parameter "nameserver" with value "9.9.9.9" in the isolinux.cfg
And I cleanup xorriso temp files

Scenario: Run Cobbler buildiso with selected profile in the cobbler buildiso context
When I run Cobbler buildiso for distro "testdistro" and profile "orchid"
When I run Cobbler buildiso for distro "buildisodistro" and profile "orchid"
And I check Cobbler buildiso ISO "orchid" with xorriso
And I cleanup xorriso temp files

# TODO: Fails unless https://github.com/cobbler/cobbler/issues/2995 is fixed
Scenario: Run Cobbler buildiso with selected profile and without dns entries in the cobbler buildiso context
When I run Cobbler buildiso for distro "testdistro" and profile "orchid" without dns entries
When I run Cobbler buildiso for distro "buildisodistro" and profile "orchid" without dns entries
And I check Cobbler buildiso ISO "orchid" with xorriso
And I cleanup xorriso temp files

Scenario: Run Cobbler buildiso airgapped with all profiles in the cobbler buildiso context
When I run Cobbler buildiso "airgapped" for distro "testdistro"
When I run Cobbler buildiso "airgapped" for distro "buildisodistro"
And I check Cobbler buildiso ISO "airgapped" with xorriso
And I cleanup xorriso temp files

Scenario: Run Cobbler buildiso standalone with all profiles in the cobbler buildiso context
When I run Cobbler buildiso "standalone" for distro "testdistro"
When I run Cobbler buildiso "standalone" for distro "buildisodistro"
And I check Cobbler buildiso ISO "standalone" with xorriso
And I cleanup xorriso temp files

Expand All @@ -68,7 +68,7 @@ Feature: Cobbler buildiso
When I remove system "testsystem" as user "testing" with password "testing"
And I remove kickstart profiles and distros
And I follow the left menu "Systems > Autoinstallation > Profiles"
Then I should not see a "testdistro" text
Then I should not see a "buildisodistro" text
And I should not see a "orchid" text
And I should not see a "flame" text
And I should not see a "flame" text
Expand Down
103 changes: 103 additions & 0 deletions testsuite/features/secondary/srv_cobbler_profile.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Copyright (c) 2023 SUSE LLC.
# Licensed under the terms of the MIT license.

@scope_cobbler
Feature: Cobbler editing profiles results in ISE
Tests for occuring Cobbler issue (bsc#1207532)
This feature is split up into 2 sections
The first section uses the webUI
The second one uses the XML-RPC API

Background: The Cobbler service should be running
Given cobblerd is running

Scenario: Copy cobbler profiles on the server
When I copy autoinstall mocked files on server

Scenario: Log in as testing user
Given I am authorized as "testing" with password "testing"

## UI tests
Scenario: Create a Cobbler distribution via the UI
When I follow the left menu "Systems > Autoinstallation > Distributions"
And I follow "Create Distribution"
When I enter "isedistro_ui" as "label"
And I enter "/var/autoinstall/Fedora_12_i386/" as "basepath"
And I select "Fedora" from "installtype"
And I click on "Create Autoinstallable Distribution"
Then I should see a "Autoinstallable Distributions" text
And I should see a "isedistro_ui" link

Scenario: Create a Cobbler profile via the UI
When I follow the left menu "Systems > Autoinstallation > Profiles"
And I follow "Create Kickstart Profile"
When I enter "iseprofile_ui" as "kickstartLabel"
And I click on "Next"
And I click on "Next"
And I enter "linux" as "rootPassword"
And I enter "linux" as "rootPasswordConfirm"
And I click on "Finish"
Then I should see a "Autoinstallation: iseprofile_ui" text
And I should see a "Autoinstallation Details" link

Scenario: Check Cobbler created distro and profile via the UI
When I follow the left menu "Systems > Autoinstallation > Profiles"
Then I should see a "iseprofile_ui" text
And I should see a "isedistro_ui" text

Scenario: Change profile variables using the UI
When I follow the left menu "Systems > Autoinstallation > Profiles"
And I follow "iseprofile_ui"
And I follow "Variables"
And I enter "ise_ui_test=ISE_UI_TEST" as "variables"
And I click on "Update Variables"
And I refresh the page
Then I should see a "ISE_UI_TEST" text

## XML-RPC API tests
Scenario: Create a Cobbler distribution via the UI in the XML-RPC context
When I follow the left menu "Systems > Autoinstallation > Distributions"
And I follow "Create Distribution"
When I enter "isedistro_api" as "label"
And I enter "/var/autoinstall/Fedora_12_i386/" as "basepath"
And I select "Fedora" from "installtype"
And I click on "Create Autoinstallable Distribution"
Then I should see a "Autoinstallable Distributions" text
And I should see a "isedistro_api" link

Scenario: Create a Cobbler profile via the UI in the XML-RPC context
When I follow the left menu "Systems > Autoinstallation > Profiles"
And I follow "Create Kickstart Profile"
When I enter "iseprofile_api" as "kickstartLabel"
And I click on "Next"
And I click on "Next"
And I enter "linux" as "rootPassword"
And I enter "linux" as "rootPasswordConfirm"
And I click on "Finish"
Then I should see a "Autoinstallation: iseprofile_api" text
And I should see a "Autoinstallation Details" link

Scenario: Check Cobbler created distro and profile via the UI in the XML-RPC context
When I follow the left menu "Systems > Autoinstallation > Profiles"
Then I should see a "iseprofile_api" text
And I should see a "isedistro_api" text

Scenario: Create a Cobbler system via the XML-RPC API
And 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
And I create and modify the kickstart system "isesystem_api" with hostname "ise-system.test" via XML-RPC
| inst.repo | http://ise.cobbler.test |
| self_update | http://ise.cobbler.test |

Scenario: Cleanup: delete test distros and profiles
When I remove kickstart profiles and distros
And I follow the left menu "Systems > System List"
And I wait until I see the "isesystem_api" system, refreshing the page
And I follow "isesystem_api"
And I follow "Delete System"
Then I should see a "Confirm System Profile Deletion" text
When I click on "Delete Profile"
And I wait until I see "has been deleted" text
3 changes: 2 additions & 1 deletion testsuite/features/secondary/srv_cobbler_sync.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2022-2023 SUSE LLC
# Licensed under the terms of the MIT license.

@scope_cobbler
Feature: Run Cobbler Sync via WebUI

Scenario: Login as admin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

@scope_power_management
@scope_cobbler
@sle_minion
Feature: IPMI Power management

Scenario: Fake an IPMI host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the terms of the MIT license.

@scope_api
@sle_minion
Feature: IPMI Power management API

Scenario: Setup an IPMI host for API test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

@scope_power_management
@scope_cobbler
@sle_minion
Feature: Redfish Power management

Scenario: Setup a Redfish host
Expand Down
13 changes: 13 additions & 0 deletions testsuite/features/step_definitions/api_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
$api_test.system.create_system_record('testserver', 'fedora_kickstart_profile_upload', '', 'my test server', [dev])
end

When(/^I create a system record with name "([^"]*)" and kickstart label "([^"]*)"$/) do |name, label|
dev = { 'name' => 'eth0', 'ip' => '1.1.1.2', 'mac' => '00:22:22:77:EE:DD', 'dnsname' => 'testserver.example.com' }
$api_test.system.create_system_record(name, label, '', 'my test server', [dev])
end

When(/^I wait for the OpenSCAP audit to finish$/) do
@sle_id = $api_test.system.retrieve_server_id($minion.full_hostname)
begin
Expand Down Expand Up @@ -570,3 +575,11 @@ def wait_action_complete(actionid, timeout: DEFAULT_TIMEOUT)
Then(/^"([^"]*)" should be present in the result$/) do |profile_name|
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}"
# 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)
end
22 changes: 19 additions & 3 deletions testsuite/features/step_definitions/cobbler_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
ct.system_remove(system)
end

When(/^I remove profile "([^"]*)" as user "([^"]*)" with password "([^"]*)"$/) do |system, user, pwd|
ct = ::CobblerTest.new
ct.login(user, pwd)
ct.profile_remove(system)
end

When(/^I remove distro "([^"]*)" as user "([^"]*)" with password "([^"]*)"$/) do |system, user, pwd|
ct = ::CobblerTest.new
ct.login(user, pwd)
ct.distro_remove(system)
end

When(/^I remove kickstart profiles and distros$/) do
host = $server.full_hostname
# -------------------------------
Expand Down Expand Up @@ -230,7 +242,11 @@
raise 'File injection failed' unless return_codes.all?(&:zero?)
end

When(/^I synchronize the tftp configuration on the proxy with the server$/) do
out, _code = $server.run('cobbler sync')
raise 'cobbler sync failed' if out.include? 'Push failed'
When(/^I run Cobbler sync (with|without) error checking$/) do |checking|
if checking == 'with'
out, _code = $server.run('cobbler sync')
raise 'cobbler sync failed' if out.include? 'Push failed'
nodeg marked this conversation as resolved.
Show resolved Hide resolved
else
_out, _code = $server.run('cobbler sync')
end
end
Loading