Skip to content

Commit

Permalink
QE: rename/reword steps interacting with the action chain API
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessOne91 committed Mar 3, 2025
1 parent a7d42eb commit 3133ce4
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion testsuite/features/secondary/allcli_action_chain.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Feature: Action chains on several systems at once
And I wait until the table contains "FINISHED" or "SKIPPED" followed by "FINISHED" in its first rows

Scenario: Create a custom action chain for two systems
When I call actionchain.create_chain() with chain label "two_systems_action_chain"
When I create an action chain with label "two_systems_action_chain" via API
And I follow the left menu "Schedule > Action Chains"
Then I should see a "two_systems_action_chain" text

Expand Down
32 changes: 16 additions & 16 deletions testsuite/features/secondary/min_action_chain.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Feature: Action chains on Salt minions
And I wait until the table contains "FINISHED" or "SKIPPED" followed by "FINISHED" in its first rows

Scenario: Create a custom action chain for the Salt minion
When I call actionchain.create_chain() with chain label "salt_minion_action_chain"
When I create an action chain with label "salt_minion_action_chain" via API
And I follow the left menu "Schedule > Action Chains"
Then I should see a "salt_minion_action_chain" text

Expand Down Expand Up @@ -187,7 +187,7 @@ Feature: Action chains on Salt minions

# previous, completed, action chain will no longer be available
Scenario: Create a custom action chain for the Salt minion
When I call actionchain.create_chain() with chain label "salt_minion_action_chain_to_delete"
When I create an action chain with label "salt_minion_action_chain_to_delete" via API
And I follow the left menu "Schedule > Action Chains"
Then I should see a "salt_minion_action_chain_to_delete" text

Expand Down Expand Up @@ -231,25 +231,25 @@ Feature: Action chains on Salt minions

Scenario: Add operations to the action chain via API for Salt minions
Given I want to operate on this "sle_minion"
When I call actionchain.create_chain() with chain label "salt_minion_api_chain"
And I call actionchain.add_package_install()
And I call actionchain.add_package_removal()
And I call actionchain.add_package_upgrade()
And I call actionchain.add_script_run() with the script "exit 1;"
And I call actionchain.add_system_reboot()
Then I should be able to see all these actions in the action chain
When I call actionchain.remove_action() on each action within the chain
When I create an action chain with label "salt_minion_api_chain" via API
And I add a package install to the action chain via API
And I add a package removal to the action chain via API
And I add a package upgrade to the action chain via API
And I add the script "exit 1;" to the action chain via API
And I add a system reboot to the action chain via API
Then I should be able to see all these actions in the action chain via API
When I remove each action within the chain via API
Then the current action chain should be empty
And I delete the action chain

Scenario: Run an action chain via API on Salt minion
Given I want to operate on this "sle_minion"
When I call actionchain.create_chain() with chain label "salt_minion_multiple_scripts"
And I call actionchain.add_script_run() with the script "echo -n 1 >> /tmp/action_chain.log"
And I call actionchain.add_script_run() with the script "echo -n 2 >> /tmp/action_chain.log"
And I call actionchain.add_script_run() with the script "echo -n 3 >> /tmp/action_chain.log"
And I call actionchain.add_script_run() with the script "touch /tmp/action_chain_done"
Then I should be able to see all these actions in the action chain
When I create an action chain with label "salt_minion_multiple_scripts" via API
And I add the script "echo -n 1 >> /tmp/action_chain.log" to the action chain via API
And I add the script "echo -n 2 >> /tmp/action_chain.log" to the action chain via API
And I add the script "echo -n 3 >> /tmp/action_chain.log" to the action chain via API
And I add the script "touch /tmp/action_chain_done" to the action chain via API
Then I should be able to see all these actions in the action chain via API
When I schedule the action chain
And I wait until there are no more action chains
And I wait until file "/tmp/action_chain_done" exists on "sle_minion"
Expand Down
30 changes: 15 additions & 15 deletions testsuite/features/secondary/minssh_action_chain.feature
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Feature: Salt SSH action chain
And I wait until the table contains "FINISHED" or "SKIPPED" followed by "FINISHED" in its first rows

Scenario: Create a custom action chain for the SSH minion
When I call actionchain.create_chain() with chain label "minssh_action_chain"
When I create an action chain with label "minssh_action_chain" via API
And I follow the left menu "Schedule > Action Chains"
Then I should see a "minssh_action_chain" text

Expand Down Expand Up @@ -178,7 +178,7 @@ Feature: Salt SSH action chain

# previous, completed, action chain will no longer be available
Scenario: Create a custom action chain for the SSH minion
When I call actionchain.create_chain() with chain label "minssh_action_chain_to_delete"
When I create an action chain with label "minssh_action_chain_to_delete" via API
And I follow the left menu "Schedule > Action Chains"
Then I should see a "minssh_action_chain_to_delete" text

Expand Down Expand Up @@ -225,24 +225,24 @@ Feature: Salt SSH action chain

Scenario: Add operations to the action chain via API for SSH minions
Given I want to operate on this "ssh_minion"
When I call actionchain.create_chain() with chain label "minssh_api_chain"
And I call actionchain.add_package_install()
And I call actionchain.add_package_removal()
And I call actionchain.add_package_upgrade()
And I call actionchain.add_script_run() with the script "exit 1;"
Then I should be able to see all these actions in the action chain
When I call actionchain.remove_action() on each action within the chain
When I create an action chain with label "minssh_api_chain" via API
And I add a package install to the action chain via API
And I add a package removal to the action chain via API
And I add a package upgrade to the action chain via API
And I add the script "exit 1;" to the action chain via API
Then I should be able to see all these actions in the action chain via API
When I remove each action within the chain via API
Then the current action chain should be empty
And I delete the action chain

