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

[rails6][service_template_ansible_playbook_spec.rb] Fix ems/provider lets #20787

Merged

Commits on Nov 10, 2020

  1. [rails6][service_template_ansible_playbook_spec.rb] Fix ems/provider …

    …lets
    
    This fix takes a page from a PR from David:
    
    ManageIQ#20031
    
    Which was that instead of trying to assign the provider prior to making
    the EMS in the factories, default a provider object type as part of the
    `ext_management_system` child definition, and reference it in the
    `let(:provider)`.
    
    This is not a problem in Rails 5.2, but does lead to the following error
    in Rails 6.0
    
      5) ServiceTemplateAnsiblePlaybook.create_catalog_item creates and returns a catalog item
    
         Failure/Error: factory_exists?(factory) ? super : class_from_symbol(factory).create!(*args)
    
         ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection:
    
           Cannot modify association 'ManageIQ::Providers::EmbeddedAnsible::Provider#endpoints' because the source reflection class 'Endpoint' is associated to 'ExtManagementSystem' via :has_many.
    
         # ./spec/support/missing_factory_helper.rb:10:in `create'
         # ./spec/models/service_template_ansible_playbook_spec.rb:11:in `block (2 levels) in <top (required)>'
         # ./spec/models/service_template_ansible_playbook_spec.rb:7:in `block (2 levels) in <top (required)>'
         # ./spec/models/service_template_ansible_playbook_spec.rb:15:in `block (2 levels) in <top (required)>'
         # ./spec/models/service_template_ansible_playbook_spec.rb:40:in `block (2 levels) in <top (required)>'
         # ./spec/models/service_template_ansible_playbook_spec.rb:47:in `block (2 levels) in <top (required)>'
         # ./spec/models/service_template_ansible_playbook_spec.rb:82:in `block (3 levels) in <top (required)>'
    
    Most likely do to a fix that I was unable to track down, but the
    following `git log command` is most likely to contain some of the
    commits with the fix:
    
      $ git log --oneline -E --grep "has.*many.*through" 5-2-stable..6-0-stable
    NickLaMuro committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    79c2826 View commit details
    Browse the repository at this point in the history