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-09-19 04:45:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/workers
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/analytics/instance_statistics/count_job_trigger_worker_spec.rb29
-rw-r--r--spec/workers/analytics/instance_statistics/counter_job_worker_spec.rb54
-rw-r--r--spec/workers/ci/build_trace_chunk_flush_worker_spec.rb31
-rw-r--r--spec/workers/ci/create_cross_project_pipeline_worker_spec.rb4
-rw-r--r--spec/workers/ci/pipelines/create_artifact_worker_spec.rb32
-rw-r--r--spec/workers/ci/ref_delete_unlock_artifacts_worker_spec.rb26
-rw-r--r--spec/workers/ci_platform_metrics_update_cron_worker_spec.rb15
-rw-r--r--spec/workers/cluster_update_app_worker_spec.rb2
-rw-r--r--spec/workers/create_pipeline_worker_spec.rb4
-rw-r--r--spec/workers/delete_diff_files_worker_spec.rb6
-rw-r--r--spec/workers/deployments/finished_worker_spec.rb12
-rw-r--r--spec/workers/git_garbage_collect_worker_spec.rb21
-rw-r--r--spec/workers/issue_placement_worker_spec.rb132
-rw-r--r--spec/workers/issue_rebalancing_worker_spec.rb39
-rw-r--r--spec/workers/jira_connect/sync_branch_worker_spec.rb65
-rw-r--r--spec/workers/jira_connect/sync_merge_request_worker_spec.rb30
-rw-r--r--spec/workers/merge_request_cleanup_refs_worker_spec.rb30
-rw-r--r--spec/workers/new_issue_worker_spec.rb22
-rw-r--r--spec/workers/new_merge_request_worker_spec.rb16
-rw-r--r--spec/workers/new_note_worker_spec.rb12
-rw-r--r--spec/workers/pages_remove_worker_spec.rb26
-rw-r--r--spec/workers/pages_transfer_worker_spec.rb38
-rw-r--r--spec/workers/pages_update_configuration_worker_spec.rb8
-rw-r--r--spec/workers/partition_creation_worker_spec.rb14
-rw-r--r--spec/workers/personal_access_tokens/expired_notification_worker_spec.rb28
-rw-r--r--spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb19
-rw-r--r--spec/workers/post_receive_spec.rb6
-rw-r--r--spec/workers/propagate_integration_worker_spec.rb9
-rw-r--r--spec/workers/propagate_service_template_worker_spec.rb2
-rw-r--r--spec/workers/remote_mirror_notification_worker_spec.rb2
-rw-r--r--spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb6
-rw-r--r--spec/workers/repository_fork_worker_spec.rb2
-rw-r--r--spec/workers/repository_update_remote_mirror_worker_spec.rb2
-rw-r--r--spec/workers/run_pipeline_schedule_worker_spec.rb2
34 files changed, 630 insertions, 116 deletions
diff --git a/spec/workers/analytics/instance_statistics/count_job_trigger_worker_spec.rb b/spec/workers/analytics/instance_statistics/count_job_trigger_worker_spec.rb
new file mode 100644
index 00000000000..620900b3402
--- /dev/null
+++ b/spec/workers/analytics/instance_statistics/count_job_trigger_worker_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Analytics::InstanceStatistics::CountJobTriggerWorker do
+ it_behaves_like 'an idempotent worker'
+
+ context 'triggers a job for each measurement identifiers' do
+ let(:expected_count) { Analytics::InstanceStatistics::Measurement.identifiers.size }
+
+ it 'triggers CounterJobWorker jobs' do
+ subject.perform
+
+ expect(Analytics::InstanceStatistics::CounterJobWorker.jobs.count).to eq(expected_count)
+ end
+ end
+
+ context 'when the `store_instance_statistics_measurements` feature flag is off' do
+ before do
+ stub_feature_flags(store_instance_statistics_measurements: false)
+ end
+
+ it 'does not trigger any CounterJobWorker job' do
+ subject.perform
+
+ expect(Analytics::InstanceStatistics::CounterJobWorker.jobs.count).to eq(0)
+ end
+ end
+end
diff --git a/spec/workers/analytics/instance_statistics/counter_job_worker_spec.rb b/spec/workers/analytics/instance_statistics/counter_job_worker_spec.rb
new file mode 100644
index 00000000000..8db86071dc4
--- /dev/null
+++ b/spec/workers/analytics/instance_statistics/counter_job_worker_spec.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Analytics::InstanceStatistics::CounterJobWorker do
+ let_it_be(:user_1) { create(:user) }
+ let_it_be(:user_2) { create(:user) }
+
+ let(:users_measurement_identifier) { ::Analytics::InstanceStatistics::Measurement.identifiers.fetch(:users) }
+ let(:recorded_at) { Time.zone.now }
+ let(:job_args) { [users_measurement_identifier, user_1.id, user_2.id, recorded_at] }
+
+ before do
+ allow(ActiveRecord::Base.connection).to receive(:transaction_open?).and_return(false)
+ end
+
+ include_examples 'an idempotent worker' do
+ it 'counts a scope and stores the result' do
+ subject
+
+ measurement = Analytics::InstanceStatistics::Measurement.first
+ expect(measurement.recorded_at).to be_like_time(recorded_at)
+ expect(measurement.identifier).to eq('users')
+ expect(measurement.count).to eq(2)
+ end
+ end
+
+ context 'when no records are in the database' do
+ let(:users_measurement_identifier) { ::Analytics::InstanceStatistics::Measurement.identifiers.fetch(:groups) }
+
+ subject { described_class.new.perform(users_measurement_identifier, nil, nil, recorded_at) }
+
+ it 'sets 0 as the count' do
+ subject
+
+ measurement = Analytics::InstanceStatistics::Measurement.first
+ expect(measurement.recorded_at).to be_like_time(recorded_at)
+ expect(measurement.identifier).to eq('groups')
+ expect(measurement.count).to eq(0)
+ end
+ end
+
+ it 'does not raise error when inserting duplicated measurement' do
+ subject
+
+ expect { subject }.not_to raise_error
+ end
+
+ it 'does not insert anything when BatchCount returns error' do
+ allow(Gitlab::Database::BatchCount).to receive(:batch_count).and_return(Gitlab::Database::BatchCounter::FALLBACK)
+
+ expect { subject }.not_to change { Analytics::InstanceStatistics::Measurement.count }
+ end
+end
diff --git a/spec/workers/ci/build_trace_chunk_flush_worker_spec.rb b/spec/workers/ci/build_trace_chunk_flush_worker_spec.rb
new file mode 100644
index 00000000000..352ad6d4cf6
--- /dev/null
+++ b/spec/workers/ci/build_trace_chunk_flush_worker_spec.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::BuildTraceChunkFlushWorker do
+ let(:data) { 'x' * Ci::BuildTraceChunk::CHUNK_SIZE }
+
+ let(:chunk) do
+ create(:ci_build_trace_chunk, :redis_with_data, initial_data: data)
+ end
+
+ it 'migrates chunk to a permanent store' do
+ expect(chunk).to be_live
+
+ described_class.new.perform(chunk.id)
+
+ expect(chunk.reload).to be_persisted
+ end
+
+ describe '#perform' do
+ it_behaves_like 'an idempotent worker' do
+ let(:job_args) { [chunk.id] }
+
+ it 'migrates build trace chunk to a safe store' do
+ subject
+
+ expect(chunk.reload).to be_persisted
+ end
+ end
+ end
+end
diff --git a/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb b/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb
index 95dcf5624cc..116e6878281 100644
--- a/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb
+++ b/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineWorker do
describe '#perform' do
context 'when bridge exists' do
it 'calls cross project pipeline creation service' do
- expect(Ci::CreateCrossProjectPipelineService)
+ expect(Ci::CreateDownstreamPipelineService)
.to receive(:new)
.with(project, user)
.and_return(service)
@@ -26,7 +26,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineWorker do
context 'when bridge does not exist' do
it 'does nothing' do
- expect(Ci::CreateCrossProjectPipelineService)
+ expect(Ci::CreateDownstreamPipelineService)
.not_to receive(:new)
described_class.new.perform(non_existing_record_id)
diff --git a/spec/workers/ci/pipelines/create_artifact_worker_spec.rb b/spec/workers/ci/pipelines/create_artifact_worker_spec.rb
new file mode 100644
index 00000000000..31d2c4e9559
--- /dev/null
+++ b/spec/workers/ci/pipelines/create_artifact_worker_spec.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe ::Ci::Pipelines::CreateArtifactWorker do
+ describe '#perform' do
+ subject { described_class.new.perform(pipeline_id) }
+
+ context 'when pipeline exists' do
+ let(:pipeline) { create(:ci_pipeline) }
+ let(:pipeline_id) { pipeline.id }
+
+ it 'calls pipeline report result service' do
+ expect_next_instance_of(::Ci::Pipelines::CreateArtifactService) do |create_artifact_service|
+ expect(create_artifact_service).to receive(:execute)
+ end
+
+ subject
+ end
+ end
+
+ context 'when pipeline does not exist' do
+ let(:pipeline_id) { non_existing_record_id }
+
+ it 'does not call pipeline create artifact service' do
+ expect(Ci::Pipelines::CreateArtifactService).not_to receive(:execute)
+
+ subject
+ end
+ end
+ end
+end
diff --git a/spec/workers/ci/ref_delete_unlock_artifacts_worker_spec.rb b/spec/workers/ci/ref_delete_unlock_artifacts_worker_spec.rb
index d9f2dd326dd..f510852e753 100644
--- a/spec/workers/ci/ref_delete_unlock_artifacts_worker_spec.rb
+++ b/spec/workers/ci/ref_delete_unlock_artifacts_worker_spec.rb
@@ -29,10 +29,8 @@ RSpec.describe Ci::RefDeleteUnlockArtifactsWorker do
context 'when user exists' do
let(:user_id) { project.creator.id }
- context 'when ci ref exists' do
- before do
- create(:ci_ref, ref_path: ref)
- end
+ context 'when ci ref exists for project' do
+ let!(:ci_ref) { create(:ci_ref, ref_path: ref, project: project) }
it 'calls the service' do
service = spy(Ci::UnlockArtifactsService)
@@ -40,17 +38,33 @@ RSpec.describe Ci::RefDeleteUnlockArtifactsWorker do
perform
- expect(service).to have_received(:execute)
+ expect(service).to have_received(:execute).with(ci_ref)
end
end
- context 'when ci ref does not exist' do
+ context 'when ci ref does not exist for the given project' do
+ let!(:another_ci_ref) { create(:ci_ref, ref_path: ref) }
+
it 'does not call the service' do
expect(Ci::UnlockArtifactsService).not_to receive(:new)
perform
end
end
+
+ context 'when same ref path exists for a different project' do
+ let!(:another_ci_ref) { create(:ci_ref, ref_path: ref) }
+ let!(:ci_ref) { create(:ci_ref, ref_path: ref, project: project) }
+
+ it 'calls the service with the correct ref_id' do
+ service = spy(Ci::UnlockArtifactsService)
+ expect(Ci::UnlockArtifactsService).to receive(:new).and_return(service)
+
+ perform
+
+ expect(service).to have_received(:execute).with(ci_ref)
+ end
+ end
end
context 'when user does not exist' do
diff --git a/spec/workers/ci_platform_metrics_update_cron_worker_spec.rb b/spec/workers/ci_platform_metrics_update_cron_worker_spec.rb
new file mode 100644
index 00000000000..0bb6822a0a5
--- /dev/null
+++ b/spec/workers/ci_platform_metrics_update_cron_worker_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe CiPlatformMetricsUpdateCronWorker, type: :worker do
+ describe '#perform' do
+ subject { described_class.new.perform }
+
+ it 'inserts new platform metrics' do
+ expect(CiPlatformMetric).to receive(:insert_auto_devops_platform_targets!).and_call_original
+
+ subject
+ end
+ end
+end
diff --git a/spec/workers/cluster_update_app_worker_spec.rb b/spec/workers/cluster_update_app_worker_spec.rb
index c24f40024fd..8b8c1c82099 100644
--- a/spec/workers/cluster_update_app_worker_spec.rb
+++ b/spec/workers/cluster_update_app_worker_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe ClusterUpdateAppWorker do
subject { described_class.new }
around do |example|
- Timecop.freeze(Time.current) { example.run }
+ freeze_time { example.run }
end
before do
diff --git a/spec/workers/create_pipeline_worker_spec.rb b/spec/workers/create_pipeline_worker_spec.rb
index 6a3729fa28a..da85d700429 100644
--- a/spec/workers/create_pipeline_worker_spec.rb
+++ b/spec/workers/create_pipeline_worker_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe CreatePipelineWorker do
context 'when a project not found' do
it 'does not call the Service' do
expect(Ci::CreatePipelineService).not_to receive(:new)
- expect { worker.perform(99, create(:user).id, 'master', :web) }.to raise_error(ActiveRecord::RecordNotFound)
+ expect { worker.perform(non_existing_record_id, create(:user).id, 'master', :web) }.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -18,7 +18,7 @@ RSpec.describe CreatePipelineWorker do
it 'does not call the Service' do
expect(Ci::CreatePipelineService).not_to receive(:new)
- expect { worker.perform(project.id, 99, project.default_branch, :web) }.to raise_error(ActiveRecord::RecordNotFound)
+ expect { worker.perform(project.id, non_existing_record_id, project.default_branch, :web) }.to raise_error(ActiveRecord::RecordNotFound)
end
end
diff --git a/spec/workers/delete_diff_files_worker_spec.rb b/spec/workers/delete_diff_files_worker_spec.rb
index b3b01588e0b..cf26dbabb97 100644
--- a/spec/workers/delete_diff_files_worker_spec.rb
+++ b/spec/workers/delete_diff_files_worker_spec.rb
@@ -19,6 +19,12 @@ RSpec.describe DeleteDiffFilesWorker do
.from('collected').to('without_files')
end
+ it 'resets the files_count of the diff' do
+ expect { described_class.new.perform(merge_request_diff.id) }
+ .to change { merge_request_diff.reload.files_count }
+ .from(20).to(0)
+ end
+
it 'does nothing if diff was already marked as "without_files"' do
merge_request_diff.clean!
diff --git a/spec/workers/deployments/finished_worker_spec.rb b/spec/workers/deployments/finished_worker_spec.rb
index e1ec2d89e0a..d0a26ae1547 100644
--- a/spec/workers/deployments/finished_worker_spec.rb
+++ b/spec/workers/deployments/finished_worker_spec.rb
@@ -61,17 +61,5 @@ RSpec.describe Deployments::FinishedWorker do
worker.perform(deployment.id)
end
-
- it 'does not execute webhooks if feature flag is disabled' do
- stub_feature_flags(deployment_webhooks: false)
-
- deployment = create(:deployment)
- project = deployment.project
- create(:project_hook, deployment_events: true, project: project)
-
- expect(WebHookService).not_to receive(:new)
-
- worker.perform(deployment.id)
- end
end
end
diff --git a/spec/workers/git_garbage_collect_worker_spec.rb b/spec/workers/git_garbage_collect_worker_spec.rb
index 223f5aea813..1be6e86b650 100644
--- a/spec/workers/git_garbage_collect_worker_spec.rb
+++ b/spec/workers/git_garbage_collect_worker_spec.rb
@@ -25,12 +25,18 @@ RSpec.describe GitGarbageCollectWorker do
end
shared_examples 'it updates the project statistics' do
- specify do
- expect_any_instance_of(Projects::UpdateStatisticsService).to receive(:execute).and_call_original
- expect(Projects::UpdateStatisticsService)
- .to receive(:new)
- .with(project, nil, statistics: [:repository_size, :lfs_objects_size])
- .and_call_original
+ it 'updates the project statistics' do
+ expect_next_instance_of(Projects::UpdateStatisticsService, project, nil, statistics: [:repository_size, :lfs_objects_size]) do |service|
+ expect(service).to receive(:execute).and_call_original
+ end
+
+ subject.perform(*params)
+ end
+
+ it 'does nothing if the database is read-only' do
+ allow(Gitlab::Database).to receive(:read_only?) { true }
+
+ expect_any_instance_of(Projects::UpdateStatisticsService).not_to receive(:execute)
subject.perform(*params)
end
@@ -141,7 +147,8 @@ RSpec.describe GitGarbageCollectWorker do
end
it 'does nothing if the database is read-only' do
- expect(Gitlab::Database).to receive(:read_only?) { true }
+ allow(Gitlab::Database).to receive(:read_only?) { true }
+
expect_any_instance_of(Gitlab::Cleanup::OrphanLfsFileReferences).not_to receive(:run!)
subject.perform(*params)
diff --git a/spec/workers/issue_placement_worker_spec.rb b/spec/workers/issue_placement_worker_spec.rb
new file mode 100644
index 00000000000..5d4d41b90d0
--- /dev/null
+++ b/spec/workers/issue_placement_worker_spec.rb
@@ -0,0 +1,132 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe IssuePlacementWorker do
+ describe '#perform' do
+ let_it_be(:time) { Time.now.utc }
+ let_it_be(:project) { create(:project) }
+ let_it_be(:author) { create(:user) }
+ let_it_be(:common_attrs) { { author: author, project: project } }
+ let_it_be(:unplaced) { common_attrs.merge(relative_position: nil) }
+ let_it_be_with_reload(:issue) { create(:issue, **unplaced, created_at: time) }
+ let_it_be_with_reload(:issue_a) { create(:issue, **unplaced, created_at: time - 1.minute) }
+ let_it_be_with_reload(:issue_b) { create(:issue, **unplaced, created_at: time - 2.minutes) }
+ let_it_be_with_reload(:issue_c) { create(:issue, **unplaced, created_at: time + 1.minute) }
+ let_it_be_with_reload(:issue_d) { create(:issue, **unplaced, created_at: time + 2.minutes) }
+ let_it_be_with_reload(:issue_e) { create(:issue, **common_attrs, relative_position: 10, created_at: time + 1.minute) }
+ let_it_be_with_reload(:issue_f) { create(:issue, **unplaced, created_at: time + 1.minute) }
+
+ let_it_be(:irrelevant) { create(:issue, relative_position: nil, created_at: time) }
+
+ shared_examples 'running the issue placement worker' do
+ let(:issue_id) { issue.id }
+ let(:project_id) { project.id }
+
+ it 'places all issues created at most 5 minutes before this one at the end, most recent last' do
+ expect { run_worker }.not_to change { irrelevant.reset.relative_position }
+
+ expect(project.issues.order_relative_position_asc)
+ .to eq([issue_e, issue_b, issue_a, issue, issue_c, issue_f, issue_d])
+ expect(project.issues.where(relative_position: nil)).not_to exist
+ end
+
+ it 'schedules rebalancing if needed' do
+ issue_a.update!(relative_position: RelativePositioning::MAX_POSITION)
+
+ expect(IssueRebalancingWorker).to receive(:perform_async).with(nil, project.id)
+
+ run_worker
+ end
+
+ context 'there are more than QUERY_LIMIT unplaced issues' do
+ before_all do
+ # Ensure there are more than N issues in this set
+ n = described_class::QUERY_LIMIT
+ create_list(:issue, n - 5, **unplaced)
+ end
+
+ it 'limits the sweep to QUERY_LIMIT records, and reschedules placement' do
+ expect(Issue).to receive(:move_nulls_to_end)
+ .with(have_attributes(count: described_class::QUERY_LIMIT))
+ .and_call_original
+
+ expect(described_class).to receive(:perform_async).with(nil, project.id)
+
+ run_worker
+
+ expect(project.issues.where(relative_position: nil)).to exist
+ end
+
+ it 'is eventually correct' do
+ prefix = project.issues.where.not(relative_position: nil).order(:relative_position).to_a
+ moved = project.issues.where.not(id: prefix.map(&:id))
+
+ run_worker
+
+ expect(project.issues.where(relative_position: nil)).to exist
+
+ run_worker
+
+ expect(project.issues.where(relative_position: nil)).not_to exist
+ expect(project.issues.order(:relative_position)).to eq(prefix + moved.order(:created_at, :id))
+ end
+ end
+
+ context 'we are passed bad IDs' do
+ let(:issue_id) { non_existing_record_id }
+ let(:project_id) { non_existing_record_id }
+
+ def max_positions_by_project
+ Issue
+ .group(:project_id)
+ .pluck(:project_id, Issue.arel_table[:relative_position].maximum.as('max_relative_position'))
+ .to_h
+ end
+
+ it 'does move any issues to the end' do
+ expect { run_worker }.not_to change { max_positions_by_project }
+ end
+
+ context 'the project_id refers to an empty project' do
+ let!(:project_id) { create(:project).id }
+
+ it 'does move any issues to the end' do
+ expect { run_worker }.not_to change { max_positions_by_project }
+ end
+ end
+ end
+
+ it 'anticipates the failure to place the issues, and schedules rebalancing' do
+ allow(Issue).to receive(:move_nulls_to_end) { raise RelativePositioning::NoSpaceLeft }
+
+ expect(IssueRebalancingWorker).to receive(:perform_async).with(nil, project.id)
+ expect(Gitlab::ErrorTracking)
+ .to receive(:log_exception)
+ .with(RelativePositioning::NoSpaceLeft, worker_arguments)
+
+ run_worker
+ end
+ end
+
+ context 'passing an issue ID' do
+ def run_worker
+ described_class.new.perform(issue_id)
+ end
+
+ let(:worker_arguments) { { issue_id: issue_id, project_id: nil } }
+
+ it_behaves_like 'running the issue placement worker'
+ end
+
+ context 'passing a project ID' do
+ def run_worker
+ described_class.new.perform(nil, project_id)
+ end
+
+ let(:worker_arguments) { { issue_id: nil, project_id: project_id } }
+
+ it_behaves_like 'running the issue placement worker'
+ end
+ end
+end
diff --git a/spec/workers/issue_rebalancing_worker_spec.rb b/spec/workers/issue_rebalancing_worker_spec.rb
new file mode 100644
index 00000000000..8b0fcd4bc5a
--- /dev/null
+++ b/spec/workers/issue_rebalancing_worker_spec.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe IssueRebalancingWorker do
+ describe '#perform' do
+ let_it_be(:issue) { create(:issue) }
+
+ it 'runs an instance of IssueRebalancingService' do
+ service = double(execute: nil)
+ expect(IssueRebalancingService).to receive(:new).with(issue).and_return(service)
+
+ described_class.new.perform(nil, issue.project_id)
+ end
+
+ it 'anticipates the inability to find the issue' do
+ expect(Gitlab::ErrorTracking).to receive(:log_exception).with(ActiveRecord::RecordNotFound, include(project_id: -1))
+ expect(IssueRebalancingService).not_to receive(:new)
+
+ described_class.new.perform(nil, -1)
+ end
+
+ it 'anticipates there being too many issues' do
+ service = double
+ allow(service).to receive(:execute) { raise IssueRebalancingService::TooManyIssues }
+ expect(IssueRebalancingService).to receive(:new).with(issue).and_return(service)
+ expect(Gitlab::ErrorTracking).to receive(:log_exception).with(IssueRebalancingService::TooManyIssues, include(project_id: issue.project_id))
+
+ described_class.new.perform(nil, issue.project_id)
+ end
+
+ it 'takes no action if the value is nil' do
+ expect(IssueRebalancingService).not_to receive(:new)
+ expect(Gitlab::ErrorTracking).not_to receive(:log_exception)
+
+ described_class.new.perform(nil, nil)
+ end
+ end
+end
diff --git a/spec/workers/jira_connect/sync_branch_worker_spec.rb b/spec/workers/jira_connect/sync_branch_worker_spec.rb
new file mode 100644
index 00000000000..2da3ea9d256
--- /dev/null
+++ b/spec/workers/jira_connect/sync_branch_worker_spec.rb
@@ -0,0 +1,65 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe JiraConnect::SyncBranchWorker do
+ describe '#perform' do
+ let_it_be(:project) { create(:project, :repository) }
+ let(:project_id) { project.id }
+ let(:branch_name) { 'master' }
+ let(:commit_shas) { %w(b83d6e3 5a62481) }
+
+ subject { described_class.new.perform(project_id, branch_name, commit_shas) }
+
+ def expect_jira_sync_service_execute(args)
+ expect_next_instance_of(JiraConnect::SyncService) do |instance|
+ expect(instance).to receive(:execute).with(args)
+ end
+ end
+
+ it 'calls JiraConnect::SyncService#execute' do
+ expect_jira_sync_service_execute(
+ branches: [instance_of(Gitlab::Git::Branch)],
+ commits: project.commits_by(oids: commit_shas)
+ )
+
+ subject
+ end
+
+ context 'without branch name' do
+ let(:branch_name) { nil }
+
+ it 'calls JiraConnect::SyncService#execute' do
+ expect_jira_sync_service_execute(
+ branches: nil,
+ commits: project.commits_by(oids: commit_shas)
+ )
+
+ subject
+ end
+ end
+
+ context 'without commits' do
+ let(:commit_shas) { nil }
+
+ it 'calls JiraConnect::SyncService#execute' do
+ expect_jira_sync_service_execute(
+ branches: [instance_of(Gitlab::Git::Branch)],
+ commits: nil
+ )
+
+ subject
+ end
+ end
+
+ context 'when project no longer exists' do
+ let(:project_id) { non_existing_record_id }
+
+ it 'does not call JiraConnect::SyncService' do
+ expect(JiraConnect::SyncService).not_to receive(:new)
+
+ subject
+ end
+ end
+ end
+end
diff --git a/spec/workers/jira_connect/sync_merge_request_worker_spec.rb b/spec/workers/jira_connect/sync_merge_request_worker_spec.rb
new file mode 100644
index 00000000000..764201e750a
--- /dev/null
+++ b/spec/workers/jira_connect/sync_merge_request_worker_spec.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe JiraConnect::SyncMergeRequestWorker do
+ describe '#perform' do
+ let(:merge_request) { create(:merge_request) }
+ let(:merge_request_id) { merge_request.id }
+
+ subject { described_class.new.perform(merge_request_id) }
+
+ it 'calls JiraConnect::SyncService#execute' do
+ expect_next_instance_of(JiraConnect::SyncService) do |service|
+ expect(service).to receive(:execute).with(merge_requests: [merge_request])
+ end
+
+ subject
+ end
+
+ context 'when MR no longer exists' do
+ let(:merge_request_id) { non_existing_record_id }
+
+ it 'does not call JiraConnect::SyncService' do
+ expect(JiraConnect::SyncService).not_to receive(:new)
+
+ subject
+ end
+ end
+ end
+end
diff --git a/spec/workers/merge_request_cleanup_refs_worker_spec.rb b/spec/workers/merge_request_cleanup_refs_worker_spec.rb
new file mode 100644
index 00000000000..88d7322536b
--- /dev/null
+++ b/spec/workers/merge_request_cleanup_refs_worker_spec.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe MergeRequestCleanupRefsWorker do
+ describe '#perform' do
+ context 'when merge request exists' do
+ let(:merge_request) { create(:merge_request) }
+ let(:job_args) { merge_request.id }
+
+ include_examples 'an idempotent worker' do
+ it 'calls MergeRequests::CleanupRefsService#execute' do
+ expect_next_instance_of(MergeRequests::CleanupRefsService, merge_request) do |svc|
+ expect(svc).to receive(:execute).and_call_original
+ end.twice
+
+ subject
+ end
+ end
+ end
+
+ context 'when merge request does not exist' do
+ it 'does not call MergeRequests::CleanupRefsService' do
+ expect(MergeRequests::CleanupRefsService).not_to receive(:new)
+
+ perform_multiple(1)
+ end
+ end
+ end
+end
diff --git a/spec/workers/new_issue_worker_spec.rb b/spec/workers/new_issue_worker_spec.rb
index 6386af8d253..7cba3487603 100644
--- a/spec/workers/new_issue_worker_spec.rb
+++ b/spec/workers/new_issue_worker_spec.rb
@@ -11,13 +11,13 @@ RSpec.describe NewIssueWorker do
expect(EventCreateService).not_to receive(:new)
expect(NotificationService).not_to receive(:new)
- worker.perform(99, create(:user).id)
+ worker.perform(non_existing_record_id, create(:user).id)
end
it 'logs an error' do
- expect(Rails.logger).to receive(:error).with('NewIssueWorker: couldn\'t find Issue with ID=99, skipping job')
+ expect(Gitlab::AppLogger).to receive(:error).with("NewIssueWorker: couldn't find Issue with ID=#{non_existing_record_id}, skipping job")
- worker.perform(99, create(:user).id)
+ worker.perform(non_existing_record_id, create(:user).id)
end
end
@@ -26,23 +26,23 @@ RSpec.describe NewIssueWorker do
expect(EventCreateService).not_to receive(:new)
expect(NotificationService).not_to receive(:new)
- worker.perform(create(:issue).id, 99)
+ worker.perform(create(:issue).id, non_existing_record_id)
end
it 'logs an error' do
issue = create(:issue)
- expect(Rails.logger).to receive(:error).with('NewIssueWorker: couldn\'t find User with ID=99, skipping job')
+ expect(Gitlab::AppLogger).to receive(:error).with("NewIssueWorker: couldn't find User with ID=#{non_existing_record_id}, skipping job")
- worker.perform(issue.id, 99)
+ worker.perform(issue.id, non_existing_record_id)
end
end
context 'when everything is ok' do
- let(:project) { create(:project, :public) }
- let(:mentioned) { create(:user) }
- let(:user) { create(:user) }
- let(:issue) { create(:issue, project: project, description: "issue for #{mentioned.to_reference}") }
+ let_it_be(:user) { create_default(:user) }
+ let_it_be(:project) { create(:project, :public) }
+ let_it_be(:mentioned) { create(:user) }
+ let_it_be(:issue) { create(:issue, project: project, description: "issue for #{mentioned.to_reference}") }
it 'creates a new event record' do
expect { worker.perform(issue.id, user.id) }.to change { Event.count }.from(0).to(1)
@@ -50,7 +50,7 @@ RSpec.describe NewIssueWorker do
it 'creates a notification for the mentioned user' do
expect(Notify).to receive(:new_issue_email).with(mentioned.id, issue.id, NotificationReason::MENTIONED)
- .and_return(double(deliver_later: true))
+ .and_return(double(deliver_later: true))
worker.perform(issue.id, user.id)
end
diff --git a/spec/workers/new_merge_request_worker_spec.rb b/spec/workers/new_merge_request_worker_spec.rb
index 37449540db5..310fde4c7e1 100644
--- a/spec/workers/new_merge_request_worker_spec.rb
+++ b/spec/workers/new_merge_request_worker_spec.rb
@@ -11,15 +11,15 @@ RSpec.describe NewMergeRequestWorker do
expect(EventCreateService).not_to receive(:new)
expect(NotificationService).not_to receive(:new)
- worker.perform(99, create(:user).id)
+ worker.perform(non_existing_record_id, create(:user).id)
end
it 'logs an error' do
user = create(:user)
- expect(Rails.logger).to receive(:error).with('NewMergeRequestWorker: couldn\'t find MergeRequest with ID=99, skipping job')
+ expect(Gitlab::AppLogger).to receive(:error).with("NewMergeRequestWorker: couldn't find MergeRequest with ID=#{non_existing_record_id}, skipping job")
- worker.perform(99, user.id)
+ worker.perform(non_existing_record_id, user.id)
end
end
@@ -28,15 +28,15 @@ RSpec.describe NewMergeRequestWorker do
expect(EventCreateService).not_to receive(:new)
expect(NotificationService).not_to receive(:new)
- worker.perform(create(:merge_request).id, 99)
+ worker.perform(create(:merge_request).id, non_existing_record_id)
end
it 'logs an error' do
merge_request = create(:merge_request)
- expect(Rails.logger).to receive(:error).with('NewMergeRequestWorker: couldn\'t find User with ID=99, skipping job')
+ expect(Gitlab::AppLogger).to receive(:error).with("NewMergeRequestWorker: couldn't find User with ID=#{non_existing_record_id}, skipping job")
- worker.perform(merge_request.id, 99)
+ worker.perform(merge_request.id, non_existing_record_id)
end
end
@@ -54,8 +54,8 @@ RSpec.describe NewMergeRequestWorker do
it 'creates a notification for the mentioned user' do
expect(Notify).to receive(:new_merge_request_email)
- .with(mentioned.id, merge_request.id, NotificationReason::MENTIONED)
- .and_return(double(deliver_later: true))
+ .with(mentioned.id, merge_request.id, NotificationReason::MENTIONED)
+ .and_return(double(deliver_later: true))
worker.perform(merge_request.id, user.id)
end
diff --git a/spec/workers/new_note_worker_spec.rb b/spec/workers/new_note_worker_spec.rb
index 21f10fa5bfb..86b6d041e5c 100644
--- a/spec/workers/new_note_worker_spec.rb
+++ b/spec/workers/new_note_worker_spec.rb
@@ -50,10 +50,16 @@ RSpec.describe NewNoteWorker do
end
end
- context 'when note is with review' do
- it 'does not create a new note notification' do
- note = create(:note, :with_review)
+ context 'when note does not require notification' do
+ let(:note) { create(:note) }
+
+ before do
+ allow_next_found_instance_of(Note) do |note|
+ allow(note).to receive(:skip_notification?).and_return(true)
+ end
+ end
+ it 'does not create a new note notification' do
expect_any_instance_of(NotificationService).not_to receive(:new_note)
subject.perform(note.id)
diff --git a/spec/workers/pages_remove_worker_spec.rb b/spec/workers/pages_remove_worker_spec.rb
new file mode 100644
index 00000000000..638e87043f2
--- /dev/null
+++ b/spec/workers/pages_remove_worker_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe PagesRemoveWorker do
+ let_it_be(:project) { create(:project, path: "my.project")}
+ let_it_be(:domain) { create(:pages_domain, project: project) }
+ subject { described_class.new.perform(project.id) }
+
+ it 'deletes published pages' do
+ expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project).and_return true
+ expect(PagesWorker).to receive(:perform_in).with(5.minutes, :remove, project.namespace.full_path, anything)
+
+ subject
+
+ expect(project.reload.pages_metadatum.deployed?).to be(false)
+ end
+
+ it 'deletes all domains' do
+ expect(project.pages_domains.count).to be 1
+
+ subject
+
+ expect(project.reload.pages_domains.count).to be 0
+ end
+end
diff --git a/spec/workers/pages_transfer_worker_spec.rb b/spec/workers/pages_transfer_worker_spec.rb
new file mode 100644
index 00000000000..248a3713bf6
--- /dev/null
+++ b/spec/workers/pages_transfer_worker_spec.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe PagesTransferWorker do
+ describe '#perform' do
+ Gitlab::PagesTransfer::Async::METHODS.each do |meth|
+ context "when method is #{meth}" do
+ let(:args) { [1, 2, 3] }
+
+ it 'calls the service with the given arguments' do
+ expect_next_instance_of(Gitlab::PagesTransfer) do |service|
+ expect(service).to receive(meth).with(*args).and_return(true)
+ end
+
+ subject.perform(meth, args)
+ end
+
+ it 'raises an error when the service returns false' do
+ expect_next_instance_of(Gitlab::PagesTransfer) do |service|
+ expect(service).to receive(meth).with(*args).and_return(false)
+ end
+
+ expect { subject.perform(meth, args) }
+ .to raise_error(described_class::TransferFailedError)
+ end
+ end
+ end
+
+ describe 'when method is not allowed' do
+ it 'does nothing' do
+ expect(Gitlab::PagesTransfer).not_to receive(:new)
+
+ subject.perform('object_id', [])
+ end
+ end
+ end
+end
diff --git a/spec/workers/pages_update_configuration_worker_spec.rb b/spec/workers/pages_update_configuration_worker_spec.rb
index 890b39b22a5..87bbff1a28b 100644
--- a/spec/workers/pages_update_configuration_worker_spec.rb
+++ b/spec/workers/pages_update_configuration_worker_spec.rb
@@ -17,14 +17,6 @@ RSpec.describe PagesUpdateConfigurationWorker do
subject.perform(project.id)
end
- it "raises an exception if the service returned an error" do
- allow_next_instance_of(Projects::UpdatePagesConfigurationService) do |service|
- allow(service).to receive(:execute).and_return({ exception: ":boom:" })
- end
-
- expect { subject.perform(project.id) }.to raise_error(":boom:")
- end
-
it_behaves_like "an idempotent worker" do
let(:job_args) { [project.id] }
let(:pages_dir) { Dir.mktmpdir }
diff --git a/spec/workers/partition_creation_worker_spec.rb b/spec/workers/partition_creation_worker_spec.rb
index 50ed9c901c1..37225cc1f79 100644
--- a/spec/workers/partition_creation_worker_spec.rb
+++ b/spec/workers/partition_creation_worker_spec.rb
@@ -4,16 +4,26 @@ require "spec_helper"
RSpec.describe PartitionCreationWorker do
describe '#perform' do
- let(:creator) { double(create_partitions: nil) }
+ subject { described_class.new.perform }
+
+ let(:creator) { instance_double('PartitionCreator', create_partitions: nil) }
+ let(:monitoring) { instance_double('PartitionMonitoring', report_metrics: nil) }
before do
allow(Gitlab::Database::Partitioning::PartitionCreator).to receive(:new).and_return(creator)
+ allow(Gitlab::Database::Partitioning::PartitionMonitoring).to receive(:new).and_return(monitoring)
end
it 'delegates to PartitionCreator' do
expect(creator).to receive(:create_partitions)
- described_class.new.perform
+ subject
+ end
+
+ it 'reports partition metrics' do
+ expect(monitoring).to receive(:report_metrics)
+
+ subject
end
end
end
diff --git a/spec/workers/personal_access_tokens/expired_notification_worker_spec.rb b/spec/workers/personal_access_tokens/expired_notification_worker_spec.rb
index 676a419553f..3ff67f47523 100644
--- a/spec/workers/personal_access_tokens/expired_notification_worker_spec.rb
+++ b/spec/workers/personal_access_tokens/expired_notification_worker_spec.rb
@@ -9,32 +9,16 @@ RSpec.describe PersonalAccessTokens::ExpiredNotificationWorker, type: :worker do
context 'when a token has expired' do
let(:expired_today) { create(:personal_access_token, expires_at: Date.current) }
- context 'when feature is enabled' do
- it 'uses notification service to send email to the user' do
- expect_next_instance_of(NotificationService) do |notification_service|
- expect(notification_service).to receive(:access_token_expired).with(expired_today.user)
- end
-
- worker.perform
+ it 'uses notification service to send email to the user' do
+ expect_next_instance_of(NotificationService) do |notification_service|
+ expect(notification_service).to receive(:access_token_expired).with(expired_today.user)
end
- it 'updates notified column' do
- expect { worker.perform }.to change { expired_today.reload.after_expiry_notification_delivered }.from(false).to(true)
- end
+ worker.perform
end
- context 'when feature is disabled' do
- before do
- stub_feature_flags(expired_pat_email_notification: false)
- end
-
- it 'does not update notified column' do
- expect { worker.perform }.not_to change { expired_today.reload.after_expiry_notification_delivered }
- end
-
- it 'does not trigger email' do
- expect { worker.perform }.not_to change { ActionMailer::Base.deliveries.count }
- end
+ it 'updates notified column' do
+ expect { worker.perform }.to change { expired_today.reload.after_expiry_notification_delivered }.from(false).to(true)
end
end
diff --git a/spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb b/spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb
deleted file mode 100644
index 4e7af16c63d..00000000000
--- a/spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-# NOTE: This class is unused and to be removed in 13.1~
-RSpec.describe PipelineUpdateCiRefStatusWorker do
- let(:worker) { described_class.new }
- let(:pipeline) { create(:ci_pipeline) }
-
- describe '#perform' do
- it 'updates the ci_ref status' do
- expect(Ci::UpdateCiRefStatusService).to receive(:new)
- .with(pipeline)
- .and_return(double(call: true))
-
- worker.perform(pipeline.id)
- end
- end
-end
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index f64ee4aa2f7..50d164d1705 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe PostReceive do
context 'with a non-existing project' do
let(:gl_repository) { "project-123456789" }
let(:error_message) do
- "Triggered hook for non-existing project with gl_repository \"#{gl_repository}\""
+ "Triggered hook for non-existing gl_repository \"#{gl_repository}\""
end
it "returns false and logs an error" do
@@ -314,7 +314,7 @@ RSpec.describe PostReceive do
it 'processes the changes on the master branch' do
expect_next_instance_of(Git::WikiPushService) do |service|
- expect(service).to receive(:process_changes).and_call_original
+ expect(service).to receive(:execute).and_call_original
end
expect(project.wiki).to receive(:default_branch).twice.and_return(default_branch)
expect(project.wiki.repository).to receive(:raw).and_return(raw_repo)
@@ -334,7 +334,7 @@ RSpec.describe PostReceive do
before do
allow_next_instance_of(Git::WikiPushService) do |service|
- allow(service).to receive(:process_changes)
+ allow(service).to receive(:execute)
end
end
diff --git a/spec/workers/propagate_integration_worker_spec.rb b/spec/workers/propagate_integration_worker_spec.rb
index 3fe76f14750..b8c7f2bebe7 100644
--- a/spec/workers/propagate_integration_worker_spec.rb
+++ b/spec/workers/propagate_integration_worker_spec.rb
@@ -17,8 +17,13 @@ RSpec.describe PropagateIntegrationWorker do
end
it 'calls the propagate service with the integration' do
- expect(Admin::PropagateIntegrationService).to receive(:propagate)
- .with(integration: integration, overwrite: true)
+ expect(Admin::PropagateIntegrationService).to receive(:propagate).with(integration)
+
+ subject.perform(integration.id)
+ end
+
+ it 'ignores overwrite parameter from previous version' do
+ expect(Admin::PropagateIntegrationService).to receive(:propagate).with(integration)
subject.perform(integration.id, true)
end
diff --git a/spec/workers/propagate_service_template_worker_spec.rb b/spec/workers/propagate_service_template_worker_spec.rb
index 48151b25d4b..793f0b9b08c 100644
--- a/spec/workers/propagate_service_template_worker_spec.rb
+++ b/spec/workers/propagate_service_template_worker_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe PropagateServiceTemplateWorker do
stub_exclusive_lease("propagate_service_template_worker:#{template.id}",
timeout: PropagateServiceTemplateWorker::LEASE_TIMEOUT)
- expect(Projects::PropagateServiceTemplate)
+ expect(Admin::PropagateServiceTemplate)
.to receive(:propagate)
.with(template)
diff --git a/spec/workers/remote_mirror_notification_worker_spec.rb b/spec/workers/remote_mirror_notification_worker_spec.rb
index c6fd614fdea..e415e72645c 100644
--- a/spec/workers/remote_mirror_notification_worker_spec.rb
+++ b/spec/workers/remote_mirror_notification_worker_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe RemoteMirrorNotificationWorker, :mailer do
let_it_be(:project) { create(:project, :repository, :remote_mirror) }
let_it_be(:mirror) { project.remote_mirrors.first }
- describe '#execute' do
+ describe '#perform' do
it 'calls NotificationService#remote_mirror_update_failed when the mirror exists' do
mirror.update_column(:last_error, "There was a problem fetching")
diff --git a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb
index f14c2b67f2c..21b9a7b844b 100644
--- a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb
+++ b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb
@@ -16,21 +16,21 @@ RSpec.describe RemoveUnreferencedLfsObjectsWorker do
create(:lfs_objects_project,
project: project1,
lfs_object: referenced_lfs_object1
- )
+ )
end
let!(:lfs_objects_project2_1) do
create(:lfs_objects_project,
project: project2,
lfs_object: referenced_lfs_object1
- )
+ )
end
let!(:lfs_objects_project1_2) do
create(:lfs_objects_project,
project: project1,
lfs_object: referenced_lfs_object2
- )
+ )
end
it 'removes unreferenced lfs objects' do
diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb
index 0f2d4eb4b65..9c46b1e2a87 100644
--- a/spec/workers/repository_fork_worker_spec.rb
+++ b/spec/workers/repository_fork_worker_spec.rb
@@ -87,7 +87,7 @@ RSpec.describe RepositoryForkWorker do
it 'calls Projects::LfsPointers::LfsLinkService#execute with OIDs of source project LFS objects' do
expect_fork_repository(success: true)
expect_next_instance_of(Projects::LfsPointers::LfsLinkService) do |service|
- expect(service).to receive(:execute).with(project.all_lfs_objects_oids)
+ expect(service).to receive(:execute).with(project.lfs_objects_oids)
end
perform!
diff --git a/spec/workers/repository_update_remote_mirror_worker_spec.rb b/spec/workers/repository_update_remote_mirror_worker_spec.rb
index c6e667097ec..858f5226c48 100644
--- a/spec/workers/repository_update_remote_mirror_worker_spec.rb
+++ b/spec/workers/repository_update_remote_mirror_worker_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe RepositoryUpdateRemoteMirrorWorker, :clean_gitlab_redis_shared_st
let(:scheduled_time) { Time.current - 5.minutes }
around do |example|
- Timecop.freeze(Time.current) { example.run }
+ freeze_time { example.run }
end
def expect_mirror_service_to_return(mirror, result, tries = 0)
diff --git a/spec/workers/run_pipeline_schedule_worker_spec.rb b/spec/workers/run_pipeline_schedule_worker_spec.rb
index 4999909934b..0b9f95e09fe 100644
--- a/spec/workers/run_pipeline_schedule_worker_spec.rb
+++ b/spec/workers/run_pipeline_schedule_worker_spec.rb
@@ -59,7 +59,7 @@ RSpec.describe RunPipelineScheduleWorker do
end
it 'logging a pipeline error' do
- expect(Rails.logger)
+ expect(Gitlab::AppLogger)
.to receive(:error)
.with(a_string_matching('ActiveRecord::StatementInvalid'))
.and_call_original