Scenario: Run an action chain via API on SSH minion
And I want to operate on this "ssh_minion"
When I call actionchain.create_chain() with chain label "minssh_multiple_scripts"
And I call actionchain.add_script_run() with the script "echo -n 1 >> /tmp/action_chain.log"
And I call actionchain.add_script_run() with the script "echo -n 2 >> /tmp/action_chain.log"
And I call actionchain.add_script_run() with the script "echo -n 3 >> /tmp/action_chain.log"
And I call actionchain.add_script_run() with the script "touch /tmp/action_chain_done"
Then I should be able to see all these actions in the action chain
When I create an action chain with label "minssh_multiple_scripts" via API
And I add the script "echo -n 1 >> /tmp/action_chain.log" to the action chain via API
And I add the script "echo -n 2 >> /tmp/action_chain.log" to the action chain via API
And I add the script "echo -n 3 >> /tmp/action_chain.log" to the action chain via API
And I add the script "touch /tmp/action_chain_done" to the action chain via API
Then I should be able to see all these actions in the action chain via API
When I schedule the action chain
Then I wait until there are no more action chains
When I wait until file "/tmp/action_chain_done" exists on "ssh_minion"
Expand Down
24 changes: 12 additions & 12 deletions testsuite/features/step_definitions/api_common.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2024 SUSE LLC
# Copyright (c) 2015-2025 SUSE LLC
# Licensed under the terms of the MIT license.

### This file contains the definitions for all steps concerning the API.
Expand Down Expand Up @@ -302,13 +302,13 @@

# actionchain namespace

When(/^I call actionchain\.create_chain\(\) with chain label "(.*?)"$/) do |label|
When(/^I create an action chain with label "(.*?)" via API$/) do |label|
action_id = $api_test.actionchain.create_chain(label)
refute(action_id < 1)
$chain_label = label
end

When(/^I call actionchain\.list_chains\(\) if label "(.*?)" is there$/) do |label|
When(/^I see label "(.*?)" when I list action chains via API$/) do |label|
assert_includes($api_test.actionchain.list_chains, label)
end

Expand All @@ -328,7 +328,7 @@
end

# Renaming chain
Then(/^I call actionchain\.rename_chain\(\) to rename it from "(.*?)" to "(.*?)"$/) do |old_label, new_label|
Then(/^I rename the action chain with label "(.*?)" to "(.*?)" via API$/) do |old_label, new_label|
$api_test.actionchain.rename_chain(old_label, new_label)
end

Expand All @@ -345,11 +345,11 @@
end

# Schedule scenario
When(/^I call actionchain\.add_script_run\(\) with the script "(.*?)"$/) do |script|
When(/^I add the script "(.*?)" to the action chain via API$/) do |script|
refute($api_test.actionchain.add_script_run($client_id, $chain_label, 'root', 'root', 300, "#!/bin/bash\n#{script}") < 1)
end

Then(/^I should be able to see all these actions in the action chain$/) do
Then(/^I should be able to see all these actions in the action chain via API$/) do
actions = $api_test.actionchain.list_chain_actions($chain_label)
refute_nil(actions)
log 'Running actions:'
Expand All @@ -359,39 +359,39 @@
end

# Reboot
When(/^I call actionchain\.add_system_reboot\(\)$/) do
When(/^I add a system reboot to the action chain via API$/) do
refute($api_test.actionchain.add_system_reboot($client_id, $chain_label) < 1)
end

# Packages operations
When(/^I call actionchain\.add_package_install\(\)$/) do
When(/^I add a package install to the action chain via API$/) do
pkgs = $api_test.system.list_all_installable_packages($client_id)
refute_nil(pkgs)
refute_empty(pkgs)
refute($api_test.actionchain.add_package_install($client_id, [pkgs[0]['id']], $chain_label) < 1)
end

When(/^I call actionchain\.add_package_removal\(\)$/) do
When(/^I add a package removal to the action chain via API$/) do
pkgs = $api_test.system.list_all_installable_packages($client_id)
refute($api_test.actionchain.add_package_removal($client_id, [pkgs[0]['id']], $chain_label) < 1)
end

When(/^I call actionchain\.add_package_upgrade\(\)$/) do
When(/^I add a package upgrade to the action chain via API$/) do
pkgs = $api_test.system.list_latest_upgradable_packages($client_id)
refute_nil(pkgs)
refute_empty(pkgs)
refute($api_test.actionchain.add_package_upgrade($client_id, [pkgs[0]['to_package_id']], $chain_label) < 1)
end

When(/^I call actionchain\.add_package_verify\(\)$/) do
When(/^I add a package verification to the action chain via API$/) do
pkgs = $api_test.system.list_all_installable_packages($client_id)
refute_nil(pkgs)
refute_empty(pkgs)
refute($api_test.actionchain.add_package_verify($client_id, [pkgs[0]['id']], $chain_label) < 1)
end

# Manage actions within the action chain
When(/^I call actionchain\.remove_action\(\) on each action within the chain$/) do
When(/^I remove each action within the chain via API$/) do
actions = $api_test.actionchain.list_chain_actions($chain_label)
refute_nil(actions)
actions.each do |action|
Expand Down

0 comments on commit 3133ce4

Please sign in to comment.