Always report running status for task

Sometime we run task so fast, so we get only pending
and succeed/failed status report without running.

Such behavior breaks State Machine flow for tasks history
in Nailgun. With this change we will send running status
for task in the moment of actual run.

Change-Id: I46d86e31b5e35a54d1c33e41ea6fbdbc0d74c66b
Closes-Bug: #1564295
This commit is contained in:
Vladimir Sharshov (warpc) 2016-04-07 18:32:31 +03:00
parent 2915ad5acf
commit 5415b86ac1
2 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,7 @@ module Astute
@task_engine.run
task.set_status_running
set_status_busy
report_node_status
end
def poll

View File

@ -25,6 +25,7 @@ describe Astute::TaskNode do
let(:ctx) do
ctx = mock('context')
ctx.stubs(:task_id)
ctx.stubs(:report)
ctx
end
@ -77,6 +78,19 @@ describe Astute::TaskNode do
expect(task.status).to eql(:running)
end
it 'should report about task as running' do
Astute::Puppet.any_instance.stubs(:run)
ctx.expects(:report).with('nodes' => [{
'uid' => 'node_id',
'status' => 'deploying',
'progress' => 0,
'deployment_graph_task_name' => 'openstack-haproxy-mysqld',
'task_status' => 'running',
'custom' => {}
}])
task_node.run(task)
end
context 'support different task type' do
let(:task_data) do