Do not report 'running' for skipped tasks
Without this change Astute will send running
status for task which not run because skipped
Change-Id: Icde12c45b2816aaa5facc26764d7dcb4792f1702
Closes-Bug: #1564295
(cherry picked from commit 1e913924a1
)
This commit is contained in:
parent
e28fedc912
commit
0027f07725
|
@ -26,7 +26,7 @@ module Astute
|
|||
@task_engine.run
|
||||
task.set_status_running
|
||||
set_status_busy
|
||||
report_node_status
|
||||
report_node_status if report_running?(task.data)
|
||||
end
|
||||
|
||||
def poll
|
||||
|
@ -104,5 +104,10 @@ module Astute
|
|||
else raise TaskValidationError, "Unknown task type '#{data['type']}'"
|
||||
end
|
||||
end
|
||||
|
||||
def report_running?(data)
|
||||
!['noop', 'stage', 'skipped'].include?(data['type'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -91,6 +91,41 @@ describe Astute::TaskNode do
|
|||
task_node.run(task)
|
||||
end
|
||||
|
||||
context 'should not report about task as running' do
|
||||
let(:task_data_wo_type) do
|
||||
{
|
||||
"type" => "noop",
|
||||
"fail_on_error" => true,
|
||||
"required_for" => [],
|
||||
"requires" => [],
|
||||
"id" => "openstack-haproxy"
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'disable running report' do
|
||||
it 'task should not report running status' do
|
||||
ctx.unstub(:report)
|
||||
ctx.expects(:report).never
|
||||
task_node.run(task)
|
||||
end
|
||||
end
|
||||
|
||||
context 'noop' do
|
||||
let(:task_data) { task_data_wo_type.merge!('type'=> 'noop') }
|
||||
it_behaves_like 'disable running report'
|
||||
end
|
||||
|
||||
context 'stage' do
|
||||
let(:task_data) { task_data_wo_type.merge!('type'=> 'stage') }
|
||||
it_behaves_like 'disable running report'
|
||||
end
|
||||
|
||||
context 'skipped' do
|
||||
let(:task_data) { task_data_wo_type.merge!('type'=> 'skipped') }
|
||||
it_behaves_like 'disable running report'
|
||||
end
|
||||
end
|
||||
|
||||
context 'support different task type' do
|
||||
|
||||
let(:task_data) do
|
||||
|
|
Loading…
Reference in New Issue