Commit e4554925 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extend specs for pipelines with manual blocking actions

parent 57253f04
...@@ -96,6 +96,10 @@ module HasStatus ...@@ -96,6 +96,10 @@ module HasStatus
COMPLETED_STATUSES.include?(status) COMPLETED_STATUSES.include?(status)
end end
def blocked?
BLOCKED_STATUS == status
end
private private
def calculate_duration def calculate_duration
......
...@@ -312,6 +312,61 @@ describe Ci::ProcessPipelineService, '#execute', :services do ...@@ -312,6 +312,61 @@ describe Ci::ProcessPipelineService, '#execute', :services do
expect(pipeline.reload).to be_failed expect(pipeline.reload).to be_failed
end end
end end
context 'when pipeline is promoted sequentially up to the end' do
it 'properly processes entire pipeline' do
process_pipeline
expect(builds_names).to eq %w[code:test]
expect(builds_statuses).to eq %w[pending]
succeed_running_or_pending
expect(builds_names).to eq %w[code:test staging:deploy]
expect(builds_statuses).to eq %w[success manual]
expect(pipeline.reload).to be_manual
play_manual_action('staging:deploy')
expect(builds_statuses).to eq %w[success pending]
succeed_running_or_pending
expect(builds_names).to eq %w[code:test staging:deploy staging:test]
expect(builds_statuses).to eq %w[success success pending]
succeed_running_or_pending
expect(builds_names).to eq %w[code:test staging:deploy staging:test
production:deploy]
expect(builds_statuses).to eq %w[success success success manual]
expect(pipeline.reload).to be_manual
# TODO, expect(pipeline.reload).to be_started
expect(pipeline.reload).to be_blocked
expect(pipeline.reload).not_to be_active
expect(pipeline.reload).not_to be_complete
play_manual_action('production:deploy')
expect(builds_statuses).to eq %w[success success success pending]
expect(pipeline.reload).to be_running
succeed_running_or_pending
expect(builds_names).to eq %w[code:test staging:deploy staging:test
production:deploy production:test]
expect(builds_statuses).to eq %w[success success success success pending]
expect(pipeline.reload).to be_running
succeed_running_or_pending
expect(builds_names).to eq %w[code:test staging:deploy staging:test
production:deploy production:test]
expect(builds_statuses).to eq %w[success success success success success]
expect(pipeline.reload).to be_success
end
end
end end
context 'when second stage has only on_failure jobs' do context 'when second stage has only on_failure jobs' do
...@@ -463,6 +518,10 @@ describe Ci::ProcessPipelineService, '#execute', :services do ...@@ -463,6 +518,10 @@ describe Ci::ProcessPipelineService, '#execute', :services do
pipeline.builds.running_or_pending.each(&:cancel) pipeline.builds.running_or_pending.each(&:cancel)
end end
def play_manual_action(name)
builds.find_by(name: name).play(user)
end
delegate :manual_actions, to: :pipeline delegate :manual_actions, to: :pipeline
def create_build(name, **opts) def create_build(name, **opts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment