-
Notifications
You must be signed in to change notification settings - Fork 901
test preload passing an array #23402
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
Conversation
spec/lib/miq_preloader_spec.rb
Outdated
host = FactoryBot.create(:host_vmware) # infra | ||
FactoryBot.create_list(:vm, 2, :ext_management_system => FactoryBot.create(:ems_infra), :host => host) | ||
emses = ExtManagementSystem.all | ||
expect { preload(emses, [:vms, :host]) }.to make_database_queries(:count => 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hosts? plural?
1) MiqPreloader.preload preloads association array
Failure/Error: ActiveRecord::Associations::Preloader.new(:records => Array(records), :associations => associations, :scope => preload_scope).call
ActiveRecord::AssociationNotFoundError:
Association named 'host' was not found on ManageIQ::Providers::Vmware::InfraManager; perhaps you misspelled it?
# ./lib/miq_preloader.rb:25:in `preload'
# ./spec/lib/miq_preloader_spec.rb:115:in `preload'
# ./spec/lib/miq_preloader_spec.rb:108:in `block (4 levels) in <top (required)>'
# ./spec/lib/miq_preloader_spec.rb:108:in `block (3 levels) in <top (required)>'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh. thnx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See test failure above
6c1571b
to
fd8a72f
Compare
ok, so this is failing on trying to preload the host in the ems. To me it looks like it is flattening the preload hash into just an array. My concern: manageiq $ ag 'preload\([^)]*=>'
app/models/storage.rb
692: MiqPreloader.preload(self, :vms => :storage_files_files)
app/models/manageiq/providers/cloud_manager/metrics_capture.rb
6: MiqPreloader.preload([ems], :vms => [{:availability_zone => :tags}, :ext_management_system])
app/models/manageiq/providers/container_manager/metrics_capture.rb
5: MiqPreloader.preload([ems], :container_images => :tags, :container_nodes => :tags, :container_groups => [:tags, {:containers => :tags}]) |
fd8a72f
to
490d781
Compare
490d781
to
65dc5f8
Compare
@jrafanie update:
update:
This should be good to go |
sorry, what was the resolution of this @kbrock ? |
@jrafanie all set. it successfully handles hash and array - it was a bad test/misunderstood failure. This is validating our expectations successfully |
No description provided.