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/services/ci/register_job_service_spec.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) | |
download | gitlab-ce-76a9e64d004e0c02c35b8165ca38d005afb5e823.tar.gz |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/services/ci/register_job_service_spec.rb')
-rw-r--r-- | spec/services/ci/register_job_service_spec.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/services/ci/register_job_service_spec.rb b/spec/services/ci/register_job_service_spec.rb index 866015aa523..251159864f5 100644 --- a/spec/services/ci/register_job_service_spec.rb +++ b/spec/services/ci/register_job_service_spec.rb @@ -827,11 +827,17 @@ module Ci end context 'when project already has running jobs' do - let!(:build2) { create(:ci_build, :running, pipeline: pipeline, runner: shared_runner) } - let!(:build3) { create(:ci_build, :running, pipeline: pipeline, runner: shared_runner) } + let(:build2) { create(:ci_build, :running, pipeline: pipeline, runner: shared_runner) } + let(:build3) { create(:ci_build, :running, pipeline: pipeline, runner: shared_runner) } + + before do + ::Ci::RunningBuild.upsert_shared_runner_build!(build2) + ::Ci::RunningBuild.upsert_shared_runner_build!(build3) + end it 'counts job queuing time histogram with expected labels' do allow(attempt_counter).to receive(:increment) + expect(job_queue_duration_seconds).to receive(:observe) .with({ shared_runner: expected_shared_runner, jobs_running_for_project: expected_jobs_running_for_project_third_job, @@ -845,6 +851,14 @@ module Ci shared_examples 'metrics collector' do it_behaves_like 'attempt counter collector' it_behaves_like 'jobs queueing time histogram collector' + + context 'when using denormalized data is disabled' do + before do + stub_feature_flags(ci_pending_builds_maintain_denormalized_data: false) + end + + it_behaves_like 'jobs queueing time histogram collector' + end end context 'when shared runner is used' do @@ -875,6 +889,16 @@ module Ci it_behaves_like 'metrics collector' end + context 'when max running jobs bucket size is exceeded' do + before do + stub_const('Gitlab::Ci::Queue::Metrics::JOBS_RUNNING_FOR_PROJECT_MAX_BUCKET', 1) + end + + let(:expected_jobs_running_for_project_third_job) { '1+' } + + it_behaves_like 'metrics collector' + end + context 'when pending job with queued_at=nil is used' do before do pending_job.update!(queued_at: nil) |