From e1b2ebab6432cc5ed5c3565a31b63c65fcfb319a Mon Sep 17 00:00:00 2001 From: Robert Richardson Date: Tue, 19 Dec 2023 10:54:56 +0100 Subject: [PATCH] WIP: Requested Changes --- .../pages/channel/manage/syncrepos.jsp | 2 +- ...nges.rrichardson.reposync_package_deletion | 2 +- ...nges.rrichardson.reposync_package_deletion | 4 +--- ...ture => srv_strict_mode_repo_sync.feature} | 8 +++----- .../step_definitions/command_steps.rb | 20 +++++++++---------- .../step_definitions/navigation_steps.rb | 15 ++------------ .../github_validation_core.yml | 1 - 7 files changed, 17 insertions(+), 35 deletions(-) rename testsuite/features/reposync/{srv_sync_repo_sync.feature => srv_strict_mode_repo_sync.feature} (91%) diff --git a/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp b/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp index 06d9a734c8b0..534c4bb0aeaa 100644 --- a/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp +++ b/java/code/webapp/WEB-INF/pages/channel/manage/syncrepos.jsp @@ -126,7 +126,7 @@ - +
diff --git a/java/spacewalk-java.changes.rrichardson.reposync_package_deletion b/java/spacewalk-java.changes.rrichardson.reposync_package_deletion index 0edc7dc0f459..667afa981675 100644 --- a/java/spacewalk-java.changes.rrichardson.reposync_package_deletion +++ b/java/spacewalk-java.changes.rrichardson.reposync_package_deletion @@ -1 +1 @@ -- Add no-strict checkbox to manage channel sync page +- Add no-strict checkbox to channel sync page allowing to disable strict mode for package synchronisation diff --git a/python/spacewalk/spacewalk-backend.changes.rrichardson.reposync_package_deletion b/python/spacewalk/spacewalk-backend.changes.rrichardson.reposync_package_deletion index 6c1862eb082b..ae7144e6dd90 100644 --- a/python/spacewalk/spacewalk-backend.changes.rrichardson.reposync_package_deletion +++ b/python/spacewalk/spacewalk-backend.changes.rrichardson.reposync_package_deletion @@ -1,3 +1 @@ -- Implement no-strict option: - * Make strict=false the default in reposync.py - * Add no-script parameter handling to spacewalk-repo-sync +- Implement new default behaviour for channel synchronisation, now automatically dropping packages which are deleted from the upstream repository (strict mode) \ No newline at end of file diff --git a/testsuite/features/reposync/srv_sync_repo_sync.feature b/testsuite/features/reposync/srv_strict_mode_repo_sync.feature similarity index 91% rename from testsuite/features/reposync/srv_sync_repo_sync.feature rename to testsuite/features/reposync/srv_strict_mode_repo_sync.feature index 3edae5612be9..c663bf72e86d 100644 --- a/testsuite/features/reposync/srv_sync_repo_sync.feature +++ b/testsuite/features/reposync/srv_strict_mode_repo_sync.feature @@ -2,9 +2,9 @@ # Licensed under the terms of the MIT license. Feature: Strict Mode for Channel Synchronization - In order to control strict mode synchronization + In order to properly manage channel synchronisation As an admin user - I want to be able to toggle strict mode synchronization via the UI and command line + I want to be able to decide if deleted packages from upstream repos are dropped or kept Scenario: Create Test-strict-channel Given I am authorized for the "Admin" section @@ -27,7 +27,6 @@ Scenario: Prepare repos for strict test And I click on "Create Repository" Then I should see a "Repository created successfully" text -@rrichardson-test Scenario: Testing strict mode Given I am authorized for the "Admin" section And I follow the left menu "Software > Manage > Channels" @@ -38,7 +37,7 @@ Scenario: Testing strict mode And I follow "Sync" in the "content area" And I click on "Sync Now" And I wait at most 60 seconds until I do not see "Repository sync is running." text, refreshing the page - And I check the amount of packages in channel "test-strict-channel" + And I store the amount of packages in channel "test-strict-channel" And I follow "Add / Remove" And I uncheck "fake-rpm-repo" in the list And I check "fake-rpm-repo-modified" in the list @@ -48,7 +47,6 @@ Scenario: Testing strict mode And I click on "Sync Now" And I wait at most 60 seconds until I do not see "Repository sync is running." text, refreshing the page Then The amount of packages in channel "Test-Strict-Channel" should be the same as before - And I uncheck "no-strict" And I click on "Sync Now" And I wait at most 60 seconds until I do not see "Repository sync is running." text, refreshing the page diff --git a/testsuite/features/step_definitions/command_steps.rb b/testsuite/features/step_definitions/command_steps.rb index 0491bf0f72ec..7fdd4a6d0a39 100644 --- a/testsuite/features/step_definitions/command_steps.rb +++ b/testsuite/features/step_definitions/command_steps.rb @@ -135,28 +135,26 @@ raise 'Failed to login to the API' unless response.code == 200 end -$package_amount = nil - -When(/^I check the amount of packages in channel "([^"]*)"$/) do |channel_label| - channels = $api_test.channel.list_all_channels - if channels.key?(channel_label) - package_amount = channels[channel_label]['packages'] - puts "Package amount for 'test-strict': #{package_amount}" +When(/^I store the amount of packages in channel "([^"]*)"$/) do |channel_label| + add_context('channels', $api_test.channel.list_all_channels) + if get_context('channels').key?(channel_label) + add_context('package_amount', get_context('channels')[channel_label]['packages']) + puts "Package amount for 'test-strict': #{get_context('package_amount')}" else puts "#{channel_label} channel not found." end end Then(/^The amount of packages in channel "([^"]*)" should be the same as before$/) do |channel_label| - channels = $api_test.channel.list_all_channels - if channels.key?(channel_label) && ($package_amount != channels[channel_label]['packages']) + add_context('channels', $api_test.channel.list_all_channels) + if get_context('channels').key?(channel_label) && ( get_context('package_amount') != get_context('channels')[channel_label]['packages'] ) raise 'Package counts do not match' end end Then(/^The amount of packages in channel "([^"]*)" should be fewer than before$/) do |channel_label| - channels = $api_test.channel.list_all_channels - if channels.key?(channel_label) && channels[channel_label]['packages'] >= $package_amount + add_context('channels', $api_test.channel.list_all_channels) + if get_context('channels').key?(channel_label) && get_context('channels')[channel_label]['packages'] >= $package_amount raise 'Package count is not fewer than before' end end diff --git a/testsuite/features/step_definitions/navigation_steps.rb b/testsuite/features/step_definitions/navigation_steps.rb index 8daf7ec7651a..617c93248ea2 100644 --- a/testsuite/features/step_definitions/navigation_steps.rb +++ b/testsuite/features/step_definitions/navigation_steps.rb @@ -922,22 +922,11 @@ end end -When(/^I check "([^"]*)" in the list$/) do |text| - raise 'The text to check can\'t be empty' if text.empty? - - top_level_xpath_query = "//div[@class=\"table-responsive\"]/table/tbody/tr[.//td[contains(.,'#{text}')]]//input[@type='checkbox']" - row = find(:xpath, top_level_xpath_query, match: :first) - raise ScriptError, "xpath: #{top_level_xpath_query} not found" if row.nil? - - row.set(true) -end - -When(/^I uncheck "([^"]*)" in the list$/) do |text| +When(/^I (check|uncheck) "([^"]*)" in the list$/) do |check_option, text| top_level_xpath_query = "//div[@class=\"table-responsive\"]/table/tbody/tr[.//td[contains(.,'#{text}')]]//input[@type='checkbox']" row = find(:xpath, top_level_xpath_query, match: :first) raise "xpath: #{top_level_xpath_query} not found" if row.nil? - - row.set(false) + row.set(check_option == 'check') end # diff --git a/testsuite/run_sets/github_validation/github_validation_core.yml b/testsuite/run_sets/github_validation/github_validation_core.yml index 72a170c42d49..3dc0be5f7a24 100644 --- a/testsuite/run_sets/github_validation/github_validation_core.yml +++ b/testsuite/run_sets/github_validation/github_validation_core.yml @@ -10,7 +10,6 @@ - features/reposync/srv_create_fake_repositories.feature - features/reposync/srv_sync_fake_channels.feature - features/reposync/srv_create_activationkey.feature -- features/reposync/srv_sync_repo_sync.feature - features/core/srv_osimage.feature - features/core/srv_docker.feature ## Container features END ###