Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-04-05 22:23:36 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-04-05 22:23:36 +0300
commitf7014cd5bc776f9829818e535baf9db70387a416 (patch)
tree09df0ec10daf9be16170fc1aa57a7388d270b840 /spec/services
parente258e6f1471fb176e39daf6fef7785af120c2178 (diff)
Add a test to make sure it's not auto-canceling
whenever the feature is disabled in the project.
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb34
1 files changed, 24 insertions, 10 deletions
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index a3330367f96..fa5014cee07 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -21,6 +21,12 @@ describe Ci::CreatePipelineService, services: true do
context 'valid params' do
let(:pipeline) { execute_service }
+ let(:pipeline_on_previous_commit) do
+ execute_service(
+ after: previous_commit_sha_from_ref('master')
+ )
+ end
+
it { expect(pipeline).to be_kind_of(Ci::Pipeline) }
it { expect(pipeline).to be_valid }
it { expect(pipeline).to eq(project.pipelines.last) }
@@ -29,20 +35,10 @@ describe Ci::CreatePipelineService, services: true do
it { expect(pipeline.builds.first).to be_kind_of(Ci::Build) }
context 'auto-cancel enabled' do
- let(:pipeline_on_previous_commit) do
- execute_service(
- after: previous_commit_sha_from_ref('master')
- )
- end
-
before do
project.update(auto_cancel_pending_pipelines: 'enabled')
end
- def previous_commit_sha_from_ref(ref)
- project.commit(ref).parent.sha
- end
-
it 'does not cancel HEAD pipeline' do
pipeline
pipeline_on_previous_commit
@@ -81,6 +77,24 @@ describe Ci::CreatePipelineService, services: true do
expect(pending_pipeline.reload).to have_attributes(status: 'pending', auto_canceled_by_id: nil)
end
end
+
+ context 'auto-cancel disabled' do
+ before do
+ project.update(auto_cancel_pending_pipelines: 'disabled')
+ end
+
+ it 'does not auto cancel pending non-HEAD pipelines' do
+ pipeline_on_previous_commit
+ pipeline
+
+ expect(pipeline_on_previous_commit.reload)
+ .to have_attributes(status: 'pending', auto_canceled_by_id: nil)
+ end
+ end
+
+ def previous_commit_sha_from_ref(ref)
+ project.commit(ref).parent.sha
+ end
end
context "skip tag if there is no build for it" do