Fix wrong ready status instead of stopped for stop deployment

Report ready status for node means successful node status
which can be get if all tasks was passed with ready and skipped
statuses.

Same effect can be get if Astute mark node as skipped. In this
case we also get equal status 'successful'.

So we need ask node about skipped statuses before ask it about
successful status to prevent losing context about stop
deployment operation.

Change-Id: I3c042425cab800de0bfc4e03f29414b145f44983
Closes-Bug: #1672964
This commit is contained in:
Vladimir Sharshov (warpc) 2017-03-17 20:48:52 +03:00
parent 892894bfb5
commit 496212798e
2 changed files with 23 additions and 2 deletions

View File

@ -124,10 +124,10 @@ module Astute
def node_report_status
if !finished?
{}
elsif successful?
cluster.node_statuses_transitions.fetch('successful', {})
elsif skipped?
cluster.node_statuses_transitions.fetch('stopped', {})
elsif successful?
cluster.node_statuses_transitions.fetch('successful', {})
else
cluster.node_statuses_transitions.fetch('failed', {})
end

View File

@ -378,6 +378,27 @@ describe Astute::TaskNode do
})
task_node.poll
end
it 'should report stopped if node skipped' do
cluster.node_statuses_transitions['stopped'] = {
'status' => 'stopped'
}
cluster.node_statuses_transitions['successful'] = {
'status' => 'ready'
}
task_node.set_status_skipped
task_node.stubs(:finished?).returns(true)
task_node.stubs(:successful?).returns(true)
ctx.expects(:report).with({
'nodes' => [{
'uid' => 'node_id',
'status' => 'stopped',
'progress' => 100}]
})
task_node.report_node_status
end
end
it 'should report error if task failed and no more task' do