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:
Diffstat (limited to 'spec/lib/gitlab/ci/pipeline/chain/limit/rate_limit_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/limit/rate_limit_spec.rb35
1 files changed, 23 insertions, 12 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/limit/rate_limit_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/limit/rate_limit_spec.rb
index aa8aec2af4a..69d809aee85 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/limit/rate_limit_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/limit/rate_limit_spec.rb
@@ -30,10 +30,8 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::Limit::RateLimit, :freeze_time, :c
context 'when the limit is exceeded' do
before do
- allow(Gitlab::ApplicationRateLimiter).to receive(:rate_limits)
- .and_return(pipelines_create: { threshold: 1, interval: 1.minute })
-
- stub_feature_flags(ci_throttle_pipelines_creation_dry_run: false)
+ stub_application_setting(pipeline_limit_per_project_user_sha: 1)
+ stub_feature_flags(ci_enforce_throttle_pipelines_creation_override: false)
end
it 'does not persist the pipeline' do
@@ -55,7 +53,9 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::Limit::RateLimit, :freeze_time, :c
class: described_class.name,
project_id: project.id,
subscription_plan: project.actual_plan_name,
- commit_sha: command.sha
+ commit_sha: command.sha,
+ throttled: true,
+ throttle_override: false
)
)
@@ -101,9 +101,9 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::Limit::RateLimit, :freeze_time, :c
end
end
- context 'when ci_throttle_pipelines_creation is disabled' do
+ context 'when ci_enforce_throttle_pipelines_creation is disabled' do
before do
- stub_feature_flags(ci_throttle_pipelines_creation: false)
+ stub_feature_flags(ci_enforce_throttle_pipelines_creation: false)
end
it 'does not break the chain' do
@@ -118,16 +118,25 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::Limit::RateLimit, :freeze_time, :c
expect(pipeline.errors).to be_empty
end
- it 'does not log anything' do
- expect(Gitlab::AppJsonLogger).not_to receive(:info)
+ it 'creates a log entry' do
+ expect(Gitlab::AppJsonLogger).to receive(:info).with(
+ a_hash_including(
+ class: described_class.name,
+ project_id: project.id,
+ subscription_plan: project.actual_plan_name,
+ commit_sha: command.sha,
+ throttled: false,
+ throttle_override: false
+ )
+ )
perform
end
end
- context 'when ci_throttle_pipelines_creation_dry_run is enabled' do
+ context 'when ci_enforce_throttle_pipelines_creation_override is enabled' do
before do
- stub_feature_flags(ci_throttle_pipelines_creation_dry_run: true)
+ stub_feature_flags(ci_enforce_throttle_pipelines_creation_override: true)
end
it 'does not break the chain' do
@@ -148,7 +157,9 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::Limit::RateLimit, :freeze_time, :c
class: described_class.name,
project_id: project.id,
subscription_plan: project.actual_plan_name,
- commit_sha: command.sha
+ commit_sha: command.sha,
+ throttled: false,
+ throttle_override: true
)
)