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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 15:09:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 15:09:00 +0300
commitae78b85a25cb0c19c3d6a2e4e6c7ca91ed50787d (patch)
treec53ad0fcdab26725814f1dc5267f6a04ebe4cf73 /spec/services/ci/register_job_service_spec.rb
parent38149afcf95e7669a7a99828c579d185b70c04dc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/ci/register_job_service_spec.rb')
-rw-r--r--spec/services/ci/register_job_service_spec.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/spec/services/ci/register_job_service_spec.rb b/spec/services/ci/register_job_service_spec.rb
index 0f2d994efd4..2da1350e2af 100644
--- a/spec/services/ci/register_job_service_spec.rb
+++ b/spec/services/ci/register_job_service_spec.rb
@@ -612,7 +612,8 @@ module Ci
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_first_job }, 1800)
+ jobs_running_for_project: expected_jobs_running_for_project_first_job,
+ shard: expected_shard }, 1800)
execute(runner)
end
@@ -625,7 +626,8 @@ module Ci
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 }, 1800)
+ jobs_running_for_project: expected_jobs_running_for_project_third_job,
+ shard: expected_shard }, 1800)
execute(runner)
end
@@ -638,13 +640,28 @@ module Ci
end
context 'when shared runner is used' do
- let(:runner) { shared_runner }
+ let(:runner) { create(:ci_runner, :instance, tag_list: %w(tag1 tag2)) }
let(:expected_shared_runner) { true }
+ let(:expected_shard) { Ci::RegisterJobService::DEFAULT_METRICS_SHARD }
let(:expected_jobs_running_for_project_first_job) { 0 }
let(:expected_jobs_running_for_project_third_job) { 2 }
it_behaves_like 'metrics collector'
+ context 'when metrics_shard tag is defined' do
+ let(:runner) { create(:ci_runner, :instance, tag_list: %w(tag1 metrics_shard::shard_tag tag2)) }
+ let(:expected_shard) { 'shard_tag' }
+
+ it_behaves_like 'metrics collector'
+ end
+
+ context 'when multiple metrics_shard tag is defined' do
+ let(:runner) { create(:ci_runner, :instance, tag_list: %w(tag1 metrics_shard::shard_tag metrics_shard::shard_tag_2 tag2)) }
+ let(:expected_shard) { 'shard_tag' }
+
+ 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)
@@ -662,8 +679,9 @@ module Ci
end
context 'when specific runner is used' do
- let(:runner) { specific_runner }
+ let(:runner) { create(:ci_runner, :project, projects: [project], tag_list: %w(tag1 metrics_shard::shard_tag tag2)) }
let(:expected_shared_runner) { false }
+ let(:expected_shard) { Ci::RegisterJobService::DEFAULT_METRICS_SHARD }
let(:expected_jobs_running_for_project_first_job) { '+Inf' }
let(:expected_jobs_running_for_project_third_job) { '+Inf' }