diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 09:16:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 09:16:11 +0000 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/models/ci/pipeline_spec.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) | |
download | gitlab-ce-edaa33dee2ff2f7ea3fac488d41558eb5f86d68c.tar.gz |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/models/ci/pipeline_spec.rb')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index fd9970699d7..90f56c1e0a4 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -31,6 +31,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do it { is_expected.to have_many(:statuses_order_id_desc) } it { is_expected.to have_many(:bridges) } it { is_expected.to have_many(:job_artifacts).through(:builds) } + it { is_expected.to have_many(:build_trace_chunks).through(:builds) } it { is_expected.to have_many(:auto_canceled_pipelines) } it { is_expected.to have_many(:auto_canceled_jobs) } it { is_expected.to have_many(:sourced_pipelines) } @@ -1516,30 +1517,12 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do end describe 'pipeline caching' do - context 'when expire_job_and_pipeline_cache_synchronously is enabled' do - before do - stub_feature_flags(expire_job_and_pipeline_cache_synchronously: true) - end - - it 'executes Ci::ExpirePipelineCacheService' do - expect_next_instance_of(Ci::ExpirePipelineCacheService) do |service| - expect(service).to receive(:execute).with(pipeline) - end - - pipeline.cancel + it 'executes Ci::ExpirePipelineCacheService' do + expect_next_instance_of(Ci::ExpirePipelineCacheService) do |service| + expect(service).to receive(:execute).with(pipeline) end - end - - context 'when expire_job_and_pipeline_cache_synchronously is disabled' do - before do - stub_feature_flags(expire_job_and_pipeline_cache_synchronously: false) - end - - it 'performs ExpirePipelinesCacheWorker' do - expect(ExpirePipelineCacheWorker).to receive(:perform_async).with(pipeline.id) - pipeline.cancel - end + pipeline.cancel end end @@ -4677,4 +4660,23 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do let!(:model) { create(:ci_pipeline, user: create(:user)) } let!(:parent) { model.user } end + + describe 'tags count' do + let_it_be_with_refind(:pipeline) do + create(:ci_empty_pipeline, project: project) + end + + it { expect(pipeline.tags_count).to eq(0) } + it { expect(pipeline.distinct_tags_count).to eq(0) } + + context 'with builds' do + before do + create(:ci_build, pipeline: pipeline, tag_list: %w[a b]) + create(:ci_build, pipeline: pipeline, tag_list: %w[b c]) + end + + it { expect(pipeline.tags_count).to eq(4) } + it { expect(pipeline.distinct_tags_count).to eq(3) } + end + end end |