-
Notifications
You must be signed in to change notification settings - Fork 898
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
Currently on a successful ActionResult (start / stop) we return nil #18036
Conversation
@@ -231,24 +231,24 @@ def expect_api_call(expected_action, expected_args = nil) | |||
it "calls the given action with the given args" do | |||
args = {:my => "args", :here => 123} | |||
expect(api_collection).to receive(action).with(args).and_return(api_success_result) | |||
described_class.exec_api_call(region, collection_name, action, args) | |||
expect(described_class.exec_api_call(region, collection_name, action, args)).to be(api_success_result) |
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.
Should this be .to eq
? I'm not sure what this syntax actually does.
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.
¯\_(ツ)_/¯ since it's stubbed, it will be the same object id.
@@ -77,6 +77,7 @@ def self.exec_api_call(region, collection_name, action, api_args = nil, id = nil | |||
case result | |||
when ManageIQ::API::Client::ActionResult | |||
raise InterRegionApiMethodRelayError, result.message if result.failed? | |||
result |
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.
Is there something better in the action result that we can return? Or maybe just true
would be better to indicate a successful API call?
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.
I'm thinking it should be the JSON response from the remote region API. What do you think?
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.
What does that actually look like in this case? Could you post an example?
I agree that it's better than the result object itself.
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.
Okay, updated the PR accordingly and the output is:
irb(main):003:0> r = vm.stop({})
=> #<ManageIQ::API::Client::ActionResult:0x0000000009d66010 @attributes={"success"=>true, "message"=>"VM id:1 name:'something' stopping", "task_id"=>"4", "task_href"=>"https://x.x.x.x/api/tasks/4", "href"=>"https://x.x.x.x/api/vms/1"}>
irb(main):004:0> r.attributes
=> {"success"=>true, "message"=>"VM id:1 name:'something' stopping", "task_id"=>"4", "task_href"=>"https://x.x.x.x/api/tasks/4", "href"=>"https://x.x.x.x/api/vms/1"}
Returning the result of the api call would at least be a positive result https://bugzilla.redhat.com/show_bug.cgi?id=1628658
4b81358
to
d5c75ad
Compare
Checked commit bdunne@d5c75ad with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Currently on a successful ActionResult (start / stop) we return nil (cherry picked from commit 2fb6260) https://bugzilla.redhat.com/show_bug.cgi?id=1628658
Hammer backport details:
|
Currently on a successful ActionResult (start / stop) we return nil (cherry picked from commit 2fb6260) https://bugzilla.redhat.com/show_bug.cgi?id=1635764
Gaprindashvili backport details:
|
Returning the result of the api call would at least be a positive result
https://bugzilla.redhat.com/show_bug.cgi?id=1628658