diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-22 15:32:49 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-22 15:32:49 +0100 |
commit | f45358db311f76d9a3aa8c68dd1f503228691ae1 (patch) | |
tree | 460fde9c941f17ba027166281c9e7478275b1a5e | |
parent | 99469aaf470816655fe42152cd6ff4a689f73054 (diff) | |
download | gitlab-ce-f45358db311f76d9a3aa8c68dd1f503228691ae1.tar.gz |
Bring seeds size method back to CI/CD pipeline class
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 9642c94a231..643a8324c7d 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -371,6 +371,10 @@ module Ci end end + def seeds_size + stage_seeds.sum(&:size) + end + def has_kubernetes_active? project.deployment_platform&.active? end diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index b99478e168f..391a335d909 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -330,6 +330,23 @@ describe Ci::Pipeline, :mailer do end end + describe '#seeds_size' do + context 'when refs policy is specified' do + let(:config) do + { production: { stage: 'deploy', script: 'cap prod', only: ['master'] }, + spinach: { stage: 'test', script: 'spinach', only: ['tags'] } } + end + + let(:pipeline) do + build(:ci_pipeline, ref: 'feature', tag: true, config: config) + end + + it 'returns real seeds size' do + expect(pipeline.seeds_size).to eq 1 + end + end + end + describe 'legacy stages' do before do create(:commit_status, pipeline: pipeline, |