Skip to content

Commit

Permalink
Merge pull request #18691 from djberg96/fix_disable_queue_args
Browse files Browse the repository at this point in the history
[V2V] Provide placeholder params for the ConversionHost#disable method
  • Loading branch information
agrare authored Apr 26, 2019
2 parents afe8714 + 6941105 commit 32fa034
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/conversion_host/configurations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def disable_queue(auth_user = nil)
self.class.queue_configuration('disable', id, resource, {}, auth_user)
end

def disable
def disable(_params = nil, _auth_user = nil)
resource_info = "type=#{resource.class.name} id=#{resource.id}"
_log.debug("Disabling a conversion_host #{resource_info}")

Expand Down
19 changes: 19 additions & 0 deletions spec/models/conversion_host/configurations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@
context "#disable_queue" do
let(:op) { 'disable' }

let(:expected_notify) do
{
:type => :conversion_host_config_success,
:options => {
:op_name => "disable",
:op_arg => "type=#{vm.class.name} id=#{vm.id}"
}
}
end

it "to queue with a task" do
task_id = conversion_host.disable_queue
expect(MiqTask.find(task_id)).to have_attributes(:name => expected_task_action)
Expand All @@ -156,6 +166,15 @@
:zone => conversion_host.resource.ext_management_system.my_zone
)
end

it "calls the disable method if delivered" do
allow(conversion_host).to receive(:disable_conversion_host_role)
allow(ConversionHost).to receive(:find).with(conversion_host.id).and_return(conversion_host)

expect(Notification).to receive(:create).with(expected_notify)
conversion_host.disable_queue
expect(MiqQueue.first.deliver).to include("ok")
end
end
end
end

0 comments on commit 32fa034

Please sign in to comment.