-
Notifications
You must be signed in to change notification settings - Fork 897
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
Fix Exception due to missing #merged_uri parameters in FileDepot parent class #18131
Conversation
The #merged_uri method in FileDepot was added by a previous PR but it was missing its parameters, causing an exception when a derived class other than FileDepotSwift is invoked. Fix the parent FileDepot class, and add tests in two derived classes - FileDepotNfs (which previously had no tests) and FileDepotFtp. It is already tested in FileDepotSwift. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1643106
3d6d220
to
5bca881
Compare
app/models/file_depot.rb
Outdated
@@ -33,7 +33,7 @@ def upload_file(file) | |||
@file = file | |||
end | |||
|
|||
def merged_uri | |||
def merged_uri(uri, _api_port) |
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.
Doesn't this change the behavior? Before it was returning the attribute, now it's returning the parameter. Is that what we want?
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.
It should be the same, but I realize there may be cases where its not - so we can ignore the parameter (via _uri
). Changing and pushing it back out. Thanks @carbonin
We really want to return the attribute, so ignore the same-named parameter as previously intended.
@jerryk55 can you create another spec that shows that the passed in uri is not used? So I guess pass both parameters as nil or something? |
Instead of simply passing the same uri as returned from the attribute of the File Depot, add tests passing in nil uri parameters which will show that the uri returned is the attribute. Also add another test that passes in a different uri than is set on the attribute.
@carbonin ok I changed the tests that had been there, passing in nil uri parameters that are ignored, which return the uri attribute set on the FileDepots. Also added another test that passes in a Swift URI to the NFS file depot, showing that the attribute set on the depot is the one passed back and not the parameter. |
Checked commits jerryk55/manageiq@5bca881~...a99f71f with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Fix Exception due to missing #merged_uri parameters in FileDepot parent class (cherry picked from commit 2357413) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1643106
Hammer backport details:
|
The #merged_uri method in FileDepot was added by a previous PR but it was
missing its parameters, causing an exception when a derived class other than FileDepotSwift
is invoked.
Fix the parent FileDepot class, and add tests in two derived classes -
FileDepotNfs (which previously had no tests) and FileDepotFtp.
It is already tested in FileDepotSwift.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1643106
@yrudman @roliveri please review. @carbonin FYI.
Links [Optional]
Steps for Testing/QA
Schedule a DB backup on an NFS File Depot. It should not cause an exception.