diff --git a/app/helpers/katello/content_view_helper.rb b/app/helpers/katello/content_view_helper.rb index 8ae5e11d509..326daeb4b7a 100644 --- a/app/helpers/katello/content_view_helper.rb +++ b/app/helpers/katello/content_view_helper.rb @@ -1,10 +1,12 @@ module Katello module ContentViewHelper def separated_repo_mapping(repo_mapping, use_multicopy_actions) - separated_mapping = { :pulp3_yum_multicopy => {}, :other => {} } + separated_mapping = { :pulp3_deb_multicopy => {}, :pulp3_yum_multicopy => {}, :other => {} } repo_mapping.each do |source_repos, dest_repo| if dest_repo.content_type == "yum" && SmartProxy.pulp_primary.pulp3_support?(dest_repo) && use_multicopy_actions separated_mapping[:pulp3_yum_multicopy][source_repos] = dest_repo + elsif dest_repo.content_type == "deb" && SmartProxy.pulp_primary.pulp3_support?(dest_repo) && use_multicopy_actions + separated_mapping[:pulp3_deb_multicopy][source_repos] = dest_repo else separated_mapping[:other][source_repos] = dest_repo end diff --git a/app/lib/actions/katello/content_view/publish.rb b/app/lib/actions/katello/content_view/publish.rb index d41914c66f8..a06b3faef38 100644 --- a/app/lib/actions/katello/content_view/publish.rb +++ b/app/lib/actions/katello/content_view/publish.rb @@ -58,6 +58,8 @@ def plan(content_view, description = "", options = {importing: false, syncable: if options[:importing] handle_import(version, options.slice(:path, :metadata)) + elsif separated_repo_map[:pulp3_deb_multicopy].keys.flatten.present? + plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_deb_multicopy], version) elsif separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present? plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum_multicopy], version) end diff --git a/app/lib/actions/katello/content_view_version/incremental_update.rb b/app/lib/actions/katello/content_view_version/incremental_update.rb index 77aae3af4d9..ea6523dcaf6 100644 --- a/app/lib/actions/katello/content_view_version/incremental_update.rb +++ b/app/lib/actions/katello/content_view_version/incremental_update.rb @@ -74,29 +74,31 @@ def plan(old_version, environments, options = {}) end concurrence do - if separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present? - extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:pulp3_yum_multicopy], old_version) - unit_map = pulp3_content_mapping(content) - - unless extended_repo_mapping.empty? || unit_map.values.flatten.empty? - sequence do - # Pre-copy content if dest_repo is a soft copy of its library instance. - # Don't use extended_repo_mapping because the source repositories are library instances. - # We want the old CV snapshot repositories here so as to not pull in excess new content. - separated_repo_map[:pulp3_yum_multicopy].each do |source_repos, dest_repo| - if dest_repo.soft_copy_of_library? - source_repos.each do |source_repo| - # remove_all flag is set to cover the case of incrementally updating more than once with different content. - # Without it, content from the previous incremental update will be copied as well due to how Pulp repo versions work. - plan_action(Pulp3::Repository::CopyContent, source_repo, SmartProxy.pulp_primary, dest_repo, copy_all: true, remove_all: true) + [:pulp3_deb_multicopy, :pulp3_yum_multicopy].each do |mapping| + if separated_repo_map[mapping].keys.flatten.present? + extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[mapping], old_version) + unit_map = pulp3_content_mapping(content) + + unless extended_repo_mapping.empty? || unit_map.values.flatten.empty? + sequence do + # Pre-copy content if dest_repo is a soft copy of its library instance. + # Don't use extended_repo_mapping because the source repositories are library instances. + # We want the old CV snapshot repositories here so as to not pull in excess new content. + separated_repo_map[mapping].each do |source_repos, dest_repo| + if dest_repo.soft_copy_of_library? + source_repos.each do |source_repo| + # remove_all flag is set to cover the case of incrementally updating more than once with different content. + # Without it, content from the previous incremental update will be copied as well due to how Pulp repo versions work. + plan_action(Pulp3::Repository::CopyContent, source_repo, SmartProxy.pulp_primary, dest_repo, copy_all: true, remove_all: true) + end end end - end - copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map, - dependency_solving: dep_solve).output - repos_to_clone.each do |source_repos| - if separated_repo_map[:pulp3_yum_multicopy].keys.include?(source_repos) - copy_repos(repository_mapping[source_repos]) + copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map, + dependency_solving: dep_solve).output + repos_to_clone.each do |source_repos| + if separated_repo_map[mapping].keys.include?(source_repos) + copy_repos(repository_mapping[source_repos]) + end end end end @@ -124,11 +126,14 @@ def plan(old_version, environments, options = {}) def pulp3_content_mapping(content) units = ::Katello::Erratum.with_identifiers(content[:errata_ids]) + + ::Katello::Deb.with_identifiers(content[:deb_ids]) + ::Katello::Rpm.with_identifiers(content[:package_ids]) - unit_map = { :errata => [], :rpms => [] } + unit_map = { :errata => [], :debs => [], :rpms => [] } units.each do |unit| if unit.class.name == "Katello::Erratum" unit_map[:errata] << unit.id + elsif unit.class.name == "Katello::Deb" + unit_map[:debs] << unit.id elsif unit.class.name == "Katello::Rpm" unit_map[:rpms] << unit.id end diff --git a/app/lib/actions/pulp3/repository/multi_copy_units.rb b/app/lib/actions/pulp3/repository/multi_copy_units.rb index fb37419ac12..54c7a8e034f 100644 --- a/app/lib/actions/pulp3/repository/multi_copy_units.rb +++ b/app/lib/actions/pulp3/repository/multi_copy_units.rb @@ -35,6 +35,10 @@ def invoke_external_task katello_errata.id in (#{input[:unit_map][:errata].join(",")})").map(&:erratum_pulp3_href) end + if input[:unit_map][:debs].any? + unit_hrefs << ::Katello::Deb.where(:id => input[:unit_map][:debs]).map(&:pulp_id) + end + if input[:unit_map][:rpms].any? unit_hrefs << ::Katello::Rpm.where(:id => input[:unit_map][:rpms]).map(&:pulp_id) end diff --git a/app/services/katello/pulp3/api/apt.rb b/app/services/katello/pulp3/api/apt.rb index 1c09ce06ec7..4c75cd082ca 100644 --- a/app/services/katello/pulp3/api/apt.rb +++ b/app/services/katello/pulp3/api/apt.rb @@ -21,7 +21,7 @@ def self.add_remove_content_class end def copy_api - PulpDebClient::CopyApi.new(api_client) + PulpDebClient::DebCopyApi.new(api_client) end end end diff --git a/app/services/katello/pulp3/repository/apt.rb b/app/services/katello/pulp3/repository/apt.rb index fd81ae1ea62..4191034c4f3 100644 --- a/app/services/katello/pulp3/repository/apt.rb +++ b/app/services/katello/pulp3/repository/apt.rb @@ -85,6 +85,15 @@ def multi_copy_units(repo_id_map, dependency_solving) dest_repo_href = ::Katello::Pulp3::Repository::Apt.new(dest_repo, SmartProxy.pulp_primary).repository_reference.repository_href content_unit_hrefs = dest_repo_id_map[:content_unit_hrefs] # Not needed during incremental update due to dest_base_version + # -> Unless incrementally updating a CV repo that is a soft copy of its library instance. + # -> I.e. no filters and not an incremental version. + unless dest_repo_id_map[:base_version] + # Don't perform extra content actions if the repo is a soft copy of its library instance. + # Taken care of by the IncrementalUpdate action. + unless dest_repo.soft_copy_of_library? + tasks << remove_all_content_from_repo(dest_repo_href) + end + end source_repo_ids.each do |source_repo_id| source_repo_version = ::Katello::Repository.find(source_repo_id).version_href config = { source_repo_version: source_repo_version, dest_repo: dest_repo_href, content: content_unit_hrefs } @@ -233,7 +242,8 @@ def copy_units(content_unit_hrefs, remove_all) tasks << add_content(slice, first_slice) first_slice = false end - else + # If we're merging composite cv repositories, don't clear out the Pulp repository. + elsif remove_all tasks << remove_all_content end tasks diff --git a/test/actions/katello/content_view_version_test.rb b/test/actions/katello/content_view_version_test.rb index d156f7e6316..fc199504e82 100644 --- a/test/actions/katello/content_view_version_test.rb +++ b/test/actions/katello/content_view_version_test.rb @@ -87,7 +87,7 @@ def pulp3_cvv_setup pulp3_repo_map[[library_repo.id]] = { :dest_repo => new_repo.id, :base_version => nil } assert_action_planned_with(action, ::Actions::Pulp3::Repository::MultiCopyUnits, pulp3_repo_map, - { :errata => [], :rpms => [old_rpm.id] }, + { :debs => [], :errata => [], :rpms => [old_rpm.id] }, :dependency_solving => false) assert_action_planned_with(action, ::Actions::Pulp3::Repository::CopyContent, library_repo, SmartProxy.pulp_primary, new_repo, copy_all: true, remove_all: true) assert_action_planned_with(action, ::Actions::Katello::Repository::MetadataGenerate, new_repo) @@ -103,7 +103,7 @@ def pulp3_cvv_setup pulp3_repo_map[[library_repo.id]] = { :dest_repo => new_repo.id, :base_version => 1 } assert_action_planned_with(action, ::Actions::Pulp3::Repository::MultiCopyUnits, pulp3_repo_map, - { :errata => [], :rpms => [old_rpm.id] }, + { :debs => [], :errata => [], :rpms => [old_rpm.id] }, :dependency_solving => true) refute_action_planned(action, ::Actions::Pulp3::Repository::CopyContent) end diff --git a/test/fixtures/vcr_cassettes/katello/service/pulp3/repository/apt/copy_units_rewrites_missing_content_error.yml b/test/fixtures/vcr_cassettes/katello/service/pulp3/repository/apt/copy_units_rewrites_missing_content_error.yml new file mode 100644 index 00000000000..f4b445ce7e9 --- /dev/null +++ b/test/fixtures/vcr_cassettes/katello/service/pulp3/repository/apt/copy_units_rewrites_missing_content_error.yml @@ -0,0 +1,744 @@ +--- +http_interactions: +- request: + method: get + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/contentguards/certguard/rhsm/ + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/1.7.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, POST, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '52' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - b84d2ba9756f48b4b1c45e17aa4a5afe + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJjb3VudCI6MCwibmV4dCI6bnVsbCwicHJldmlvdXMiOm51bGwsInJlc3Vs + dHMiOltdfQ== + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: get + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/repositories/deb/apt/?name=debian_9 + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, POST, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '486' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - f7fcb4a020dc46c69e4564a569f47060 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJjb3VudCI6MSwibmV4dCI6bnVsbCwicHJldmlvdXMiOm51bGwsInJlc3Vs + dHMiOlt7InB1bHBfaHJlZiI6Ii9wdWxwL2FwaS92My9yZXBvc2l0b3JpZXMv + ZGViL2FwdC80Y2IwNjFmYS0yNjI5LTQzNGMtOThhMi1iZTRlYzA5ZDM5ODkv + IiwicHVscF9jcmVhdGVkIjoiMjAyMy0xMi0yMlQxMzozOToyMy40MDU1MTNa + IiwidmVyc2lvbnNfaHJlZiI6Ii9wdWxwL2FwaS92My9yZXBvc2l0b3JpZXMv + ZGViL2FwdC80Y2IwNjFmYS0yNjI5LTQzNGMtOThhMi1iZTRlYzA5ZDM5ODkv + dmVyc2lvbnMvIiwicHVscF9sYWJlbHMiOnt9LCJsYXRlc3RfdmVyc2lvbl9o + cmVmIjoiL3B1bHAvYXBpL3YzL3JlcG9zaXRvcmllcy9kZWIvYXB0LzRjYjA2 + MWZhLTI2MjktNDM0Yy05OGEyLWJlNGVjMDlkMzk4OS92ZXJzaW9ucy8wLyIs + Im5hbWUiOiJkZWJpYW5fOSIsImRlc2NyaXB0aW9uIjpudWxsLCJyZXRhaW5f + cmVwb192ZXJzaW9ucyI6bnVsbCwicmVtb3RlIjpudWxsfV19 + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: delete + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/repositories/deb/apt/4cb061fa-2629-434c-98a2-be4ec09d3989/ + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 202 + message: Accepted + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '67' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 9e6e71c3b4d2430fa97378466f52fdf5 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJ0YXNrIjoiL3B1bHAvYXBpL3YzL3Rhc2tzLzM1NzEzMThkLTNiYTAtNDE5 + MS05MGU3LWI4NjBiY2EwZmE3My8ifQ== + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: get + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/remotes/deb/apt/?name=debian_9 + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, POST, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '1003' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 48c1787d1d484c478922b185a54ac6f3 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJjb3VudCI6MSwibmV4dCI6bnVsbCwicHJldmlvdXMiOm51bGwsInJlc3Vs + dHMiOlt7InB1bHBfaHJlZiI6Ii9wdWxwL2FwaS92My9yZW1vdGVzL2RlYi9h + cHQvZmJkMzIwN2EtYjg5NC00OTBhLThmOWUtZDk4YTA2OTk5NDU5LyIsInB1 + bHBfY3JlYXRlZCI6IjIwMjMtMTItMjJUMTM6Mzk6MjMuMTgyMjA2WiIsIm5h + bWUiOiJkZWJpYW5fOSIsInVybCI6Imh0dHA6Ly9mdHAuZGViaWFuLm15bWly + cm9yLm9yZy9kZWJpYW4iLCJjYV9jZXJ0IjpudWxsLCJjbGllbnRfY2VydCI6 + bnVsbCwidGxzX3ZhbGlkYXRpb24iOnRydWUsInByb3h5X3VybCI6bnVsbCwi + cHVscF9sYWJlbHMiOnt9LCJwdWxwX2xhc3RfdXBkYXRlZCI6IjIwMjMtMTIt + MjJUMTM6Mzk6MjMuMTgyMjQwWiIsImRvd25sb2FkX2NvbmN1cnJlbmN5Ijpu + dWxsLCJtYXhfcmV0cmllcyI6bnVsbCwicG9saWN5Ijoib25fZGVtYW5kIiwi + dG90YWxfdGltZW91dCI6MzYwMC4wLCJjb25uZWN0X3RpbWVvdXQiOjYwLjAs + InNvY2tfY29ubmVjdF90aW1lb3V0Ijo2MC4wLCJzb2NrX3JlYWRfdGltZW91 + dCI6MzYwMC4wLCJoZWFkZXJzIjpudWxsLCJyYXRlX2xpbWl0IjowLCJoaWRk + ZW5fZmllbGRzIjpbeyJuYW1lIjoiY2xpZW50X2tleSIsImlzX3NldCI6ZmFs + c2V9LHsibmFtZSI6InByb3h5X3VzZXJuYW1lIiwiaXNfc2V0IjpmYWxzZX0s + eyJuYW1lIjoicHJveHlfcGFzc3dvcmQiLCJpc19zZXQiOmZhbHNlfSx7Im5h + bWUiOiJ1c2VybmFtZSIsImlzX3NldCI6ZmFsc2V9LHsibmFtZSI6InBhc3N3 + b3JkIiwiaXNfc2V0IjpmYWxzZX1dLCJkaXN0cmlidXRpb25zIjoic3RyZXRj + aCIsImNvbXBvbmVudHMiOiJtYWluIiwiYXJjaGl0ZWN0dXJlcyI6ImFtZDY0 + Iiwic3luY19zb3VyY2VzIjpmYWxzZSwic3luY191ZGVicyI6ZmFsc2UsInN5 + bmNfaW5zdGFsbGVyIjpmYWxzZSwiZ3Bna2V5IjoiQURGI0ZDU0ZBU0RGJEAk + QFpGRERTRyQjJSMlQURTIiwiaWdub3JlX21pc3NpbmdfcGFja2FnZV9pbmRp + Y2VzIjpmYWxzZX1dfQ== + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: delete + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/remotes/deb/apt/fbd3207a-b894-490a-8f9e-d98a06999459/ + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 202 + message: Accepted + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '67' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 3af18a63756e4e15a7642efa4fcf7120 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJ0YXNrIjoiL3B1bHAvYXBpL3YzL3Rhc2tzLzMyYmUzZDNmLTQ2NjktNGYy + Mi1hNmM4LWNlZTBiMjA1YzgwOS8ifQ== + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: get + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/tasks/3571318d-3ba0-4191-90e7-b860bca0fa73/ + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.39.4/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, PATCH, DELETE, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '607' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - f4b79909acb444e0b3e1d0d30e3f3bf9 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJwdWxwX2hyZWYiOiIvcHVscC9hcGkvdjMvdGFza3MvMzU3MTMxOGQtM2Jh + MC00MTkxLTkwZTctYjg2MGJjYTBmYTczLyIsInB1bHBfY3JlYXRlZCI6IjIw + MjQtMDEtMTFUMTI6NDk6MTcuNTE4OTM5WiIsInN0YXRlIjoiY29tcGxldGVk + IiwibmFtZSI6InB1bHBjb3JlLmFwcC50YXNrcy5iYXNlLmdlbmVyYWxfZGVs + ZXRlIiwibG9nZ2luZ19jaWQiOiI5ZTZlNzFjM2I0ZDI0MzBmYTk3Mzc4NDY2 + ZjUyZmRmNSIsInN0YXJ0ZWRfYXQiOiIyMDI0LTAxLTExVDEyOjQ5OjE3LjU2 + NDE1NVoiLCJmaW5pc2hlZF9hdCI6IjIwMjQtMDEtMTFUMTI6NDk6MTcuNjY2 + OTEzWiIsImVycm9yIjpudWxsLCJ3b3JrZXIiOiIvcHVscC9hcGkvdjMvd29y + a2Vycy8wZjY5M2JmNi00ZjJiLTQwNGEtYmZhYS1hNjFmMzEzMGM3MDIvIiwi + cGFyZW50X3Rhc2siOm51bGwsImNoaWxkX3Rhc2tzIjpbXSwidGFza19ncm91 + cCI6bnVsbCwicHJvZ3Jlc3NfcmVwb3J0cyI6W10sImNyZWF0ZWRfcmVzb3Vy + Y2VzIjpbXSwicmVzZXJ2ZWRfcmVzb3VyY2VzX3JlY29yZCI6WyIvcHVscC9h + cGkvdjMvcmVwb3NpdG9yaWVzL2RlYi9hcHQvNGNiMDYxZmEtMjYyOS00MzRj + LTk4YTItYmU0ZWMwOWQzOTg5LyJdfQ== + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: get + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/tasks/32be3d3f-4669-4f22-a6c8-cee0b205c809/ + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.39.4/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, PATCH, DELETE, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '602' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - cfd25570a1e24837847c4c2ee49e290f + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJwdWxwX2hyZWYiOiIvcHVscC9hcGkvdjMvdGFza3MvMzJiZTNkM2YtNDY2 + OS00ZjIyLWE2YzgtY2VlMGIyMDVjODA5LyIsInB1bHBfY3JlYXRlZCI6IjIw + MjQtMDEtMTFUMTI6NDk6MTcuNjM2NTk5WiIsInN0YXRlIjoiY29tcGxldGVk + IiwibmFtZSI6InB1bHBjb3JlLmFwcC50YXNrcy5iYXNlLmdlbmVyYWxfZGVs + ZXRlIiwibG9nZ2luZ19jaWQiOiIzYWYxOGE2Mzc1NmU0ZTE1YTc2NDJlZmE0 + ZmNmNzEyMCIsInN0YXJ0ZWRfYXQiOiIyMDI0LTAxLTExVDEyOjQ5OjE3LjY5 + OTc2MloiLCJmaW5pc2hlZF9hdCI6IjIwMjQtMDEtMTFUMTI6NDk6MTcuNzIz + NTM3WiIsImVycm9yIjpudWxsLCJ3b3JrZXIiOiIvcHVscC9hcGkvdjMvd29y + a2Vycy80MTdhZTY1NC1kYTk3LTQyYjUtYjYwMC00NTA1YzJlOGY4YzMvIiwi + cGFyZW50X3Rhc2siOm51bGwsImNoaWxkX3Rhc2tzIjpbXSwidGFza19ncm91 + cCI6bnVsbCwicHJvZ3Jlc3NfcmVwb3J0cyI6W10sImNyZWF0ZWRfcmVzb3Vy + Y2VzIjpbXSwicmVzZXJ2ZWRfcmVzb3VyY2VzX3JlY29yZCI6WyIvcHVscC9h + cGkvdjMvcmVtb3Rlcy9kZWIvYXB0L2ZiZDMyMDdhLWI4OTQtNDkwYS04Zjll + LWQ5OGEwNjk5OTQ1OS8iXX0= + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: get + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/distributions/deb/apt/?name=debian_9 + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, POST, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '52' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 904fffcb0c234070b4ed25c93540df57 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJjb3VudCI6MCwibmV4dCI6bnVsbCwicHJldmlvdXMiOm51bGwsInJlc3Vs + dHMiOltdfQ== + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: get + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/distributions/deb/apt/?base_path=ACME_Corporation/library/debian_9_label + body: + encoding: US-ASCII + base64_string: '' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 11 Jan 2024 12:49:17 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - GET, POST, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '52' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 449f2fc25bb940839ab50d556b343c40 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJjb3VudCI6MCwibmV4dCI6bnVsbCwicHJldmlvdXMiOm51bGwsInJlc3Vs + dHMiOltdfQ== + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:17 GMT +- request: + method: post + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/remotes/deb/apt/ + body: + encoding: UTF-8 + base64_string: | + eyJuYW1lIjoiZGViaWFuXzkiLCJ1cmwiOiJodHRwOi8vZnRwLmRlYmlhbi5t + eW1pcnJvci5vcmcvZGViaWFuIiwiY2FfY2VydCI6bnVsbCwiY2xpZW50X2Nl + cnQiOm51bGwsImNsaWVudF9rZXkiOm51bGwsInRsc192YWxpZGF0aW9uIjp0 + cnVlLCJwcm94eV91cmwiOm51bGwsInByb3h5X3VzZXJuYW1lIjpudWxsLCJw + cm94eV9wYXNzd29yZCI6bnVsbCwidXNlcm5hbWUiOm51bGwsInBhc3N3b3Jk + IjpudWxsLCJwb2xpY3kiOiJvbl9kZW1hbmQiLCJ0b3RhbF90aW1lb3V0Ijoz + NjAwLCJjb25uZWN0X3RpbWVvdXQiOjYwLCJzb2NrX2Nvbm5lY3RfdGltZW91 + dCI6NjAsInNvY2tfcmVhZF90aW1lb3V0IjozNjAwLCJyYXRlX2xpbWl0Ijow + LCJkaXN0cmlidXRpb25zIjoic3RyZXRjaCIsImNvbXBvbmVudHMiOiJtYWlu + IiwiYXJjaGl0ZWN0dXJlcyI6ImFtZDY0IiwiZ3Bna2V5IjoiQURGI0ZDU0ZB + U0RGJEAkQFpGRERTRyQjJSMlQURTIn0= + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 11 Jan 2024 12:49:18 GMT + Server: + - gunicorn + Content-Type: + - application/json + Location: + - "/pulp/api/v3/remotes/deb/apt/7428c0dc-03e9-4ad5-bb10-15616324fcd3/" + Vary: + - Accept,Cookie + Allow: + - GET, POST, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '951' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 774b144c49f24f91b7a041d29821a1ac + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJwdWxwX2hyZWYiOiIvcHVscC9hcGkvdjMvcmVtb3Rlcy9kZWIvYXB0Lzc0 + MjhjMGRjLTAzZTktNGFkNS1iYjEwLTE1NjE2MzI0ZmNkMy8iLCJwdWxwX2Ny + ZWF0ZWQiOiIyMDI0LTAxLTExVDEyOjQ5OjE4LjAyMTQ4MVoiLCJuYW1lIjoi + ZGViaWFuXzkiLCJ1cmwiOiJodHRwOi8vZnRwLmRlYmlhbi5teW1pcnJvci5v + cmcvZGViaWFuIiwiY2FfY2VydCI6bnVsbCwiY2xpZW50X2NlcnQiOm51bGws + InRsc192YWxpZGF0aW9uIjp0cnVlLCJwcm94eV91cmwiOm51bGwsInB1bHBf + bGFiZWxzIjp7fSwicHVscF9sYXN0X3VwZGF0ZWQiOiIyMDI0LTAxLTExVDEy + OjQ5OjE4LjAyMTQ5NloiLCJkb3dubG9hZF9jb25jdXJyZW5jeSI6bnVsbCwi + bWF4X3JldHJpZXMiOm51bGwsInBvbGljeSI6Im9uX2RlbWFuZCIsInRvdGFs + X3RpbWVvdXQiOjM2MDAuMCwiY29ubmVjdF90aW1lb3V0Ijo2MC4wLCJzb2Nr + X2Nvbm5lY3RfdGltZW91dCI6NjAuMCwic29ja19yZWFkX3RpbWVvdXQiOjM2 + MDAuMCwiaGVhZGVycyI6bnVsbCwicmF0ZV9saW1pdCI6MCwiaGlkZGVuX2Zp + ZWxkcyI6W3sibmFtZSI6ImNsaWVudF9rZXkiLCJpc19zZXQiOmZhbHNlfSx7 + Im5hbWUiOiJwcm94eV91c2VybmFtZSIsImlzX3NldCI6ZmFsc2V9LHsibmFt + ZSI6InByb3h5X3Bhc3N3b3JkIiwiaXNfc2V0IjpmYWxzZX0seyJuYW1lIjoi + dXNlcm5hbWUiLCJpc19zZXQiOmZhbHNlfSx7Im5hbWUiOiJwYXNzd29yZCIs + ImlzX3NldCI6ZmFsc2V9XSwiZGlzdHJpYnV0aW9ucyI6InN0cmV0Y2giLCJj + b21wb25lbnRzIjoibWFpbiIsImFyY2hpdGVjdHVyZXMiOiJhbWQ2NCIsInN5 + bmNfc291cmNlcyI6ZmFsc2UsInN5bmNfdWRlYnMiOmZhbHNlLCJzeW5jX2lu + c3RhbGxlciI6ZmFsc2UsImdwZ2tleSI6IkFERiNGQ1NGQVNERiRAJEBaRkRE + U0ckIyUjJUFEUyIsImlnbm9yZV9taXNzaW5nX3BhY2thZ2VfaW5kaWNlcyI6 + ZmFsc2V9 + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:18 GMT +- request: + method: post + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/repositories/deb/apt/ + body: + encoding: UTF-8 + base64_string: 'eyJuYW1lIjoiZGViaWFuXzkifQ== + +' + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Thu, 11 Jan 2024 12:49:18 GMT + Server: + - gunicorn + Content-Type: + - application/json + Location: + - "/pulp/api/v3/repositories/deb/apt/31ce65a2-3252-47b2-8188-242ea96f96d4/" + Vary: + - Accept,Cookie + Allow: + - GET, POST, HEAD, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '434' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 28049a17ee4c44508a66e6424a9aa186 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + body: + encoding: UTF-8 + base64_string: | + eyJwdWxwX2hyZWYiOiIvcHVscC9hcGkvdjMvcmVwb3NpdG9yaWVzL2RlYi9h + cHQvMzFjZTY1YTItMzI1Mi00N2IyLTgxODgtMjQyZWE5NmY5NmQ0LyIsInB1 + bHBfY3JlYXRlZCI6IjIwMjQtMDEtMTFUMTI6NDk6MTguMjQzODA1WiIsInZl + cnNpb25zX2hyZWYiOiIvcHVscC9hcGkvdjMvcmVwb3NpdG9yaWVzL2RlYi9h + cHQvMzFjZTY1YTItMzI1Mi00N2IyLTgxODgtMjQyZWE5NmY5NmQ0L3ZlcnNp + b25zLyIsInB1bHBfbGFiZWxzIjp7fSwibGF0ZXN0X3ZlcnNpb25faHJlZiI6 + Ii9wdWxwL2FwaS92My9yZXBvc2l0b3JpZXMvZGViL2FwdC8zMWNlNjVhMi0z + MjUyLTQ3YjItODE4OC0yNDJlYTk2Zjk2ZDQvdmVyc2lvbnMvMC8iLCJuYW1l + IjoiZGViaWFuXzkiLCJkZXNjcmlwdGlvbiI6bnVsbCwicmV0YWluX3JlcG9f + dmVyc2lvbnMiOm51bGwsInJlbW90ZSI6bnVsbH0= + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:18 GMT +- request: + method: post + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/repositories/deb/apt/31ce65a2-3252-47b2-8188-242ea96f96d4/modify/ + body: + encoding: UTF-8 + base64_string: | + eyJhZGRfY29udGVudF91bml0cyI6WyIvcHVscC9hcGkvdjMvcmVwb3NpdG9y + aWVzL2RlYi9hcHQvYWFhYWFhYWEtYWFhYS1hYWFhLWFhYWEtYWFhYWFhYWFh + YWFhLyJdfQ== + headers: + Content-Type: + - application/json + User-Agent: + - OpenAPI-Generator/3.0.1/ruby + Accept: + - application/json + Authorization: + - Basic Og== + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Thu, 11 Jan 2024 12:49:18 GMT + Server: + - gunicorn + Content-Type: + - application/json + Vary: + - Accept,Cookie + Allow: + - POST, OPTIONS + X-Frame-Options: + - DENY + Content-Length: + - '123' + X-Content-Type-Options: + - nosniff + Referrer-Policy: + - same-origin + Correlation-Id: + - 1ecff421a08442e78eaf9c6c4ad59183 + Access-Control-Expose-Headers: + - Correlation-ID + Via: + - 1.1 centos8-katello-devel-stable.example.com + Connection: + - close + body: + encoding: UTF-8 + base64_string: | + WyJDb3VsZCBub3QgZmluZCB0aGUgZm9sbG93aW5nIGNvbnRlbnQgdW5pdHM6 + IFsnL3B1bHAvYXBpL3YzL3JlcG9zaXRvcmllcy9kZWIvYXB0L2FhYWFhYWFh + LWFhYWEtYWFhYS1hYWFhLWFhYWFhYWFhYWFhYS8nXSJd + http_version: + recorded_at: Thu, 11 Jan 2024 12:49:18 GMT +recorded_with: VCR 3.0.3 diff --git a/test/fixtures/vcr_cassettes/katello/service/pulp3/repository/apt_vcr/create_remote_with_http_proxy_creds.yml b/test/fixtures/vcr_cassettes/katello/service/pulp3/repository/apt_vcr/create_remote_with_http_proxy_creds.yml index 7660f385ec8..a7fc545e0b3 100644 --- a/test/fixtures/vcr_cassettes/katello/service/pulp3/repository/apt_vcr/create_remote_with_http_proxy_creds.yml +++ b/test/fixtures/vcr_cassettes/katello/service/pulp3/repository/apt_vcr/create_remote_with_http_proxy_creds.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://centos8-katello-devel.cannolo.example.com/pulp/api/v3/remotes/deb/apt/ + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/remotes/deb/apt/ body: encoding: UTF-8 base64_string: | @@ -22,7 +22,7 @@ http_interactions: Content-Type: - application/json User-Agent: - - OpenAPI-Generator/3.0.0/ruby + - OpenAPI-Generator/3.0.1/ruby Accept: - application/json Authorization: @@ -35,13 +35,13 @@ http_interactions: message: Created headers: Date: - - Tue, 07 Nov 2023 19:44:41 GMT + - Thu, 11 Jan 2024 12:49:16 GMT Server: - gunicorn Content-Type: - application/json Location: - - "/pulp/api/v3/remotes/deb/apt/018bab50-cec5-7cc0-bdf9-f789de17158f/" + - "/pulp/api/v3/remotes/deb/apt/12644d79-c993-4513-b085-59713754e9a5/" Vary: - Accept,Cookie Allow: @@ -54,25 +54,23 @@ http_interactions: - nosniff Referrer-Policy: - same-origin - Cross-Origin-Opener-Policy: - - same-origin Correlation-Id: - - 991e57cb8a804126a2f4ad0adeb623ed + - 1f252e0174bc48c7878c3e556a6f49aa Access-Control-Expose-Headers: - Correlation-ID Via: - - 1.1 centos8-katello-devel.cannolo.example.com + - 1.1 centos8-katello-devel-stable.example.com body: encoding: UTF-8 base64_string: | - eyJwdWxwX2hyZWYiOiIvcHVscC9hcGkvdjMvcmVtb3Rlcy9kZWIvYXB0LzAx - OGJhYjUwLWNlYzUtN2NjMC1iZGY5LWY3ODlkZTE3MTU4Zi8iLCJwdWxwX2Ny - ZWF0ZWQiOiIyMDIzLTExLTA3VDE5OjQ0OjQxLjY3MDI0NloiLCJuYW1lIjoi + eyJwdWxwX2hyZWYiOiIvcHVscC9hcGkvdjMvcmVtb3Rlcy9kZWIvYXB0LzEy + NjQ0ZDc5LWM5OTMtNDUxMy1iMDg1LTU5NzEzNzU0ZTlhNS8iLCJwdWxwX2Ny + ZWF0ZWQiOiIyMDI0LTAxLTExVDEyOjQ5OjE2LjYwMDUyNFoiLCJuYW1lIjoi RGViaWFuIDkgYW1kNjQtdGVzdCIsInVybCI6Imh0dHA6Ly9mdHAuZGViaWFu Lm15bWlycm9yLm9yZy9kZWJpYW4iLCJjYV9jZXJ0IjpudWxsLCJjbGllbnRf Y2VydCI6bnVsbCwidGxzX3ZhbGlkYXRpb24iOnRydWUsInByb3h5X3VybCI6 Imh0dHBzOi8vbXl0ZXN0LmNvbSIsInB1bHBfbGFiZWxzIjp7fSwicHVscF9s - YXN0X3VwZGF0ZWQiOiIyMDIzLTExLTA3VDE5OjQ0OjQxLjY3MDI2OFoiLCJk + YXN0X3VwZGF0ZWQiOiIyMDI0LTAxLTExVDEyOjQ5OjE2LjYwMDU1NloiLCJk b3dubG9hZF9jb25jdXJyZW5jeSI6bnVsbCwibWF4X3JldHJpZXMiOm51bGws InBvbGljeSI6Im9uX2RlbWFuZCIsInRvdGFsX3RpbWVvdXQiOjM2MDAuMCwi Y29ubmVjdF90aW1lb3V0Ijo2MC4wLCJzb2NrX2Nvbm5lY3RfdGltZW91dCI6 @@ -88,10 +86,10 @@ http_interactions: ZXkiOiJBREYjRkNTRkFTREYkQCRAWkZERFNHJCMlIyVBRFMiLCJpZ25vcmVf bWlzc2luZ19wYWNrYWdlX2luZGljZXMiOmZhbHNlfQ== http_version: - recorded_at: Tue, 07 Nov 2023 19:44:41 GMT + recorded_at: Thu, 11 Jan 2024 12:49:16 GMT - request: method: delete - uri: https://centos8-katello-devel.cannolo.example.com/pulp/api/v3/remotes/deb/apt/018bab50-cec5-7cc0-bdf9-f789de17158f/ + uri: https://centos8-katello-devel-stable.example.com/pulp/api/v3/remotes/deb/apt/12644d79-c993-4513-b085-59713754e9a5/ body: encoding: US-ASCII base64_string: '' @@ -99,7 +97,7 @@ http_interactions: Content-Type: - application/json User-Agent: - - OpenAPI-Generator/3.0.0/ruby + - OpenAPI-Generator/3.0.1/ruby Accept: - application/json Authorization: @@ -112,7 +110,7 @@ http_interactions: message: Accepted headers: Date: - - Tue, 07 Nov 2023 19:44:41 GMT + - Thu, 11 Jan 2024 12:49:16 GMT Server: - gunicorn Content-Type: @@ -129,19 +127,17 @@ http_interactions: - nosniff Referrer-Policy: - same-origin - Cross-Origin-Opener-Policy: - - same-origin Correlation-Id: - - a4d3f7f279e5475e8a3a4b392811872a + - e231eac11033495490897e5f83c55a30 Access-Control-Expose-Headers: - Correlation-ID Via: - - 1.1 centos8-katello-devel.cannolo.example.com + - 1.1 centos8-katello-devel-stable.example.com body: encoding: UTF-8 base64_string: | - eyJ0YXNrIjoiL3B1bHAvYXBpL3YzL3Rhc2tzLzAxOGJhYjUwLWNmMWMtNzQy - MS1iZTZkLTM5MWE0NWE1MGJmZi8ifQ== + eyJ0YXNrIjoiL3B1bHAvYXBpL3YzL3Rhc2tzLzFjZDc4MWY0LTkxODUtNGU2 + YS1hMGFiLWE4YWQ5NzA2YWE4MS8ifQ== http_version: - recorded_at: Tue, 07 Nov 2023 19:44:41 GMT + recorded_at: Thu, 11 Jan 2024 12:49:16 GMT recorded_with: VCR 3.0.3 diff --git a/test/helpers/content_view_helper_test.rb b/test/helpers/content_view_helper_test.rb index 22fb1f09491..98e440c3a4e 100644 --- a/test/helpers/content_view_helper_test.rb +++ b/test/helpers/content_view_helper_test.rb @@ -7,6 +7,8 @@ class ContentViewHelperTest < ActionView::TestCase def setup @primary = SmartProxy.pulp_primary + @deb_repo1 = katello_repositories(:debian_10_amd64) + @deb_repo2 = katello_repositories(:debian_9_amd64) @docker_repo1 = katello_repositories(:busybox) @docker_repo2 = katello_repositories(:busybox2) @yum_repo1 = katello_repositories(:fedora_17_x86_64) @@ -19,20 +21,20 @@ def teardown SETTINGS[:katello][:use_pulp_2_for_content_type] = nil end - test 'separated_repo_mapping must separate Pulp 3 yum repos from others if using multi-copy actions' do - repo_map = { [@docker_repo1] => @docker_repo2, [@yum_repo1] => @yum_repo2, [@file_repo1] => @file_repo2 } + test 'separated_repo_mapping must separate Pulp 3 deb/yum repos from others if using multi-copy actions' do + repo_map = { [@docker_repo1] => @docker_repo2, [@deb_repo1] => @deb_repo2, [@yum_repo1] => @yum_repo2, [@file_repo1] => @file_repo2 } separated_repo_map = separated_repo_mapping(repo_map, true) - assert_equal separated_repo_map, { :pulp3_yum_multicopy => { [@yum_repo1] => @yum_repo2 }, + assert_equal separated_repo_map, { :pulp3_deb_multicopy => { [@deb_repo1] => @deb_repo2 }, :pulp3_yum_multicopy => { [@yum_repo1] => @yum_repo2 }, :other => { [@docker_repo1] => @docker_repo2, [@file_repo1] => @file_repo2 } } end - test 'separated_repo_mapping must not separate Pulp 3 yum repos from others if not using multi-copy actions' do - repo_map = { [@docker_repo1] => @docker_repo2, [@yum_repo1] => @yum_repo2, [@file_repo1] => @file_repo2 } + test 'separated_repo_mapping must not separate Pulp 3 deb/yum repos from others if not using multi-copy actions' do + repo_map = { [@docker_repo1] => @docker_repo2, [@deb_repo1] => @deb_repo2, [@yum_repo1] => @yum_repo2, [@file_repo1] => @file_repo2 } separated_repo_map = separated_repo_mapping(repo_map, false) - assert_equal separated_repo_map, { :pulp3_yum_multicopy => { }, + assert_equal separated_repo_map, { :pulp3_deb_multicopy => { }, :pulp3_yum_multicopy => { }, :other => { [@yum_repo1] => @yum_repo2, [@docker_repo1] => @docker_repo2, - [@file_repo1] => @file_repo2 } } + [@deb_repo1] => @deb_repo2, [@file_repo1] => @file_repo2 } } end end diff --git a/test/services/katello/pulp3/repository/apt/apt_test.rb b/test/services/katello/pulp3/repository/apt/apt_test.rb index ceab31efa56..62ed4f2b72a 100644 --- a/test/services/katello/pulp3/repository/apt/apt_test.rb +++ b/test/services/katello/pulp3/repository/apt/apt_test.rb @@ -12,6 +12,20 @@ def setup @proxy = SmartProxy.pulp_primary end + def test_copy_units_does_not_clear_repo_during_composite_merger + service = Katello::Pulp3::Repository::Apt.new(@repo, @proxy) + service.expects(:remove_all_content).never + service.copy_units([], false) + end + + def test_copy_units_rewrites_missing_content_error + fake_content_href = '/pulp/api/v3/repositories/deb/apt/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/' + service = Katello::Pulp3::Repository::Apt.new(@repo, @proxy) + create_repo(@repo, @proxy) + error = assert_raises(::Katello::Errors::Pulp3Error) { service.copy_units([fake_content_href], false) } + assert_match(/Please run `foreman-rake katello:delete_orphaned_content` to fix the following repository: Debian 9 amd64./, error.message) + end + def test_remote_options @repo.root.url = "http://foo.com/bar/" service = Katello::Pulp3::Repository::Apt.new(@repo, @proxy) diff --git a/test/services/katello/pulp3/repository/apt/copy_units_test.rb b/test/services/katello/pulp3/repository/apt/copy_units_test.rb new file mode 100644 index 00000000000..3f5f604c3a6 --- /dev/null +++ b/test/services/katello/pulp3/repository/apt/copy_units_test.rb @@ -0,0 +1,122 @@ +require 'katello_test_helper' + +module Katello + module Service + class Repository + class AptCopyUnitsTest < ::ActiveSupport::TestCase + include Katello::Pulp3Support + + def setup + @mock_smart_proxy = mock('smart_proxy') + @mock_smart_proxy.stubs(:pulp3_support?).returns(true) + @mock_smart_proxy.stubs(:pulp2_preferred_for_type?).returns(false) + @repo = katello_repositories(:debian_10_amd64) + + @repo_service = @repo.backend_service(@mock_smart_proxy) + end + + def test_copy_api_data_dup_does_deep_copy + data = PulpDebClient::Copy.new + data.config = [ + { source_repo_version: "a source repo", + dest_repo: "a dest repo", + content: ["1", "2", "3"], + dest_base_version: 0 }, + { source_repo_version: "another source repo", + dest_repo: "another dest repo", + content: ["4", "5", "6"], + dest_base_version: 1 } + ] + data.dependency_solving = false + + data_dup = @repo_service.copy_api_data_dup(data) + + refute data.equal?(data_dup) + end + + def test_copy_api_data_dup_clears_content + data = PulpDebClient::Copy.new + data.config = [ + { source_repo_version: "a source repo", + dest_repo: "a dest repo", + content: ["1", "2", "3"], + dest_base_version: 0 }, + { source_repo_version: "another source repo", + dest_repo: "another dest repo", + content: ["4", "5", "6"], + dest_base_version: 1 } + ] + data.dependency_solving = false + + data.config.first[:content] = [] + data.config.second[:content] = [] + + data_dup = @repo_service.copy_api_data_dup(data) + + assert_equal data, data_dup + end + + def test_copy_content_chunked_limits_units_copied + data = PulpDebClient::Copy.new + data.config = [] + + content = [] + 30_001.times { |i| content << i } + + 3.times { data.config << { content: content } } + + mock_api = "test" + Katello::Pulp3::Api::Apt.any_instance.expects(:copy_api).returns(mock_api).times(12) + mock_api.stubs(:copy_content).returns("copied") + + @repo_service.copy_content_chunked(data) + end + + def test_copy_content_chunked_copies_correct_units + data = PulpDebClient::Copy.new + data.config = [] + + mock_api = "test" + Katello::Pulp3::Api::Apt.any_instance.expects(:copy_api).returns(mock_api).times(4) + + 3.times do + data.config << { + source_repo_version: "repo version", + dest_repo: "dest repo", + content: [] + } + end + data.config[0][:content] = (0..9_999).to_a + data.config[1][:content] = (10_000..19_999).to_a + data.config[2][:content] = (20_000..30_000).to_a + + mock_api.expects(:copy_content).returns("task").once.with do |value| + value.config == [{source_repo_version: "repo version", dest_repo: "dest repo", content: (0..9_999).to_a}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: []}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: []}] + end + + mock_api.expects(:copy_content).returns("task").once.with do |value| + value.config == [{source_repo_version: "repo version", dest_repo: "dest repo", content: []}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: (10_000..19_999).to_a}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: []}] + end + + mock_api.expects(:copy_content).returns("task").once.with do |value| + value.config == [{source_repo_version: "repo version", dest_repo: "dest repo", content: []}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: []}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: (20_001..30_000).to_a}] + end + + mock_api.expects(:copy_content).returns("task").once.with do |value| + value.config == [{source_repo_version: "repo version", dest_repo: "dest repo", content: []}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: []}, + {source_repo_version: "repo version", dest_repo: "dest repo", content: [20_000]}] + end + + @repo_service.copy_content_chunked(data) + end + end + end + end +end