-
Notifications
You must be signed in to change notification settings - Fork 358
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
Rails7 test fixes #9231
Rails7 test fixes #9231
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ | |
|
||
let(:custom_attr1) do | ||
FactoryBot.create( | ||
:custom_attribute, | ||
:ems_custom_attribute, | ||
:resource => vm_vmware, | ||
:name => 'Proč by si jeden nepokrad', | ||
:value => 'jó, v tom je Pepa demokrat' | ||
|
@@ -65,7 +65,7 @@ | |
|
||
let(:custom_attr2) do | ||
FactoryBot.create( | ||
:custom_attribute, | ||
:ems_custom_attribute, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the great sleuthing @kbrock. I changed this to use the ems custom attribute factory which sets source to VC. |
||
:resource => vm_vmware, | ||
:name => nil, | ||
:value => 'a šikulovi má být dána šance' | ||
|
@@ -75,7 +75,7 @@ | |
# http://localhost:3000/vm_infra/show/10000000000449 | ||
it 'can display VM details for vm with ems_custom_attributes and a null attribute name' do | ||
vm_vmware.ems_custom_attributes.push(custom_attr1, custom_attr2) | ||
expect(controller).to receive(:identify_record).and_return(vm_vmware) | ||
expect(controller).to receive(:identify_record).twice.and_return(vm_vmware) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed. I saw the same thing |
||
|
||
get :show, :params => { :id => vm_vmware.id } | ||
expect(response).to redirect_to(:action => 'explorer') | ||
|
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.
This value is from:
@report_data_additional_options[:model]
via -- ApplicationHelper#model_to_report_data
Locally, this passed in
x_active_tree = :instance_tree
and got the correctmodel
back in vm_common.rbSo this was passing for me.
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.
With rails 7 or 6.1?
FYI, ui-classic was failing with cross repo + rails 7 without this change.
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.
ok, so this calls
post
2 times:explorer
andx_button
.In the
explorer
call, thedb
/model
isManageIQ::Providers::CloudManager::Vm
In the
x_button
thedb
/model
isVmOrTemplate
.The
explorer
call sets the@report_data_additional_options.model
to the current model, which isManageIQ::Providers::CloudManager::Vm
.The
x_button
call will reuse the@report_data_additional_options.model
value if it is present.In 6.1, the
x_button
has the instance variable set, so themodel
isManageIQ::Providers::CloudManager::Vm
In 7.0,
actionpack-7.0.8.4/lib/action_controller/metal/testing.rb
has a method
clear_instance_variables_between_requests
. So@report_data_additional_options
is not set and it sets themodel
to the current model, which isVmOrTemplate
.Conclusions
model
should be the same for both calls. If this is a bug, it was probably always present in the test but did not rear it's headThere 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.
I agree, this "could" have some impact on our existing UI code. I see get_view and get_db_view processing the show list options if this is not set. If we relied on subsequent requests to have these values persisted over requests, we will likely set rebuilding the options with possibly new/different values on subsequent requests. cc @GilbertCherrie @Fryguy. Great find @kbrock. I've been stumped looking at this one the past few several days off and on.
manageiq-ui-classic/app/controllers/application_controller.rb
Line 1296 in 43566cf
manageiq-ui-classic/app/controllers/application_controller.rb
Line 1099 in 43566cf
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.
Going forward, I think, this code is the right code but we'll have to merge this with the rails 7 branch as this will not pass on 6.1
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.
Note, I'll summarize Keenan's findings and put it in the commit message as I will forget about the details in a few days or even hours.
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.
@jrafanie Did you update the commit message? Just waiting for this before merge.