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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-14 15:09:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-14 15:09:03 +0300
commit5366964a10484c2783a646b35a6da9eece01b242 (patch)
tree4a5a7a289d44e63d96a50a6a64db6e16b871f19c /spec/models/ci
parent733befe96ad19f5a02e442c4a9cc8059d3aabbda (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/build_spec.rb4
-rw-r--r--spec/models/ci/processable_spec.rb25
2 files changed, 28 insertions, 1 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 65fd9b049d6..4bfb5771bb8 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -762,8 +762,10 @@ describe Ci::Build do
let(:needs) { }
let!(:final) do
+ scheduling_type = needs.present? ? :dag : :stage
+
create(:ci_build,
- pipeline: pipeline, name: 'final',
+ pipeline: pipeline, name: 'final', scheduling_type: scheduling_type,
stage_idx: 3, stage: 'deploy', options: {
dependencies: dependencies
}
diff --git a/spec/models/ci/processable_spec.rb b/spec/models/ci/processable_spec.rb
index f3d743fc272..1e0544c14c5 100644
--- a/spec/models/ci/processable_spec.rb
+++ b/spec/models/ci/processable_spec.rb
@@ -120,4 +120,29 @@ describe Ci::Processable do
end
end
end
+
+ describe '.populate_scheduling_type!' do
+ let!(:build_without_needs) { create(:ci_build, project: project, pipeline: pipeline) }
+ let!(:build_with_needs) { create(:ci_build, project: project, pipeline: pipeline) }
+ let!(:needs_relation) { create(:ci_build_need, build: build_with_needs) }
+ let!(:another_build) { create(:ci_build, project: project) }
+
+ before do
+ Ci::Processable.update_all(scheduling_type: nil)
+ end
+
+ it 'populates scheduling_type of processables' do
+ expect do
+ pipeline.processables.populate_scheduling_type!
+ end.to change(pipeline.processables.where(scheduling_type: nil), :count).from(2).to(0)
+
+ expect(build_without_needs.reload.scheduling_type).to eq('stage')
+ expect(build_with_needs.reload.scheduling_type).to eq('dag')
+ end
+
+ it 'does not affect processables from other pipelines' do
+ pipeline.processables.populate_scheduling_type!
+ expect(another_build.reload.scheduling_type).to be_nil
+ end
+ end
end