From a7bc48dd24ae0a9b043ae2df82c715c8c05312e1 Mon Sep 17 00:00:00 2001 From: Oleh Fedorenko Date: Wed, 15 May 2024 14:24:19 +0000 Subject: [PATCH] Fixes #37471 - Support Zeitwerk loader --- app/helpers/katello/katello_url_helper.rb | 2 +- .../trigger_update_repo_cert_guard.rb | 2 +- .../update_cv_repository_cert_guard.rb | 2 +- .../constraints/activation_key_constraint.rb | 7 --- ...register_with_activation_key_constraint.rb | 11 +++++ app/lib/katello/resources/registry.rb | 2 - .../{api => routing}/mapper_extensions.rb | 0 app/lib/katello/util/cvecf_migrator.rb | 2 +- app/lib/katello/util/url_matcher.rb | 6 +-- .../katello_url_format_validator.rb | 4 +- app/models/katello/cdn_configuration.rb | 2 +- .../concerns/smart_proxy_extensions.rb | 1 - .../delete_latest_content_view_version.rb | 2 +- app/models/katello/host/info_provider.rb | 2 - app/models/katello/root_repository.rb | 2 +- .../delete_latest_version_failure.rb | 2 +- config/initializers/inflections.rb | 8 ++++ config/routes/api/registry.rb | 2 - config/routes/api/rhsm.rb | 5 +- config/routes/api/v2.rb | 3 -- .../20140716211853_repo_rename_feed_to_url.rb | 2 +- ...ker_container_registry_url_to_providers.rb | 2 +- ...150224083608_remove_docker_registry_url.rb | 2 +- ...add_auth_url_token_to_root_repositories.rb | 2 +- ..._content_view_environment_content_facet.rb | 2 +- lib/katello/engine.rb | 22 +++++---- lib/katello/plugin.rb | 3 +- spec/helpers/katello_url_helper_spec.rb | 2 +- spec/lib/url_matcher_spec.rb | 12 ++--- test/models/association_test.rb | 48 +++++++++++++++++++ .../katello/alternate_content_source_test.rb | 4 +- 31 files changed, 108 insertions(+), 60 deletions(-) delete mode 100644 app/lib/katello/api/constraints/activation_key_constraint.rb create mode 100644 app/lib/katello/api/constraints/register_with_activation_key_constraint.rb rename app/lib/katello/{api => routing}/mapper_extensions.rb (100%) diff --git a/app/helpers/katello/katello_url_helper.rb b/app/helpers/katello/katello_url_helper.rb index e8ebc182909..957020559df 100644 --- a/app/helpers/katello/katello_url_helper.rb +++ b/app/helpers/katello/katello_url_helper.rb @@ -1,5 +1,5 @@ module Katello - module KatelloUrlHelper + module KatelloURLHelper unless defined? CONSTANTS_DEFINED FILEPREFIX = ['file'].freeze PROTOCOLS = ['http', 'https', 'ftp', 'uln'].freeze diff --git a/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb b/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb index 56f8d3c3132..798d2962d23 100644 --- a/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +++ b/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb @@ -9,7 +9,7 @@ def plan(repository, smart_proxy) def run repository = ::Katello::Repository.find(input[:repository_id]) - ForemanTasks.async_task(::Actions::Pulp3::Repository::UpdateCVRepositoryCertGuard, repository, smart_proxy) + ForemanTasks.async_task(::Actions::Pulp3::Repository::UpdateCvRepositoryCertGuard, repository, smart_proxy) end def humanized_name diff --git a/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb b/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb index a517517482c..3b258b5739e 100644 --- a/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +++ b/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb @@ -1,7 +1,7 @@ module Actions module Pulp3 module Repository - class UpdateCVRepositoryCertGuard < Pulp3::Abstract + class UpdateCvRepositoryCertGuard < Pulp3::Abstract def plan(repository, smart_proxy) root = repository.root cv_repositories = root.repositories - [root.library_instance] diff --git a/app/lib/katello/api/constraints/activation_key_constraint.rb b/app/lib/katello/api/constraints/activation_key_constraint.rb deleted file mode 100644 index e505b0e6783..00000000000 --- a/app/lib/katello/api/constraints/activation_key_constraint.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Katello - class RegisterWithActivationKeyConstraint - def matches?(request) - request.params[:activation_keys] - end - end -end diff --git a/app/lib/katello/api/constraints/register_with_activation_key_constraint.rb b/app/lib/katello/api/constraints/register_with_activation_key_constraint.rb new file mode 100644 index 00000000000..f9f9668fbe9 --- /dev/null +++ b/app/lib/katello/api/constraints/register_with_activation_key_constraint.rb @@ -0,0 +1,11 @@ +module Katello + module Api + module Constraints + class RegisterWithActivationKeyConstraint + def matches?(request) + request.params[:activation_keys] + end + end + end + end +end diff --git a/app/lib/katello/resources/registry.rb b/app/lib/katello/resources/registry.rb index ec85ba805c9..92cc0a3289f 100644 --- a/app/lib/katello/resources/registry.rb +++ b/app/lib/katello/resources/registry.rb @@ -1,5 +1,3 @@ -require 'katello/util/data' - module Katello module Resources require 'rest_client' diff --git a/app/lib/katello/api/mapper_extensions.rb b/app/lib/katello/routing/mapper_extensions.rb similarity index 100% rename from app/lib/katello/api/mapper_extensions.rb rename to app/lib/katello/routing/mapper_extensions.rb diff --git a/app/lib/katello/util/cvecf_migrator.rb b/app/lib/katello/util/cvecf_migrator.rb index 917e60918a3..cd607e0904f 100644 --- a/app/lib/katello/util/cvecf_migrator.rb +++ b/app/lib/katello/util/cvecf_migrator.rb @@ -1,6 +1,6 @@ module Katello module Util - class CVECFMigrator # used in db/migrate/20220929204746_add_content_view_environment_content_facet.rb + class CvecfMigrator # used in db/migrate/20220929204746_add_content_view_environment_content_facet.rb def execute! hosts_with_no_cve = [] hosts_with_missing_cve = [] diff --git a/app/lib/katello/util/url_matcher.rb b/app/lib/katello/util/url_matcher.rb index df58cb62d38..ffaf70df283 100644 --- a/app/lib/katello/util/url_matcher.rb +++ b/app/lib/katello/util/url_matcher.rb @@ -13,15 +13,15 @@ # # ===== Examples # -# UrlMatcher.match('/foo', ['/', '/foo', '/bar/baz']) #=> ['/foo'] -# UrlMatcher.match('/80/07/01', ['/:year/:month/:day']) #=> ['/80/07/01', '80', '07', '01'] +# URLMatcher.match('/foo', ['/', '/foo', '/bar/baz']) #=> ['/foo'] +# URLMatcher.match('/80/07/01', ['/:year/:month/:day']) #=> ['/80/07/01', '80', '07', '01'] # require 'pathname' module Katello module Util - module UrlMatcher + module URLMatcher def self.match(path, routes) path = Path.new(path) patterns = routes.map { |route| Pattern.new(Array(route).first) } diff --git a/app/lib/katello/validators/katello_url_format_validator.rb b/app/lib/katello/validators/katello_url_format_validator.rb index 8ad4f1cdee2..ac853c1345f 100644 --- a/app/lib/katello/validators/katello_url_format_validator.rb +++ b/app/lib/katello/validators/katello_url_format_validator.rb @@ -1,7 +1,7 @@ module Katello module Validators - class KatelloUrlFormatValidator < ActiveModel::EachValidator - include KatelloUrlHelper + class KatelloURLFormatValidator < ActiveModel::EachValidator + include KatelloURLHelper def validate_each(record, attribute, value) if options[:nil_allowed] diff --git a/app/models/katello/cdn_configuration.rb b/app/models/katello/cdn_configuration.rb index c4d33364343..3b80519ebf5 100644 --- a/app/models/katello/cdn_configuration.rb +++ b/app/models/katello/cdn_configuration.rb @@ -19,7 +19,7 @@ class CdnConfiguration < Katello::Model validates :upstream_organization_label, presence: true, if: :network_sync? validates :url, presence: true, unless: :export_sync? - validates_with Validators::KatelloUrlFormatValidator, attributes: :url, unless: :export_sync? + validates_with Validators::KatelloURLFormatValidator, attributes: :url, unless: :export_sync? validates_with Validators::KatelloLabelFormatValidator, attributes: :upstream_organization_label, if: proc { upstream_organization_label.present? } validate :non_redhat_configuration, if: :network_sync? diff --git a/app/models/katello/concerns/smart_proxy_extensions.rb b/app/models/katello/concerns/smart_proxy_extensions.rb index e800aa9c99d..f16f2f3c259 100644 --- a/app/models/katello/concerns/smart_proxy_extensions.rb +++ b/app/models/katello/concerns/smart_proxy_extensions.rb @@ -1,4 +1,3 @@ -require 'proxy_api' require 'proxy_api/pulp' require 'proxy_api/pulp_node' require 'proxy_api/container_gateway' diff --git a/app/models/katello/events/delete_latest_content_view_version.rb b/app/models/katello/events/delete_latest_content_view_version.rb index fc70cd6993a..76869137201 100644 --- a/app/models/katello/events/delete_latest_content_view_version.rb +++ b/app/models/katello/events/delete_latest_content_view_version.rb @@ -33,7 +33,7 @@ def run private def deliver_failure_notification - ::Katello::UINotifications::ContentView::DelelteLatestVersionFailure.deliver!(content_view) + ::Katello::UINotifications::ContentView::DeleteLatestVersionFailure.deliver!(content_view) end end end diff --git a/app/models/katello/host/info_provider.rb b/app/models/katello/host/info_provider.rb index 7523efaa4bf..c359713883c 100644 --- a/app/models/katello/host/info_provider.rb +++ b/app/models/katello/host/info_provider.rb @@ -1,5 +1,3 @@ -require 'host_info' - module Katello module Host class InfoProvider < ::HostInfo::Provider diff --git a/app/models/katello/root_repository.rb b/app/models/katello/root_repository.rb index ae96e73e224..968a43820ed 100644 --- a/app/models/katello/root_repository.rb +++ b/app/models/katello/root_repository.rb @@ -67,7 +67,7 @@ class RootRepository < Katello::Model validates_lengths_from_database :except => [:label] validates_with Validators::KatelloLabelFormatValidator, :attributes => :label validates_with Validators::KatelloNameFormatValidator, :attributes => :name - validates_with Validators::KatelloUrlFormatValidator, :attributes => :url, + validates_with Validators::KatelloURLFormatValidator, :attributes => :url, :nil_allowed => proc { |repo| repo.custom? || repo.organization.cdn_configuration.export_sync? }, :field_name => :url validates_with Validators::RootRepositoryUniqueAttributeValidator, :attributes => :name diff --git a/app/services/katello/ui_notifications/content_view/delete_latest_version_failure.rb b/app/services/katello/ui_notifications/content_view/delete_latest_version_failure.rb index d7cb27343fc..4bf6a90d3b4 100644 --- a/app/services/katello/ui_notifications/content_view/delete_latest_version_failure.rb +++ b/app/services/katello/ui_notifications/content_view/delete_latest_version_failure.rb @@ -1,7 +1,7 @@ module Katello module UINotifications module ContentView - class DelelteLatestVersionFailure < ::UINotifications::Base + class DeleteLatestVersionFailure < ::UINotifications::Base private def create diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index fd1638eecb2..9ef81ef8057 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,4 +1,10 @@ # Be sure to restart your server when you modify this file. +Rails.autoloaders.each do |autoloader| + autoloader.inflector.inflect( + 'kt_environment' => 'KTEnvironment', + 'cdn' => 'CDN' + ) +end # Add new inflection rules using the following format # (all these examples are active by default): @@ -9,4 +15,6 @@ # inflect.uncountable %w(fish sheep) inflect.singular 'bases', 'base' + + inflect.acronym 'SCA' # Simple Content Access end diff --git a/config/routes/api/registry.rb b/config/routes/api/registry.rb index b68a7c09f16..e4a365ed80a 100644 --- a/config/routes/api/registry.rb +++ b/config/routes/api/registry.rb @@ -1,5 +1,3 @@ -require 'katello/api/mapper_extensions' - class ActionDispatch::Routing::Mapper include Katello::Routing::MapperExtensions end diff --git a/config/routes/api/rhsm.rb b/config/routes/api/rhsm.rb index 02928e701f0..6cf01c4774d 100644 --- a/config/routes/api/rhsm.rb +++ b/config/routes/api/rhsm.rb @@ -1,6 +1,3 @@ -require 'katello/api/constraints/activation_key_constraint' -require 'katello/api/mapper_extensions' - class ActionDispatch::Routing::Mapper include Katello::Routing::MapperExtensions end @@ -11,7 +8,7 @@ class ActionDispatch::Routing::Mapper scope :path => :rhsm, :module => :rhsm, :as => :rhsm do # subscription-manager support - scope :constraints => Katello::RegisterWithActivationKeyConstraint.new do + scope :constraints => Katello::Api::Constraints::RegisterWithActivationKeyConstraint.new do match '/consumers' => 'candlepin_proxies#consumer_activate', :via => :post end match '/consumers' => 'candlepin_proxies#consumer_create', :via => :post diff --git a/config/routes/api/v2.rb b/config/routes/api/v2.rb index 588ea74c5ba..c256f0fff67 100644 --- a/config/routes/api/v2.rb +++ b/config/routes/api/v2.rb @@ -1,6 +1,3 @@ -require 'katello/api/constraints/activation_key_constraint' -require 'katello/api/mapper_extensions' - class ActionDispatch::Routing::Mapper include Katello::Routing::MapperExtensions end diff --git a/db/migrate/20140716211853_repo_rename_feed_to_url.rb b/db/migrate/20140716211853_repo_rename_feed_to_url.rb index 89808b5bdb7..34b01f1b543 100644 --- a/db/migrate/20140716211853_repo_rename_feed_to_url.rb +++ b/db/migrate/20140716211853_repo_rename_feed_to_url.rb @@ -1,4 +1,4 @@ -class RepoRenameFeedToUrl < ActiveRecord::Migration[4.2] +class RepoRenameFeedToURL < ActiveRecord::Migration[4.2] def up rename_column :katello_repositories, :feed, :url end diff --git a/db/migrate/20141003210742_add_docker_container_registry_url_to_providers.rb b/db/migrate/20141003210742_add_docker_container_registry_url_to_providers.rb index f73f1f07a9b..0979553f7d8 100644 --- a/db/migrate/20141003210742_add_docker_container_registry_url_to_providers.rb +++ b/db/migrate/20141003210742_add_docker_container_registry_url_to_providers.rb @@ -1,4 +1,4 @@ -class AddDockerContainerRegistryUrlToProviders < ActiveRecord::Migration[4.2] +class AddDockerContainerRegistryURLToProviders < ActiveRecord::Migration[4.2] def up add_column :katello_providers, :docker_registry_url, :string, :limit => 255 end diff --git a/db/migrate/20150224083608_remove_docker_registry_url.rb b/db/migrate/20150224083608_remove_docker_registry_url.rb index fc9143a7e14..2b61e60fdf7 100644 --- a/db/migrate/20150224083608_remove_docker_registry_url.rb +++ b/db/migrate/20150224083608_remove_docker_registry_url.rb @@ -1,4 +1,4 @@ -class RemoveDockerRegistryUrl < ActiveRecord::Migration[4.2] +class RemoveDockerRegistryURL < ActiveRecord::Migration[4.2] def up remove_column :katello_providers, :docker_registry_url end diff --git a/db/migrate/20210322142311_add_auth_url_token_to_root_repositories.rb b/db/migrate/20210322142311_add_auth_url_token_to_root_repositories.rb index 8ac4d98b784..65ac5d7c3b0 100644 --- a/db/migrate/20210322142311_add_auth_url_token_to_root_repositories.rb +++ b/db/migrate/20210322142311_add_auth_url_token_to_root_repositories.rb @@ -1,4 +1,4 @@ -class AddAuthUrlTokenToRootRepositories < ActiveRecord::Migration[6.0] +class AddAuthURLTokenToRootRepositories < ActiveRecord::Migration[6.0] def change add_column :katello_root_repositories, :ansible_collection_auth_url, :text add_column :katello_root_repositories, :ansible_collection_auth_token, :text diff --git a/db/migrate/20220929204746_add_content_view_environment_content_facet.rb b/db/migrate/20220929204746_add_content_view_environment_content_facet.rb index 5eb74dcdf73..969efc6c52e 100644 --- a/db/migrate/20220929204746_add_content_view_environment_content_facet.rb +++ b/db/migrate/20220929204746_add_content_view_environment_content_facet.rb @@ -8,7 +8,7 @@ def up t.references :content_view_environment, :null => false, :index => false, :foreign_key => { :to_table => 'katello_content_view_environments' } t.references :content_facet, :null => false, :index => false, :foreign_key => { :to_table => 'katello_content_facets' } end - ::Katello::Util::CVECFMigrator.new.execute! + ::Katello::Util::CvecfMigrator.new.execute! FakeContentFacet.all.each do |content_facet| cve_id = ::Katello::KTEnvironment.find(content_facet.lifecycle_environment_id) .content_view_environments diff --git a/lib/katello/engine.rb b/lib/katello/engine.rb index 3f3c20f3f21..ee6014140f1 100644 --- a/lib/katello/engine.rb +++ b/lib/katello/engine.rb @@ -79,12 +79,14 @@ class Engine < ::Rails::Engine # make sure the Katello plugin is initialized before `after_initialize` # hook so that the resumed Dynflow tasks can rely on everything ready. - initializer 'katello.register_plugin', :before => :finisher_hook, :after => 'foreman_remote_execution.register_plugin' do - ::Foreman::AccessControl::Permission.prepend ::Katello::Concerns::PermissionExtensions - require 'katello/plugin' + initializer 'katello.register_plugin', :before => :finisher_hook, :after => 'foreman_remote_execution.register_plugin' do |app| + app.reloader.to_prepare do + ::Foreman::AccessControl::Permission.prepend ::Katello::Concerns::PermissionExtensions + require 'katello/plugin' - # extend builtin permissions from core with new actions - require 'katello/permissions' + # extend builtin permissions from core with new actions + require 'katello/permissions' + end end initializer "katello.set_dynflow_middlewares", :before => :finisher_hook do |_app| @@ -185,11 +187,11 @@ class Engine < ::Rails::Engine # We need to explicitly load this files because Foreman has # similar strucuture and if the Foreman files are loaded first, # autoloading doesn't work. - require_dependency "#{Katello::Engine.root}/app/lib/katello/api/v2/rendering" - require_dependency "#{Katello::Engine.root}/app/controllers/katello/api/api_controller" - require_dependency "#{Katello::Engine.root}/app/controllers/katello/api/v2/api_controller" - require_dependency "#{Katello::Engine.root}/app/services/katello/proxy_status/pulp" - require_dependency "#{Katello::Engine.root}/app/services/katello/proxy_status/pulp_node" + # require_dependency "#{Katello::Engine.root}/app/lib/katello/api/v2/rendering" + # require_dependency "#{Katello::Engine.root}/app/controllers/katello/api/api_controller" + # require_dependency "#{Katello::Engine.root}/app/controllers/katello/api/v2/api_controller" + # require_dependency "#{Katello::Engine.root}/app/services/katello/proxy_status/pulp" + # require_dependency "#{Katello::Engine.root}/app/services/katello/proxy_status/pulp_node" #Api controller extensions ::Api::V2::HostsController.include Katello::Concerns::Api::V2::HostsControllerExtensions diff --git a/lib/katello/plugin.rb b/lib/katello/plugin.rb index 509715d22bf..dfe5377c0a4 100644 --- a/lib/katello/plugin.rb +++ b/lib/katello/plugin.rb @@ -1,10 +1,9 @@ require 'katello/permission_creator' require 'katello/repository_types' -require 'katello/host_status_manager' # rubocop:disable Metrics/BlockLength Foreman::Plugin.register :katello do - requires_foreman '>= 3.11' + requires_foreman '>= 3.13' register_gettext sub_menu :top_menu, :content_menu, :caption => N_('Content'), diff --git a/spec/helpers/katello_url_helper_spec.rb b/spec/helpers/katello_url_helper_spec.rb index 52a2dd89f49..957c4702505 100644 --- a/spec/helpers/katello_url_helper_spec.rb +++ b/spec/helpers/katello_url_helper_spec.rb @@ -1,7 +1,7 @@ require 'katello_test_helper' module Katello - describe KatelloUrlHelper do + describe KatelloURLHelper do describe "Valid https? Urls" do it "should validate clean http urls" do assert kurl_valid?('http://www.hugheshoney.com') diff --git a/spec/lib/url_matcher_spec.rb b/spec/lib/url_matcher_spec.rb index 1ebaf38d640..5401c7a1461 100644 --- a/spec/lib/url_matcher_spec.rb +++ b/spec/lib/url_matcher_spec.rb @@ -2,27 +2,27 @@ require 'katello/util/url_matcher' module Katello - describe Util::UrlMatcher do + describe Util::URLMatcher do it "should accept empty string and array" do - m = Util::UrlMatcher.match('', []) + m = Util::URLMatcher.match('', []) value(m[0]).must_be_nil value(m.size).must_equal(1) end it "should not match different paths" do - m = Util::UrlMatcher.match('/asdf', ['/abcd']) + m = Util::URLMatcher.match('/asdf', ['/abcd']) value(m[0]).must_be_nil value(m.size).must_equal(1) end it "should accept /" do - m = Util::UrlMatcher.match('/', ['/']) + m = Util::URLMatcher.match('/', ['/']) value(m[0]).must_match('/') value(m.size).must_equal(1) end it "should accept /x/y/z" do - m = Util::UrlMatcher.match('/80/01/15', ['/:year/:month/:day']) + m = Util::URLMatcher.match('/80/01/15', ['/:year/:month/:day']) value(m[0]).must_match('/:year/:month/:day') value(m[1]).must_match('80') value(m[2]).must_match('01') @@ -30,7 +30,7 @@ module Katello end it "should match first always" do - m = Util::UrlMatcher.match('/80/01/15', ['/:a/:b/:c', '/:year/:month/:day']) + m = Util::URLMatcher.match('/80/01/15', ['/:a/:b/:c', '/:year/:month/:day']) value(m[0]).must_match('/:a/:b/:c') value(m[1]).must_match('80') value(m[2]).must_match('01') diff --git a/test/models/association_test.rb b/test/models/association_test.rb index 0a3b4d8bd44..20bff5b9224 100644 --- a/test/models/association_test.rb +++ b/test/models/association_test.rb @@ -24,10 +24,58 @@ def ignorable_foreign_keys } end + # After we enabled eager loading in tests for Zeitwerk, Katello::Model.subclasses call started to return + # more models than we tested before. We need to ignore some of them to avoid false positives. + # Ideally this list should not exist. TODO: go over these models and ensure that they don't need the tests below + # or fix them. + def self.ignorable_models + [ + "Katello::AlternateContentSourceProduct", + "Katello::CapsuleLifecycleEnvironment", + "Katello::ComplianceReason", + "Katello::ContentFacetApplicableDeb", + "Katello::ContentFacetApplicableRpm", + "Katello::ContentFacetRepository", + "Katello::ContentMigrationProgress", + "Katello::ContentViewDebFilterRule", + "Katello::ContentViewVersionComponent", + "Katello::DockerManifestListManifest", + "Katello::DockerMetaTag", + "Katello::EnvironmentPrior", + "Katello::ErratumBugzilla", + "Katello::Event", + "Katello::HostInstalledDeb", + "Katello::HostInstalledPackage", + "Katello::HostQueueElement", + "Katello::HostTracer", + "Katello::InstalledPackage", + "Katello::InstalledProduct", + "Katello::KeyHostCollection", + "Katello::ModuleStreamErratumPackage", + "Katello::ModuleStreamRpm", + "Katello::PoolActivationKey", + "Katello::Pulp3::ContentGuard", + "Katello::Pulp3::DistributionReference", + "Katello::Pulp3::RepositoryReference", + "Katello::RepositoryContentViewFilter", + "Katello::RepositoryDockerManifestList", + "Katello::RepositoryDockerMetaTag", + "Katello::RepositoryDockerTag", + "Katello::RepositoryFileUnit", + "Katello::RepositoryGenericContentUnit", + "Katello::SmartProxyAlternateContentSource", + "Katello::SmartProxySyncHistory", + "Katello::SubscriptionFacetActivationKey", + "Katello::SubscriptionFacetInstalledProduct", + "Katello::SubscriptionFacetPurposeAddon" + ] + end + Katello::Model.subclasses.each do |model| next unless model.table_name&.starts_with?('katello_') next if model.ancestors.include? Facets::Base next if model.ancestors.include? Facets::HostgroupFacet + next if self.ignorable_models.include?(model.to_s) describe model do model.reflect_on_all_associations(:belongs_to).each do |association| diff --git a/test/models/katello/alternate_content_source_test.rb b/test/models/katello/alternate_content_source_test.rb index e0b89088741..32a5d9c32bc 100644 --- a/test/models/katello/alternate_content_source_test.rb +++ b/test/models/katello/alternate_content_source_test.rb @@ -79,13 +79,13 @@ def test_http_proxy def test_custom_uln_base_url @yum_acs.base_url = 'uln://uln-repo' error = assert_raises(ActiveRecord::RecordInvalid) { @yum_acs.save! } - assert_match 'Validation failed: Base url uln://uln-repo is not a valid path', error.message + assert_match 'Validation failed: Base URL uln://uln-repo is not a valid path', error.message end def test_custom_missing_base_url @yum_acs.base_url = nil error = assert_raises(ActiveRecord::RecordInvalid) { @yum_acs.save! } - assert_match "Base url can\'t be blank", error.message + assert_match "Base URL can\'t be blank", error.message end def test_custom_missing_verify_ssl