Commit 99f24557 authored by Sean Carroll's avatar Sean Carroll

Adds project changelog

parent 03ff8139
---
title: Cancel redundant merge train pipelines
merge_request: 15450
author:
type: added
......@@ -40,7 +40,7 @@ describe MergeTrains::RefreshMergeRequestService do
it do
expect_next_instance_of(MergeTrains::CreatePipelineService, project, maintainer) do |pipeline_service|
allow(pipeline_service).to receive(:execute) { { status: :success, pipeline: pipeline } }
allow(pipeline_service).to receive(:execute) { { status: :success, pipeline: create(:ci_pipeline) } }
expect(pipeline_service).to receive(:execute).with(merge_request, previous_ref)
end
......@@ -60,6 +60,12 @@ describe MergeTrains::RefreshMergeRequestService do
end
end
shared_examples_for 'cancels the old pipeline for merge train' do
it do
expect { subject }.to change { pipeline.reload.status }.to('canceled')
end
end
context 'when merge train project configuration is disabled' do
before do
project.update!(merge_trains_enabled: false)
......@@ -137,7 +143,7 @@ describe MergeTrains::RefreshMergeRequestService do
end
context 'when pipeline for merge train is running' do
let(:pipeline) { create(:ci_pipeline, :running, target_sha: previous_ref_sha, source_sha: merge_request.diff_head_sha) }
let(:pipeline) { create(:ci_pipeline, :running, :with_job, target_sha: previous_ref_sha, source_sha: merge_request.diff_head_sha) }
let(:previous_ref_sha) { project.repository.commit('refs/heads/master').sha }
before do
......@@ -151,12 +157,14 @@ describe MergeTrains::RefreshMergeRequestService do
context 'when the pipeline is stale' do
let(:previous_ref_sha) { project.repository.commits('refs/heads/master', limit: 2).last.sha }
it_behaves_like 'cancels the old pipeline for merge train'
it_behaves_like 'creates a pipeline for merge train'
end
context 'when the pipeline is reuired to be recreated' do
context 'when the pipeline is required to be recreated' do
let(:require_recreate) { true }
it_behaves_like 'cancels the old pipeline for merge train'
it_behaves_like 'creates a pipeline for merge train'
end
end
......
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