diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-25 18:09:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-25 18:09:25 +0300 |
commit | ec558ad8ed732ff6f8a89aa3651eb92c27c50deb (patch) | |
tree | e6d0eb5946758007594e8bf6feb5fb9759f48d6c /spec/models | |
parent | 7b1fa4c1a1b784c2f78405dca82e56a009f1e773 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/bridge_spec.rb | 20 | ||||
-rw-r--r-- | spec/models/ci/processable_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/clusters/applications/cilium_spec.rb | 17 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 23 |
4 files changed, 47 insertions, 19 deletions
diff --git a/spec/models/ci/bridge_spec.rb b/spec/models/ci/bridge_spec.rb index 964b57e709e..7b307de87c7 100644 --- a/spec/models/ci/bridge_spec.rb +++ b/spec/models/ci/bridge_spec.rb @@ -37,8 +37,18 @@ RSpec.describe Ci::Bridge, feature_category: :continuous_integration do describe '#retryable?' do let(:bridge) { create(:ci_bridge, :success) } - it 'returns false' do - expect(bridge.retryable?).to eq(false) + it 'returns true' do + expect(bridge.retryable?).to eq(true) + end + + context 'without ci_recreate_downstream_pipeline ff' do + before do + stub_feature_flags(ci_recreate_downstream_pipeline: false) + end + + it 'returns false' do + expect(bridge.retryable?).to eq(false) + end end end @@ -590,4 +600,10 @@ RSpec.describe Ci::Bridge, feature_category: :continuous_integration do expect(bridge.metadata.partition_id).to eq(ci_testing_partition_id) end end + + describe '#deployment_job?' do + subject { bridge.deployment_job? } + + it { is_expected.to eq(false) } + end end diff --git a/spec/models/ci/processable_spec.rb b/spec/models/ci/processable_spec.rb index 07fac4ee2f7..89ed8ab3fa7 100644 --- a/spec/models/ci/processable_spec.rb +++ b/spec/models/ci/processable_spec.rb @@ -287,6 +287,12 @@ RSpec.describe Ci::Processable do end end + context 'when the processable is a bridge' do + subject(:processable) { create(:ci_bridge, pipeline: pipeline) } + + it_behaves_like 'retryable processable' + end + context 'when the processable is a build' do subject(:processable) { create(:ci_build, pipeline: pipeline) } diff --git a/spec/models/clusters/applications/cilium_spec.rb b/spec/models/clusters/applications/cilium_spec.rb deleted file mode 100644 index 8b01502d5c0..00000000000 --- a/spec/models/clusters/applications/cilium_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Clusters::Applications::Cilium do - let(:cilium) { create(:clusters_applications_cilium) } - - include_examples 'cluster application core specs', :clusters_applications_cilium - include_examples 'cluster application status specs', :clusters_applications_cilium - include_examples 'cluster application initial status specs' - - describe '#allowed_to_uninstall?' do - subject { cilium.allowed_to_uninstall? } - - it { is_expected.to be false } - end -end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 63931f136f8..2ea6c396117 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -920,6 +920,29 @@ RSpec.describe Project, factory_default: :keep, feature_category: :projects do end end + describe '#invalidate_personal_projects_count_of_owner' do + context 'for personal projects' do + let_it_be(:namespace_user) { create(:user) } + let_it_be(:project) { create(:project, namespace: namespace_user.namespace) } + + it 'invalidates personal_project_count cache of the the owner of the personal namespace' do + expect(Rails.cache).to receive(:delete).with(['users', namespace_user.id, 'personal_projects_count']) + + project.invalidate_personal_projects_count_of_owner + end + end + + context 'for projects in groups' do + let_it_be(:project) { create(:project, namespace: create(:group)) } + + it 'does not invalidates any cache' do + expect(Rails.cache).not_to receive(:delete) + + project.invalidate_personal_projects_count_of_owner + end + end + end + describe '#default_pipeline_lock' do let(:project) { build_stubbed(:project) } |