diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 15:19:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-20 15:19:03 +0000 |
commit | 14bd84b61276ef29b97d23642d698de769bacfd2 (patch) | |
tree | f9eba90140c1bd874211dea17750a0d422c04080 /spec/workers | |
parent | 891c388697b2db0d8ee0c8358a9bdbf6dc56d581 (diff) | |
download | gitlab-ce-14bd84b61276ef29b97d23642d698de769bacfd2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-10-stable-eev15.10.0-rc42
Diffstat (limited to 'spec/workers')
357 files changed, 899 insertions, 530 deletions
diff --git a/spec/workers/admin_email_worker_spec.rb b/spec/workers/admin_email_worker_spec.rb index 1a5cb90bc17..bedf8f0362f 100644 --- a/spec/workers/admin_email_worker_spec.rb +++ b/spec/workers/admin_email_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AdminEmailWorker do +RSpec.describe AdminEmailWorker, feature_category: :source_code_management do subject(:worker) { described_class.new } describe '.perform' do diff --git a/spec/workers/analytics/usage_trends/count_job_trigger_worker_spec.rb b/spec/workers/analytics/usage_trends/count_job_trigger_worker_spec.rb index 735e4a214a9..cdb7357c184 100644 --- a/spec/workers/analytics/usage_trends/count_job_trigger_worker_spec.rb +++ b/spec/workers/analytics/usage_trends/count_job_trigger_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Analytics::UsageTrends::CountJobTriggerWorker do +RSpec.describe Analytics::UsageTrends::CountJobTriggerWorker, feature_category: :devops_reports do it_behaves_like 'an idempotent worker' context 'triggers a job for each measurement identifiers' do diff --git a/spec/workers/analytics/usage_trends/counter_job_worker_spec.rb b/spec/workers/analytics/usage_trends/counter_job_worker_spec.rb index ee1bbafa9b5..4155e3522a7 100644 --- a/spec/workers/analytics/usage_trends/counter_job_worker_spec.rb +++ b/spec/workers/analytics/usage_trends/counter_job_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Analytics::UsageTrends::CounterJobWorker do +RSpec.describe Analytics::UsageTrends::CounterJobWorker, feature_category: :devops_reports do let_it_be(:user_1) { create(:user) } let_it_be(:user_2) { create(:user) } diff --git a/spec/workers/approve_blocked_pending_approval_users_worker_spec.rb b/spec/workers/approve_blocked_pending_approval_users_worker_spec.rb index bd603bd870d..ffcc58132db 100644 --- a/spec/workers/approve_blocked_pending_approval_users_worker_spec.rb +++ b/spec/workers/approve_blocked_pending_approval_users_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ApproveBlockedPendingApprovalUsersWorker, type: :worker do +RSpec.describe ApproveBlockedPendingApprovalUsersWorker, type: :worker, feature_category: :user_profile do let_it_be(:admin) { create(:admin) } let_it_be(:active_user) { create(:user) } let_it_be(:blocked_user) { create(:user, state: 'blocked_pending_approval') } diff --git a/spec/workers/authorized_keys_worker_spec.rb b/spec/workers/authorized_keys_worker_spec.rb index 50236f9ea7b..9fab6910441 100644 --- a/spec/workers/authorized_keys_worker_spec.rb +++ b/spec/workers/authorized_keys_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AuthorizedKeysWorker do +RSpec.describe AuthorizedKeysWorker, feature_category: :source_code_management do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb index 9d4d48d0568..77c56497ef0 100644 --- a/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb +++ b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AuthorizedProjectUpdate::PeriodicRecalculateWorker do +RSpec.describe AuthorizedProjectUpdate::PeriodicRecalculateWorker, feature_category: :source_code_management do describe '#perform' do it 'calls AuthorizedProjectUpdate::PeriodicRecalculateService' do expect_next_instance_of(AuthorizedProjectUpdate::PeriodicRecalculateService) do |service| diff --git a/spec/workers/authorized_project_update/project_recalculate_per_user_worker_spec.rb b/spec/workers/authorized_project_update/project_recalculate_per_user_worker_spec.rb index 57a0726000f..5dcb4a67ae4 100644 --- a/spec/workers/authorized_project_update/project_recalculate_per_user_worker_spec.rb +++ b/spec/workers/authorized_project_update/project_recalculate_per_user_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AuthorizedProjectUpdate::ProjectRecalculatePerUserWorker do +RSpec.describe AuthorizedProjectUpdate::ProjectRecalculatePerUserWorker, feature_category: :system_access do include ExclusiveLeaseHelpers let_it_be(:project) { create(:project) } diff --git a/spec/workers/authorized_project_update/project_recalculate_worker_spec.rb b/spec/workers/authorized_project_update/project_recalculate_worker_spec.rb index a9a15565580..7c9d2891b01 100644 --- a/spec/workers/authorized_project_update/project_recalculate_worker_spec.rb +++ b/spec/workers/authorized_project_update/project_recalculate_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AuthorizedProjectUpdate::ProjectRecalculateWorker do +RSpec.describe AuthorizedProjectUpdate::ProjectRecalculateWorker, feature_category: :system_access do include ExclusiveLeaseHelpers let_it_be(:project) { create(:project) } diff --git a/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb b/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb index da4b726c0b5..e6a312d34ce 100644 --- a/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb +++ b/spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AuthorizedProjectUpdate::UserRefreshFromReplicaWorker do +RSpec.describe AuthorizedProjectUpdate::UserRefreshFromReplicaWorker, feature_category: :system_access do let_it_be(:project) { create(:project) } let_it_be(:user) { project.namespace.owner } diff --git a/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb index 7c0c4d5bab4..081bece09e9 100644 --- a/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb +++ b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker do +RSpec.describe AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker, feature_category: :system_access do let_it_be(:project) { create(:project) } let(:user) { project.namespace.owner } diff --git a/spec/workers/authorized_project_update/user_refresh_with_low_urgency_worker_spec.rb b/spec/workers/authorized_project_update/user_refresh_with_low_urgency_worker_spec.rb index bd16eeb4712..ef6c3dd43c8 100644 --- a/spec/workers/authorized_project_update/user_refresh_with_low_urgency_worker_spec.rb +++ b/spec/workers/authorized_project_update/user_refresh_with_low_urgency_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AuthorizedProjectUpdate::UserRefreshWithLowUrgencyWorker do +RSpec.describe AuthorizedProjectUpdate::UserRefreshWithLowUrgencyWorker, feature_category: :system_access do it 'is labeled as low urgency' do expect(described_class.get_urgency).to eq(:low) end diff --git a/spec/workers/authorized_projects_worker_spec.rb b/spec/workers/authorized_projects_worker_spec.rb index fbfde77be97..ea009f06a28 100644 --- a/spec/workers/authorized_projects_worker_spec.rb +++ b/spec/workers/authorized_projects_worker_spec.rb @@ -2,6 +2,6 @@ require 'spec_helper' -RSpec.describe AuthorizedProjectsWorker do +RSpec.describe AuthorizedProjectsWorker, feature_category: :system_access do it_behaves_like "refreshes user's project authorizations" end diff --git a/spec/workers/auto_devops/disable_worker_spec.rb b/spec/workers/auto_devops/disable_worker_spec.rb index e1de97e0ce5..8f7f305b186 100644 --- a/spec/workers/auto_devops/disable_worker_spec.rb +++ b/spec/workers/auto_devops/disable_worker_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe AutoDevops::DisableWorker, '#perform' do +RSpec.describe AutoDevops::DisableWorker, '#perform', feature_category: :auto_devops do let(:user) { create(:user, developer_projects: [project]) } let(:project) { create(:project, :repository, :auto_devops) } let(:auto_devops) { project.auto_devops } diff --git a/spec/workers/auto_merge_process_worker_spec.rb b/spec/workers/auto_merge_process_worker_spec.rb index 00d27d9c2b5..550590ff6a3 100644 --- a/spec/workers/auto_merge_process_worker_spec.rb +++ b/spec/workers/auto_merge_process_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe AutoMergeProcessWorker do +RSpec.describe AutoMergeProcessWorker, feature_category: :continuous_delivery do describe '#perform' do subject { described_class.new.perform(merge_request&.id) } diff --git a/spec/workers/background_migration/ci_database_worker_spec.rb b/spec/workers/background_migration/ci_database_worker_spec.rb index 82c562c4042..1048a06bb12 100644 --- a/spec/workers/background_migration/ci_database_worker_spec.rb +++ b/spec/workers/background_migration/ci_database_worker_spec.rb @@ -2,6 +2,6 @@ require 'spec_helper' -RSpec.describe BackgroundMigration::CiDatabaseWorker, :clean_gitlab_redis_shared_state, if: Gitlab::Database.has_config?(:ci) do +RSpec.describe BackgroundMigration::CiDatabaseWorker, :clean_gitlab_redis_shared_state, if: Gitlab::Database.has_config?(:ci), feature_category: :database do it_behaves_like 'it runs background migration jobs', 'ci' end diff --git a/spec/workers/background_migration_worker_spec.rb b/spec/workers/background_migration_worker_spec.rb index 1558c3c9250..32ee6708736 100644 --- a/spec/workers/background_migration_worker_spec.rb +++ b/spec/workers/background_migration_worker_spec.rb @@ -2,6 +2,6 @@ require 'spec_helper' -RSpec.describe BackgroundMigrationWorker, :clean_gitlab_redis_shared_state do +RSpec.describe BackgroundMigrationWorker, :clean_gitlab_redis_shared_state, feature_category: :database do it_behaves_like 'it runs background migration jobs', 'main' end diff --git a/spec/workers/build_hooks_worker_spec.rb b/spec/workers/build_hooks_worker_spec.rb index 80dc36d268f..f8efc9c455d 100644 --- a/spec/workers/build_hooks_worker_spec.rb +++ b/spec/workers/build_hooks_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BuildHooksWorker do +RSpec.describe BuildHooksWorker, feature_category: :continuous_integration do describe '#perform' do context 'when build exists' do let!(:build) { create(:ci_build) } diff --git a/spec/workers/build_queue_worker_spec.rb b/spec/workers/build_queue_worker_spec.rb index 0786722e647..1f3640e7496 100644 --- a/spec/workers/build_queue_worker_spec.rb +++ b/spec/workers/build_queue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BuildQueueWorker do +RSpec.describe BuildQueueWorker, feature_category: :continuous_integration do describe '#perform' do context 'when build exists' do let!(:build) { create(:ci_build) } diff --git a/spec/workers/build_success_worker_spec.rb b/spec/workers/build_success_worker_spec.rb index 3241c931dc5..be9802eb2ce 100644 --- a/spec/workers/build_success_worker_spec.rb +++ b/spec/workers/build_success_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BuildSuccessWorker do +RSpec.describe BuildSuccessWorker, feature_category: :continuous_integration do describe '#perform' do subject { described_class.new.perform(build.id) } diff --git a/spec/workers/bulk_imports/entity_worker_spec.rb b/spec/workers/bulk_imports/entity_worker_spec.rb index 4cd37c93d5f..dada4ef63b3 100644 --- a/spec/workers/bulk_imports/entity_worker_spec.rb +++ b/spec/workers/bulk_imports/entity_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::EntityWorker do +RSpec.describe BulkImports::EntityWorker, feature_category: :importers do let_it_be(:entity) { create(:bulk_import_entity) } let_it_be(:pipeline_tracker) do diff --git a/spec/workers/bulk_imports/relation_export_worker_spec.rb b/spec/workers/bulk_imports/relation_export_worker_spec.rb index 63f1992d186..c2f7831896b 100644 --- a/spec/workers/bulk_imports/relation_export_worker_spec.rb +++ b/spec/workers/bulk_imports/relation_export_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::RelationExportWorker do +RSpec.describe BulkImports::RelationExportWorker, feature_category: :importers do let_it_be(:jid) { 'jid' } let_it_be(:relation) { 'labels' } let_it_be(:user) { create(:user) } diff --git a/spec/workers/bulk_imports/stuck_import_worker_spec.rb b/spec/workers/bulk_imports/stuck_import_worker_spec.rb index 7dfb6532c07..ba1b1b66b00 100644 --- a/spec/workers/bulk_imports/stuck_import_worker_spec.rb +++ b/spec/workers/bulk_imports/stuck_import_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::StuckImportWorker do +RSpec.describe BulkImports::StuckImportWorker, feature_category: :importers do let_it_be(:created_bulk_import) { create(:bulk_import, :created) } let_it_be(:started_bulk_import) { create(:bulk_import, :started) } let_it_be(:stale_created_bulk_import) { create(:bulk_import, :created, created_at: 3.days.ago) } diff --git a/spec/workers/chat_notification_worker_spec.rb b/spec/workers/chat_notification_worker_spec.rb index a20a136d197..a9413a94e4b 100644 --- a/spec/workers/chat_notification_worker_spec.rb +++ b/spec/workers/chat_notification_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ChatNotificationWorker do +RSpec.describe ChatNotificationWorker, feature_category: :integrations do let(:worker) { described_class.new } let(:chat_build) do create(:ci_build, pipeline: create(:ci_pipeline, source: :chat)) diff --git a/spec/workers/ci/archive_trace_worker_spec.rb b/spec/workers/ci/archive_trace_worker_spec.rb index 3ac769aab9e..056093f01b4 100644 --- a/spec/workers/ci/archive_trace_worker_spec.rb +++ b/spec/workers/ci/archive_trace_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::ArchiveTraceWorker do +RSpec.describe Ci::ArchiveTraceWorker, feature_category: :continuous_integration do describe '#perform' do subject { described_class.new.perform(job&.id) } diff --git a/spec/workers/ci/archive_traces_cron_worker_spec.rb b/spec/workers/ci/archive_traces_cron_worker_spec.rb index 0c1010960a1..1eb88258c62 100644 --- a/spec/workers/ci/archive_traces_cron_worker_spec.rb +++ b/spec/workers/ci/archive_traces_cron_worker_spec.rb @@ -42,20 +42,6 @@ RSpec.describe Ci::ArchiveTracesCronWorker, feature_category: :continuous_integr subject end - context "with FF deduplicate_archive_traces_cron_worker false" do - before do - stub_feature_flags(deduplicate_archive_traces_cron_worker: false) - end - - it 'calls execute service' do - expect_next_instance_of(Ci::ArchiveTraceService) do |instance| - expect(instance).to receive(:execute).with(build, worker_name: "Ci::ArchiveTracesCronWorker") - end - - subject - end - end - context 'when the job finished recently' do let(:finished_at) { 1.hour.ago } diff --git a/spec/workers/ci/build_finished_worker_spec.rb b/spec/workers/ci/build_finished_worker_spec.rb index 049f3af1dd7..6da30a86b54 100644 --- a/spec/workers/ci/build_finished_worker_spec.rb +++ b/spec/workers/ci/build_finished_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::BuildFinishedWorker do +RSpec.describe Ci::BuildFinishedWorker, feature_category: :continuous_integration do include AfterNextHelpers subject { described_class.new.perform(build.id) } diff --git a/spec/workers/ci/build_prepare_worker_spec.rb b/spec/workers/ci/build_prepare_worker_spec.rb index b2c74a920ea..d3d607d8f39 100644 --- a/spec/workers/ci/build_prepare_worker_spec.rb +++ b/spec/workers/ci/build_prepare_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::BuildPrepareWorker do +RSpec.describe Ci::BuildPrepareWorker, feature_category: :continuous_integration do subject { described_class.new.perform(build_id) } context 'build exists' do diff --git a/spec/workers/ci/build_schedule_worker_spec.rb b/spec/workers/ci/build_schedule_worker_spec.rb index f8b4efc562b..f0d43ef810d 100644 --- a/spec/workers/ci/build_schedule_worker_spec.rb +++ b/spec/workers/ci/build_schedule_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::BuildScheduleWorker do +RSpec.describe Ci::BuildScheduleWorker, feature_category: :continuous_integration do subject { described_class.new.perform(build.id) } context 'when build is found' do diff --git a/spec/workers/ci/build_trace_chunk_flush_worker_spec.rb b/spec/workers/ci/build_trace_chunk_flush_worker_spec.rb index 8aac80a02be..851b8f6bc90 100644 --- a/spec/workers/ci/build_trace_chunk_flush_worker_spec.rb +++ b/spec/workers/ci/build_trace_chunk_flush_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::BuildTraceChunkFlushWorker do +RSpec.describe Ci::BuildTraceChunkFlushWorker, feature_category: :continuous_integration do let(:data) { 'x' * Ci::BuildTraceChunk::CHUNK_SIZE } let(:chunk) do diff --git a/spec/workers/ci/cancel_pipeline_worker_spec.rb b/spec/workers/ci/cancel_pipeline_worker_spec.rb index 6165aaff1c7..874273a39e1 100644 --- a/spec/workers/ci/cancel_pipeline_worker_spec.rb +++ b/spec/workers/ci/cancel_pipeline_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::CancelPipelineWorker, :aggregate_failures do +RSpec.describe Ci::CancelPipelineWorker, :aggregate_failures, feature_category: :continuous_integration do let!(:pipeline) { create(:ci_pipeline, :running) } describe '#perform' do 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 372b0de1b54..6f4bfe897a8 100644 --- a/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb +++ b/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::CreateCrossProjectPipelineWorker do +RSpec.describe Ci::CreateCrossProjectPipelineWorker, feature_category: :continuous_integration do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/workers/ci/create_downstream_pipeline_worker_spec.rb b/spec/workers/ci/create_downstream_pipeline_worker_spec.rb index b4add681e67..bb763e68504 100644 --- a/spec/workers/ci/create_downstream_pipeline_worker_spec.rb +++ b/spec/workers/ci/create_downstream_pipeline_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::CreateDownstreamPipelineWorker do +RSpec.describe Ci::CreateDownstreamPipelineWorker, feature_category: :continuous_integration do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/workers/ci/daily_build_group_report_results_worker_spec.rb b/spec/workers/ci/daily_build_group_report_results_worker_spec.rb index e13c6311e46..3d86ff6999b 100644 --- a/spec/workers/ci/daily_build_group_report_results_worker_spec.rb +++ b/spec/workers/ci/daily_build_group_report_results_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::DailyBuildGroupReportResultsWorker do +RSpec.describe Ci::DailyBuildGroupReportResultsWorker, feature_category: :code_testing do describe '#perform' do let!(:pipeline) { create(:ci_pipeline) } diff --git a/spec/workers/ci/delete_objects_worker_spec.rb b/spec/workers/ci/delete_objects_worker_spec.rb index 3d985dffdc5..808ad95531e 100644 --- a/spec/workers/ci/delete_objects_worker_spec.rb +++ b/spec/workers/ci/delete_objects_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::DeleteObjectsWorker do +RSpec.describe Ci::DeleteObjectsWorker, feature_category: :continuous_integration do let(:worker) { described_class.new } it { expect(described_class.idempotent?).to be_truthy } diff --git a/spec/workers/ci/delete_unit_tests_worker_spec.rb b/spec/workers/ci/delete_unit_tests_worker_spec.rb index ff2575b19c1..ae8fe762334 100644 --- a/spec/workers/ci/delete_unit_tests_worker_spec.rb +++ b/spec/workers/ci/delete_unit_tests_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::DeleteUnitTestsWorker do +RSpec.describe Ci::DeleteUnitTestsWorker, feature_category: :code_testing do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/ci/drop_pipeline_worker_spec.rb b/spec/workers/ci/drop_pipeline_worker_spec.rb index 5e626112520..23ae95ee53a 100644 --- a/spec/workers/ci/drop_pipeline_worker_spec.rb +++ b/spec/workers/ci/drop_pipeline_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::DropPipelineWorker do +RSpec.describe Ci::DropPipelineWorker, feature_category: :continuous_integration do include AfterNextHelpers let(:pipeline) { create(:ci_pipeline, :running) } diff --git a/spec/workers/ci/job_artifacts/expire_project_build_artifacts_worker_spec.rb b/spec/workers/ci/job_artifacts/expire_project_build_artifacts_worker_spec.rb index 0460738f3f2..9d4e5380474 100644 --- a/spec/workers/ci/job_artifacts/expire_project_build_artifacts_worker_spec.rb +++ b/spec/workers/ci/job_artifacts/expire_project_build_artifacts_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::JobArtifacts::ExpireProjectBuildArtifactsWorker do +RSpec.describe Ci::JobArtifacts::ExpireProjectBuildArtifactsWorker, feature_category: :build_artifacts do let(:worker) { described_class.new } let(:current_time) { Time.current } diff --git a/spec/workers/ci/job_artifacts/track_artifact_report_worker_spec.rb b/spec/workers/ci/job_artifacts/track_artifact_report_worker_spec.rb index 0d4b8243050..bbc2bcf9ac9 100644 --- a/spec/workers/ci/job_artifacts/track_artifact_report_worker_spec.rb +++ b/spec/workers/ci/job_artifacts/track_artifact_report_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::JobArtifacts::TrackArtifactReportWorker do +RSpec.describe Ci::JobArtifacts::TrackArtifactReportWorker, feature_category: :code_testing do describe '#perform', :clean_gitlab_redis_shared_state do let_it_be(:group) { create(:group, :private) } let_it_be(:project) { create(:project, group: group) } diff --git a/spec/workers/ci/merge_requests/add_todo_when_build_fails_worker_spec.rb b/spec/workers/ci/merge_requests/add_todo_when_build_fails_worker_spec.rb index e5de0ba0143..ec12ee845a4 100644 --- a/spec/workers/ci/merge_requests/add_todo_when_build_fails_worker_spec.rb +++ b/spec/workers/ci/merge_requests/add_todo_when_build_fails_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::MergeRequests::AddTodoWhenBuildFailsWorker do +RSpec.describe Ci::MergeRequests::AddTodoWhenBuildFailsWorker, feature_category: :code_review_workflow do describe '#perform' do let_it_be(:project) { create(:project) } let_it_be(:pipeline) { create(:ci_pipeline, :detached_merge_request_pipeline) } diff --git a/spec/workers/ci/parse_secure_file_metadata_worker_spec.rb b/spec/workers/ci/parse_secure_file_metadata_worker_spec.rb index 57bbd8a6ff0..11a01352fcc 100644 --- a/spec/workers/ci/parse_secure_file_metadata_worker_spec.rb +++ b/spec/workers/ci/parse_secure_file_metadata_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::ParseSecureFileMetadataWorker do +RSpec.describe Ci::ParseSecureFileMetadataWorker, feature_category: :mobile_devops do describe '#perform' do include_examples 'an idempotent worker' do let(:secure_file) { create(:ci_secure_file) } diff --git a/spec/workers/ci/pending_builds/update_group_worker_spec.rb b/spec/workers/ci/pending_builds/update_group_worker_spec.rb index 8c6bf018158..c16262c0502 100644 --- a/spec/workers/ci/pending_builds/update_group_worker_spec.rb +++ b/spec/workers/ci/pending_builds/update_group_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::PendingBuilds::UpdateGroupWorker do +RSpec.describe Ci::PendingBuilds::UpdateGroupWorker, feature_category: :subgroups do describe '#perform' do let(:worker) { described_class.new } diff --git a/spec/workers/ci/pending_builds/update_project_worker_spec.rb b/spec/workers/ci/pending_builds/update_project_worker_spec.rb index 4a67127564e..281b4fb920b 100644 --- a/spec/workers/ci/pending_builds/update_project_worker_spec.rb +++ b/spec/workers/ci/pending_builds/update_project_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::PendingBuilds::UpdateProjectWorker do +RSpec.describe Ci::PendingBuilds::UpdateProjectWorker, feature_category: :projects do describe '#perform' do let(:worker) { described_class.new } diff --git a/spec/workers/ci/pipeline_artifacts/coverage_report_worker_spec.rb b/spec/workers/ci/pipeline_artifacts/coverage_report_worker_spec.rb index 7b28384a5bf..b594f661a9a 100644 --- a/spec/workers/ci/pipeline_artifacts/coverage_report_worker_spec.rb +++ b/spec/workers/ci/pipeline_artifacts/coverage_report_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::PipelineArtifacts::CoverageReportWorker do +RSpec.describe Ci::PipelineArtifacts::CoverageReportWorker, feature_category: :code_testing do describe '#perform' do let(:pipeline_id) { pipeline.id } diff --git a/spec/workers/ci/pipeline_artifacts/create_quality_report_worker_spec.rb b/spec/workers/ci/pipeline_artifacts/create_quality_report_worker_spec.rb index 5096691270a..2ad1609c7c4 100644 --- a/spec/workers/ci/pipeline_artifacts/create_quality_report_worker_spec.rb +++ b/spec/workers/ci/pipeline_artifacts/create_quality_report_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::PipelineArtifacts::CreateQualityReportWorker do +RSpec.describe ::Ci::PipelineArtifacts::CreateQualityReportWorker, feature_category: :code_quality do describe '#perform' do subject { described_class.new.perform(pipeline_id) } diff --git a/spec/workers/ci/pipeline_artifacts/expire_artifacts_worker_spec.rb b/spec/workers/ci/pipeline_artifacts/expire_artifacts_worker_spec.rb index 274f848ad88..ca4fcc564fa 100644 --- a/spec/workers/ci/pipeline_artifacts/expire_artifacts_worker_spec.rb +++ b/spec/workers/ci/pipeline_artifacts/expire_artifacts_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::PipelineArtifacts::ExpireArtifactsWorker do +RSpec.describe Ci::PipelineArtifacts::ExpireArtifactsWorker, feature_category: :build_artifacts do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/ci/pipeline_bridge_status_worker_spec.rb b/spec/workers/ci/pipeline_bridge_status_worker_spec.rb index 6ec5eb0e639..4662b25a3cb 100644 --- a/spec/workers/ci/pipeline_bridge_status_worker_spec.rb +++ b/spec/workers/ci/pipeline_bridge_status_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::PipelineBridgeStatusWorker do +RSpec.describe Ci::PipelineBridgeStatusWorker, feature_category: :continuous_integration do describe '#perform' do subject { described_class.new.perform(pipeline_id) } diff --git a/spec/workers/ci/pipeline_success_unlock_artifacts_worker_spec.rb b/spec/workers/ci/pipeline_success_unlock_artifacts_worker_spec.rb index 3b33972c76f..70821f3a833 100644 --- a/spec/workers/ci/pipeline_success_unlock_artifacts_worker_spec.rb +++ b/spec/workers/ci/pipeline_success_unlock_artifacts_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::PipelineSuccessUnlockArtifactsWorker do +RSpec.describe Ci::PipelineSuccessUnlockArtifactsWorker, feature_category: :build_artifacts do describe '#perform' do subject(:perform) { described_class.new.perform(pipeline_id) } 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 f14b7f9d1d0..ede4dad1272 100644 --- a/spec/workers/ci/ref_delete_unlock_artifacts_worker_spec.rb +++ b/spec/workers/ci/ref_delete_unlock_artifacts_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::RefDeleteUnlockArtifactsWorker do +RSpec.describe Ci::RefDeleteUnlockArtifactsWorker, feature_category: :build_artifacts do describe '#perform' do subject(:perform) { worker.perform(project_id, user_id, ref) } diff --git a/spec/workers/ci/resource_groups/assign_resource_from_resource_group_worker_spec.rb b/spec/workers/ci/resource_groups/assign_resource_from_resource_group_worker_spec.rb index 785cba24f9d..e3e7047db56 100644 --- a/spec/workers/ci/resource_groups/assign_resource_from_resource_group_worker_spec.rb +++ b/spec/workers/ci/resource_groups/assign_resource_from_resource_group_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::ResourceGroups::AssignResourceFromResourceGroupWorker do +RSpec.describe Ci::ResourceGroups::AssignResourceFromResourceGroupWorker, feature_category: :continuous_delivery do let(:worker) { described_class.new } it 'has the `until_executed` deduplicate strategy' do diff --git a/spec/workers/ci/retry_pipeline_worker_spec.rb b/spec/workers/ci/retry_pipeline_worker_spec.rb index c7600a24280..f41b6b88c6f 100644 --- a/spec/workers/ci/retry_pipeline_worker_spec.rb +++ b/spec/workers/ci/retry_pipeline_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::RetryPipelineWorker do +RSpec.describe Ci::RetryPipelineWorker, feature_category: :continuous_integration do describe '#perform' do subject(:perform) { described_class.new.perform(pipeline_id, user_id) } diff --git a/spec/workers/ci/schedule_delete_objects_cron_worker_spec.rb b/spec/workers/ci/schedule_delete_objects_cron_worker_spec.rb index 142df271f90..cab282df5f2 100644 --- a/spec/workers/ci/schedule_delete_objects_cron_worker_spec.rb +++ b/spec/workers/ci/schedule_delete_objects_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::ScheduleDeleteObjectsCronWorker do +RSpec.describe Ci::ScheduleDeleteObjectsCronWorker, feature_category: :continuous_integration do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/ci/stuck_builds/drop_running_worker_spec.rb b/spec/workers/ci/stuck_builds/drop_running_worker_spec.rb index 6d3aa71fe81..6823686997f 100644 --- a/spec/workers/ci/stuck_builds/drop_running_worker_spec.rb +++ b/spec/workers/ci/stuck_builds/drop_running_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::StuckBuilds::DropRunningWorker do +RSpec.describe Ci::StuckBuilds::DropRunningWorker, feature_category: :continuous_integration do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/ci/stuck_builds/drop_scheduled_worker_spec.rb b/spec/workers/ci/stuck_builds/drop_scheduled_worker_spec.rb index 57be799d890..58b07d11d33 100644 --- a/spec/workers/ci/stuck_builds/drop_scheduled_worker_spec.rb +++ b/spec/workers/ci/stuck_builds/drop_scheduled_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::StuckBuilds::DropScheduledWorker do +RSpec.describe Ci::StuckBuilds::DropScheduledWorker, feature_category: :continuous_integration do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/ci/test_failure_history_worker_spec.rb b/spec/workers/ci/test_failure_history_worker_spec.rb index 7530077d4ad..bf8ec44ce4d 100644 --- a/spec/workers/ci/test_failure_history_worker_spec.rb +++ b/spec/workers/ci/test_failure_history_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::TestFailureHistoryWorker do +RSpec.describe ::Ci::TestFailureHistoryWorker, feature_category: :static_application_security_testing do describe '#perform' do subject(:perform) { described_class.new.perform(pipeline_id) } diff --git a/spec/workers/ci/track_failed_build_worker_spec.rb b/spec/workers/ci/track_failed_build_worker_spec.rb index 12d0e64afc5..5d12e86d844 100644 --- a/spec/workers/ci/track_failed_build_worker_spec.rb +++ b/spec/workers/ci/track_failed_build_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::TrackFailedBuildWorker do +RSpec.describe ::Ci::TrackFailedBuildWorker, feature_category: :static_application_security_testing do let_it_be(:build) { create(:ci_build, :failed, :sast_report) } let_it_be(:exit_code) { 42 } let_it_be(:failure_reason) { "script_failure" } diff --git a/spec/workers/ci/update_locked_unknown_artifacts_worker_spec.rb b/spec/workers/ci/update_locked_unknown_artifacts_worker_spec.rb index b42d135b1b6..4bb1d3561f9 100644 --- a/spec/workers/ci/update_locked_unknown_artifacts_worker_spec.rb +++ b/spec/workers/ci/update_locked_unknown_artifacts_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::UpdateLockedUnknownArtifactsWorker do +RSpec.describe Ci::UpdateLockedUnknownArtifactsWorker, feature_category: :build_artifacts do let(:worker) { described_class.new } describe '#perform' 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 index 0bb6822a0a5..ac00956e1c0 100644 --- a/spec/workers/ci_platform_metrics_update_cron_worker_spec.rb +++ b/spec/workers/ci_platform_metrics_update_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe CiPlatformMetricsUpdateCronWorker, type: :worker do +RSpec.describe CiPlatformMetricsUpdateCronWorker, type: :worker, feature_category: :continuous_integration do describe '#perform' do subject { described_class.new.perform } diff --git a/spec/workers/cleanup_container_repository_worker_spec.rb b/spec/workers/cleanup_container_repository_worker_spec.rb index 817b71c8cc6..c970c9ef842 100644 --- a/spec/workers/cleanup_container_repository_worker_spec.rb +++ b/spec/workers/cleanup_container_repository_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe CleanupContainerRepositoryWorker, :clean_gitlab_redis_shared_state do +RSpec.describe CleanupContainerRepositoryWorker, :clean_gitlab_redis_shared_state, feature_category: :container_registry do let(:repository) { create(:container_repository) } let(:project) { repository.project } let(:user) { project.first_owner } diff --git a/spec/workers/clusters/agents/delete_expired_events_worker_spec.rb b/spec/workers/clusters/agents/delete_expired_events_worker_spec.rb index 1a5ca744091..b439df4e119 100644 --- a/spec/workers/clusters/agents/delete_expired_events_worker_spec.rb +++ b/spec/workers/clusters/agents/delete_expired_events_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Clusters::Agents::DeleteExpiredEventsWorker do +RSpec.describe Clusters::Agents::DeleteExpiredEventsWorker, feature_category: :kubernetes_management do let(:agent) { create(:cluster_agent) } describe '#perform' do diff --git a/spec/workers/clusters/applications/activate_integration_worker_spec.rb b/spec/workers/clusters/applications/activate_integration_worker_spec.rb index 5163e4681fa..40a774e1818 100644 --- a/spec/workers/clusters/applications/activate_integration_worker_spec.rb +++ b/spec/workers/clusters/applications/activate_integration_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Clusters::Applications::ActivateIntegrationWorker, '#perform' do +RSpec.describe Clusters::Applications::ActivateIntegrationWorker, '#perform', feature_category: :kubernetes_management do context 'when cluster exists' do describe 'prometheus integration' do let(:integration_name) { 'prometheus' } diff --git a/spec/workers/clusters/applications/deactivate_integration_worker_spec.rb b/spec/workers/clusters/applications/deactivate_integration_worker_spec.rb index 62792a3b7d9..f02ad18c7cc 100644 --- a/spec/workers/clusters/applications/deactivate_integration_worker_spec.rb +++ b/spec/workers/clusters/applications/deactivate_integration_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Clusters::Applications::DeactivateIntegrationWorker, '#perform' do +RSpec.describe Clusters::Applications::DeactivateIntegrationWorker, '#perform', feature_category: :kubernetes_management do context 'when cluster exists' do describe 'prometheus integration' do let(:integration_name) { 'prometheus' } diff --git a/spec/workers/clusters/cleanup/project_namespace_worker_spec.rb b/spec/workers/clusters/cleanup/project_namespace_worker_spec.rb index c24ca71eb35..15fc9e8678e 100644 --- a/spec/workers/clusters/cleanup/project_namespace_worker_spec.rb +++ b/spec/workers/clusters/cleanup/project_namespace_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Clusters::Cleanup::ProjectNamespaceWorker do +RSpec.describe Clusters::Cleanup::ProjectNamespaceWorker, feature_category: :kubernetes_management do describe '#perform' do context 'when cluster.cleanup_status is cleanup_removing_project_namespaces' do let!(:cluster) { create(:cluster, :with_environments, :cleanup_removing_project_namespaces) } diff --git a/spec/workers/clusters/cleanup/service_account_worker_spec.rb b/spec/workers/clusters/cleanup/service_account_worker_spec.rb index dabc32a0ccd..0d4df795278 100644 --- a/spec/workers/clusters/cleanup/service_account_worker_spec.rb +++ b/spec/workers/clusters/cleanup/service_account_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Clusters::Cleanup::ServiceAccountWorker do +RSpec.describe Clusters::Cleanup::ServiceAccountWorker, feature_category: :kubernetes_management do describe '#perform' do let!(:cluster) { create(:cluster, :cleanup_removing_service_account) } diff --git a/spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb b/spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb index 6f70870bd09..1f5892a36da 100644 --- a/spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb +++ b/spec/workers/clusters/integrations/check_prometheus_health_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Clusters::Integrations::CheckPrometheusHealthWorker, '#perform' do +RSpec.describe Clusters::Integrations::CheckPrometheusHealthWorker, '#perform', feature_category: :incident_management do subject { described_class.new.perform } it 'triggers health service' do diff --git a/spec/workers/concerns/application_worker_spec.rb b/spec/workers/concerns/application_worker_spec.rb index 0abb029f146..e4df91adef2 100644 --- a/spec/workers/concerns/application_worker_spec.rb +++ b/spec/workers/concerns/application_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ApplicationWorker do +RSpec.describe ApplicationWorker, feature_category: :shared do # We depend on the lazy-load characteristic of rspec. If the worker is loaded # before setting up, it's likely to go wrong. Consider this catcha: # before do diff --git a/spec/workers/concerns/cluster_agent_queue_spec.rb b/spec/workers/concerns/cluster_agent_queue_spec.rb index b5189cbd8c8..c30616d04e1 100644 --- a/spec/workers/concerns/cluster_agent_queue_spec.rb +++ b/spec/workers/concerns/cluster_agent_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ClusterAgentQueue do +RSpec.describe ClusterAgentQueue, feature_category: :kubernetes_management do let(:worker) do Class.new do def self.name @@ -14,6 +14,5 @@ RSpec.describe ClusterAgentQueue do end end - it { expect(worker.queue).to eq('cluster_agent:example') } it { expect(worker.get_feature_category).to eq(:kubernetes_management) } end diff --git a/spec/workers/concerns/cluster_queue_spec.rb b/spec/workers/concerns/cluster_queue_spec.rb deleted file mode 100644 index c03ca9cea48..00000000000 --- a/spec/workers/concerns/cluster_queue_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe ClusterQueue do - let(:worker) do - Class.new do - def self.name - 'DummyWorker' - end - - include ApplicationWorker - include ClusterQueue - end - end - - it 'sets a default pipelines queue automatically' do - expect(worker.sidekiq_options['queue']) - .to eq 'gcp_cluster:dummy' - end -end diff --git a/spec/workers/concerns/cronjob_queue_spec.rb b/spec/workers/concerns/cronjob_queue_spec.rb index 0244535051f..7e00093b686 100644 --- a/spec/workers/concerns/cronjob_queue_spec.rb +++ b/spec/workers/concerns/cronjob_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe CronjobQueue do +RSpec.describe CronjobQueue, feature_category: :shared do let(:worker) do Class.new do def self.name @@ -40,10 +40,6 @@ RSpec.describe CronjobQueue do stub_const("AnotherWorker", another_worker) end - it 'sets the queue name of a worker' do - expect(worker.sidekiq_options['queue'].to_s).to eq('cronjob:dummy') - end - it 'disables retrying of failed jobs' do expect(worker.sidekiq_options['retry']).to eq(false) end diff --git a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb index 02190201986..f72caf3a8c2 100644 --- a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures do +RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures, feature_category: :importers do let(:worker) do Class.new do def self.name @@ -196,6 +196,19 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures do end context 'when the record is invalid' do + let(:exception) { ActiveRecord::RecordInvalid.new } + + before do + expect(importer_class) + .to receive(:new) + .with(instance_of(MockRepresantation), project, client) + .and_return(importer_instance) + + expect(importer_instance) + .to receive(:execute) + .and_raise(exception) + end + it 'logs an error' do expect(Gitlab::GithubImport::Logger) .to receive(:info) @@ -208,16 +221,6 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures do } ) - expect(importer_class) - .to receive(:new) - .with(instance_of(MockRepresantation), project, client) - .and_return(importer_instance) - - exception = ActiveRecord::RecordInvalid.new - expect(importer_instance) - .to receive(:execute) - .and_raise(exception) - expect(Gitlab::Import::ImportFailureService) .to receive(:track) .with( @@ -230,6 +233,15 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures do worker.import(project, client, { 'number' => 10, 'github_id' => 1 }) end + + it 'updates external_identifiers of the correct failure' do + worker.import(project, client, { 'number' => 10, 'github_id' => 1 }) + + import_failures = project.import_failures + + expect(import_failures.count).to eq(1) + expect(import_failures.first.external_identifiers).to eq(github_identifiers.with_indifferent_access) + end end end @@ -240,4 +252,56 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures do expect(worker).to be_increment_object_counter(issue) end end + + describe '.sidekiq_retries_exhausted' do + let(:correlation_id) { 'abc' } + let(:job) do + { + 'args' => [project.id, { number: 123, state: 'open' }, '123abc'], + 'jid' => '123', + 'correlation_id' => correlation_id + } + end + + subject(:sidekiq_retries_exhausted) { worker.class.sidekiq_retries_exhausted_block.call(job, StandardError.new) } + + context 'when all arguments are given' do + it 'notifies the JobWaiter' do + expect(Gitlab::JobWaiter) + .to receive(:notify) + .with( + job['args'].last, + job['jid'] + ) + + sidekiq_retries_exhausted + end + end + + context 'when not all arguments are given' do + let(:job) do + { + 'args' => [project.id, { number: 123, state: 'open' }], + 'jid' => '123', + 'correlation_id' => correlation_id + } + end + + it 'does not notify the JobWaiter' do + expect(Gitlab::JobWaiter).not_to receive(:notify) + + sidekiq_retries_exhausted + end + end + + it 'updates external_identifiers of the correct failure' do + failure_1, failure_2 = create_list(:import_failure, 2, project: project) + failure_2.update_column(:correlation_id_value, correlation_id) + + sidekiq_retries_exhausted + + expect(failure_1.reload.external_identifiers).to be_empty + expect(failure_2.reload.external_identifiers).to eq(github_identifiers.with_indifferent_access) + end + end end diff --git a/spec/workers/concerns/gitlab/github_import/queue_spec.rb b/spec/workers/concerns/gitlab/github_import/queue_spec.rb deleted file mode 100644 index beca221b593..00000000000 --- a/spec/workers/concerns/gitlab/github_import/queue_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::GithubImport::Queue do - it 'sets the Sidekiq options for the worker' do - worker = Class.new do - def self.name - 'DummyWorker' - end - - include ApplicationWorker - include Gitlab::GithubImport::Queue - end - - expect(worker.sidekiq_options['queue']).to eq('github_importer:dummy') - end -end diff --git a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb index 8727756ce50..f7ba368f312 100644 --- a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ReschedulingMethods do +RSpec.describe Gitlab::GithubImport::ReschedulingMethods, feature_category: :importers do let(:worker) do Class.new { include(Gitlab::GithubImport::ReschedulingMethods) }.new end diff --git a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb index 0ac1733781a..ce9a9db5dd9 100644 --- a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::StageMethods do +RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers do let_it_be(:project) { create(:project, :import_started, import_url: 'https://t0ken@github.com/repo/repo.git') } let_it_be(:project2) { create(:project, :import_canceled) } diff --git a/spec/workers/concerns/gitlab/notify_upon_death_spec.rb b/spec/workers/concerns/gitlab/notify_upon_death_spec.rb index dd0a1cadc9c..36faf3ee296 100644 --- a/spec/workers/concerns/gitlab/notify_upon_death_spec.rb +++ b/spec/workers/concerns/gitlab/notify_upon_death_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::NotifyUponDeath do +RSpec.describe Gitlab::NotifyUponDeath, feature_category: :shared do let(:worker_class) do Class.new do include Sidekiq::Worker diff --git a/spec/workers/concerns/limited_capacity/job_tracker_spec.rb b/spec/workers/concerns/limited_capacity/job_tracker_spec.rb index 0e3fa350fcd..20635d1a045 100644 --- a/spec/workers/concerns/limited_capacity/job_tracker_spec.rb +++ b/spec/workers/concerns/limited_capacity/job_tracker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe LimitedCapacity::JobTracker, :clean_gitlab_redis_shared_state do +RSpec.describe LimitedCapacity::JobTracker, :clean_gitlab_redis_shared_state, feature_category: :shared do let(:job_tracker) do described_class.new('namespace') end diff --git a/spec/workers/concerns/limited_capacity/worker_spec.rb b/spec/workers/concerns/limited_capacity/worker_spec.rb index 790b5c3544d..65906eef0fa 100644 --- a/spec/workers/concerns/limited_capacity/worker_spec.rb +++ b/spec/workers/concerns/limited_capacity/worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe LimitedCapacity::Worker, :clean_gitlab_redis_queues, :aggregate_failures do +RSpec.describe LimitedCapacity::Worker, :clean_gitlab_redis_queues, :aggregate_failures, feature_category: :shared do let(:worker_class) do Class.new do def self.name diff --git a/spec/workers/concerns/packages/cleanup_artifact_worker_spec.rb b/spec/workers/concerns/packages/cleanup_artifact_worker_spec.rb index 95962d4810e..daecda8c92e 100644 --- a/spec/workers/concerns/packages/cleanup_artifact_worker_spec.rb +++ b/spec/workers/concerns/packages/cleanup_artifact_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Packages::CleanupArtifactWorker do +RSpec.describe ::Packages::CleanupArtifactWorker, feature_category: :build_artifacts do let_it_be(:worker_class) do Class.new do def self.name diff --git a/spec/workers/concerns/pipeline_background_queue_spec.rb b/spec/workers/concerns/pipeline_background_queue_spec.rb deleted file mode 100644 index 77c7e7440c5..00000000000 --- a/spec/workers/concerns/pipeline_background_queue_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe PipelineBackgroundQueue do - let(:worker) do - Class.new do - def self.name - 'DummyWorker' - end - - include ApplicationWorker - include PipelineBackgroundQueue - end - end - - it 'sets a default object storage queue automatically' do - expect(worker.sidekiq_options['queue']) - .to eq 'pipeline_background:dummy' - end -end diff --git a/spec/workers/concerns/pipeline_queue_spec.rb b/spec/workers/concerns/pipeline_queue_spec.rb deleted file mode 100644 index 6c1ac2052e4..00000000000 --- a/spec/workers/concerns/pipeline_queue_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe PipelineQueue do - let(:worker) do - Class.new do - def self.name - 'DummyWorker' - end - - include ApplicationWorker - include PipelineQueue - end - end - - it 'sets a default pipelines queue automatically' do - expect(worker.sidekiq_options['queue']) - .to eq 'pipeline_default:dummy' - end -end diff --git a/spec/workers/concerns/project_import_options_spec.rb b/spec/workers/concerns/project_import_options_spec.rb index 85a26ddb0cb..51d7f9fdea4 100644 --- a/spec/workers/concerns/project_import_options_spec.rb +++ b/spec/workers/concerns/project_import_options_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ProjectImportOptions do +RSpec.describe ProjectImportOptions, feature_category: :importers do let(:project) { create(:project, :import_started) } let(:job) { { 'args' => [project.id, nil, nil], 'jid' => '123' } } let(:worker_class) do diff --git a/spec/workers/concerns/reenqueuer_spec.rb b/spec/workers/concerns/reenqueuer_spec.rb index e7287b55af2..42873578014 100644 --- a/spec/workers/concerns/reenqueuer_spec.rb +++ b/spec/workers/concerns/reenqueuer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Reenqueuer do +RSpec.describe Reenqueuer, feature_category: :shared do include ExclusiveLeaseHelpers let_it_be(:worker_class) do diff --git a/spec/workers/concerns/repository_check_queue_spec.rb b/spec/workers/concerns/repository_check_queue_spec.rb index ae377c09b37..12082e2dff5 100644 --- a/spec/workers/concerns/repository_check_queue_spec.rb +++ b/spec/workers/concerns/repository_check_queue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RepositoryCheckQueue do +RSpec.describe RepositoryCheckQueue, feature_category: :source_code_management do let(:worker) do Class.new do def self.name @@ -14,10 +14,6 @@ RSpec.describe RepositoryCheckQueue do end end - it 'sets the queue name of a worker' do - expect(worker.sidekiq_options['queue'].to_s).to eq('repository_check:dummy') - end - it 'disables retrying of failed jobs' do expect(worker.sidekiq_options['retry']).to eq(false) end diff --git a/spec/workers/concerns/waitable_worker_spec.rb b/spec/workers/concerns/waitable_worker_spec.rb index 737424ffd8c..9cb34bbbab9 100644 --- a/spec/workers/concerns/waitable_worker_spec.rb +++ b/spec/workers/concerns/waitable_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WaitableWorker do +RSpec.describe WaitableWorker, feature_category: :shared do let(:worker) do Class.new do def self.name diff --git a/spec/workers/concerns/worker_attributes_spec.rb b/spec/workers/concerns/worker_attributes_spec.rb index 5e8f68923fd..ac9d3fa824e 100644 --- a/spec/workers/concerns/worker_attributes_spec.rb +++ b/spec/workers/concerns/worker_attributes_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WorkerAttributes do +RSpec.describe WorkerAttributes, feature_category: :shared do using RSpec::Parameterized::TableSyntax let(:worker) do diff --git a/spec/workers/concerns/worker_context_spec.rb b/spec/workers/concerns/worker_context_spec.rb index 80b427b2b42..0bbe14842bb 100644 --- a/spec/workers/concerns/worker_context_spec.rb +++ b/spec/workers/concerns/worker_context_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WorkerContext do +RSpec.describe WorkerContext, feature_category: :shared do let(:worker) do Class.new do def self.name diff --git a/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb b/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb index 8eda943f36e..8dae859b168 100644 --- a/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb +++ b/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do +RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker, feature_category: :container_registry do using RSpec::Parameterized::TableSyntax let_it_be(:repository, refind: true) { create(:container_repository, :cleanup_scheduled, expiration_policy_started_at: 1.month.ago) } @@ -348,16 +348,18 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do subject { worker.send(:container_repository) } - if params[:expected_selected_repository] == :none - it 'does not select any repository' do + it 'selects the correct repository', :freeze_time do + case expected_selected_repository + when :none expect(subject).to eq(nil) + next + when :repository + expect(subject).to eq(repository) + when :other_repository + expect(subject).to eq(other_repository) end - else - it 'does select a repository' do - selected_repository = expected_selected_repository == :repository ? repository : other_repository - - expect(subject).to eq(selected_repository) - end + expect(subject).to be_cleanup_ongoing + expect(subject.expiration_policy_started_at).to eq(Time.zone.now) end def update_container_repository(container_repository, cleanup_status, policy_status) @@ -511,6 +513,16 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do subject end end + + context 'with a stuck container repository' do + before do + repository.cleanup_ongoing! + repository.update_column(:expiration_policy_started_at, nil) + policy.update_column(:next_run_at, 5.minutes.ago) + end + + it { is_expected.to eq(0) } + end end describe '#max_running_jobs' do diff --git a/spec/workers/container_expiration_policy_worker_spec.rb b/spec/workers/container_expiration_policy_worker_spec.rb index ef6266aeba3..fcb43b86084 100644 --- a/spec/workers/container_expiration_policy_worker_spec.rb +++ b/spec/workers/container_expiration_policy_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ContainerExpirationPolicyWorker do +RSpec.describe ContainerExpirationPolicyWorker, feature_category: :container_registry do include ExclusiveLeaseHelpers let(:worker) { described_class.new } @@ -33,15 +33,17 @@ RSpec.describe ContainerExpirationPolicyWorker do end context 'process stale ongoing cleanups' do - let_it_be(:stuck_cleanup) { create(:container_repository, :cleanup_ongoing, expiration_policy_started_at: 1.day.ago) } + let_it_be(:stuck_cleanup1) { create(:container_repository, :cleanup_ongoing, expiration_policy_started_at: 1.day.ago) } + let_it_be(:stuck_cleanup2) { create(:container_repository, :cleanup_ongoing, expiration_policy_started_at: nil) } let_it_be(:container_repository1) { create(:container_repository, :cleanup_scheduled) } let_it_be(:container_repository2) { create(:container_repository, :cleanup_unfinished) } it 'set them as unfinished' do expect { subject } - .to change { ContainerRepository.cleanup_ongoing.count }.from(1).to(0) - .and change { ContainerRepository.cleanup_unfinished.count }.from(1).to(2) - expect(stuck_cleanup.reload).to be_cleanup_unfinished + .to change { ContainerRepository.cleanup_ongoing.count }.from(2).to(0) + .and change { ContainerRepository.cleanup_unfinished.count }.from(1).to(3) + expect(stuck_cleanup1.reload).to be_cleanup_unfinished + expect(stuck_cleanup2.reload).to be_cleanup_unfinished end end diff --git a/spec/workers/container_registry/cleanup_worker_spec.rb b/spec/workers/container_registry/cleanup_worker_spec.rb index a510b660412..72e1243ccb5 100644 --- a/spec/workers/container_registry/cleanup_worker_spec.rb +++ b/spec/workers/container_registry/cleanup_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ContainerRegistry::CleanupWorker, :aggregate_failures do +RSpec.describe ContainerRegistry::CleanupWorker, :aggregate_failures, feature_category: :container_registry do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/container_registry/delete_container_repository_worker_spec.rb b/spec/workers/container_registry/delete_container_repository_worker_spec.rb index 381e0cc164c..8bab0133d55 100644 --- a/spec/workers/container_registry/delete_container_repository_worker_spec.rb +++ b/spec/workers/container_registry/delete_container_repository_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ContainerRegistry::DeleteContainerRepositoryWorker, :aggregate_failures do +RSpec.describe ContainerRegistry::DeleteContainerRepositoryWorker, :aggregate_failures, feature_category: :container_registry do let_it_be_with_reload(:container_repository) { create(:container_repository) } let_it_be(:second_container_repository) { create(:container_repository) } diff --git a/spec/workers/container_registry/migration/enqueuer_worker_spec.rb b/spec/workers/container_registry/migration/enqueuer_worker_spec.rb index c2381c0ced7..4a603e538ef 100644 --- a/spec/workers/container_registry/migration/enqueuer_worker_spec.rb +++ b/spec/workers/container_registry/migration/enqueuer_worker_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures, :clean_gitlab_redis_shared_state do +RSpec.describe ContainerRegistry::Migration::EnqueuerWorker, :aggregate_failures, :clean_gitlab_redis_shared_state, + feature_category: :container_registry do using RSpec::Parameterized::TableSyntax include ExclusiveLeaseHelpers diff --git a/spec/workers/container_registry/migration/guard_worker_spec.rb b/spec/workers/container_registry/migration/guard_worker_spec.rb index 4ad2d5c300c..40ade93ab0d 100644 --- a/spec/workers/container_registry/migration/guard_worker_spec.rb +++ b/spec/workers/container_registry/migration/guard_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ContainerRegistry::Migration::GuardWorker, :aggregate_failures do +RSpec.describe ContainerRegistry::Migration::GuardWorker, :aggregate_failures, feature_category: :container_registry do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/container_registry/migration/observer_worker_spec.rb b/spec/workers/container_registry/migration/observer_worker_spec.rb index fec6640d7ec..7bf3d90d9d3 100644 --- a/spec/workers/container_registry/migration/observer_worker_spec.rb +++ b/spec/workers/container_registry/migration/observer_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ContainerRegistry::Migration::ObserverWorker, :aggregate_failures do +RSpec.describe ContainerRegistry::Migration::ObserverWorker, :aggregate_failures, feature_category: :container_registry do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/counters/cleanup_refresh_worker_spec.rb b/spec/workers/counters/cleanup_refresh_worker_spec.rb index a56c98f72a0..a18f78f1706 100644 --- a/spec/workers/counters/cleanup_refresh_worker_spec.rb +++ b/spec/workers/counters/cleanup_refresh_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Counters::CleanupRefreshWorker do +RSpec.describe Counters::CleanupRefreshWorker, feature_category: :shared do let(:model) { create(:project_statistics) } describe '#perform', :redis do diff --git a/spec/workers/create_commit_signature_worker_spec.rb b/spec/workers/create_commit_signature_worker_spec.rb index 9d3c63efc8a..722632b6796 100644 --- a/spec/workers/create_commit_signature_worker_spec.rb +++ b/spec/workers/create_commit_signature_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe CreateCommitSignatureWorker do +RSpec.describe CreateCommitSignatureWorker, feature_category: :source_code_management do let(:project) { create(:project, :repository) } let(:commits) { project.repository.commits('HEAD', limit: 3).commits } let(:commit_shas) { commits.map(&:id) } diff --git a/spec/workers/create_note_diff_file_worker_spec.rb b/spec/workers/create_note_diff_file_worker_spec.rb index 6d1d6d93e44..6e4a5e3ab6a 100644 --- a/spec/workers/create_note_diff_file_worker_spec.rb +++ b/spec/workers/create_note_diff_file_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe CreateNoteDiffFileWorker do +RSpec.describe CreateNoteDiffFileWorker, feature_category: :code_review_workflow do describe '#perform' do let(:diff_note) { create(:diff_note_on_merge_request) } diff --git a/spec/workers/create_pipeline_worker_spec.rb b/spec/workers/create_pipeline_worker_spec.rb index da85d700429..23a2dc075a7 100644 --- a/spec/workers/create_pipeline_worker_spec.rb +++ b/spec/workers/create_pipeline_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe CreatePipelineWorker do +RSpec.describe CreatePipelineWorker, feature_category: :continuous_integration do describe '#perform' do let(:worker) { described_class.new } diff --git a/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb b/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb index dfe7a266be2..91ba6e5a20a 100644 --- a/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb +++ b/spec/workers/database/batched_background_migration/ci_database_worker_spec.rb @@ -2,6 +2,6 @@ require 'spec_helper' -RSpec.describe Database::BatchedBackgroundMigration::CiDatabaseWorker, :clean_gitlab_redis_shared_state do +RSpec.describe Database::BatchedBackgroundMigration::CiDatabaseWorker, :clean_gitlab_redis_shared_state, feature_category: :database do it_behaves_like 'it runs batched background migration jobs', :ci, :ci_builds end diff --git a/spec/workers/database/batched_background_migration_worker_spec.rb b/spec/workers/database/batched_background_migration_worker_spec.rb index e57bd7581c2..a6825c5ca76 100644 --- a/spec/workers/database/batched_background_migration_worker_spec.rb +++ b/spec/workers/database/batched_background_migration_worker_spec.rb @@ -2,6 +2,6 @@ require 'spec_helper' -RSpec.describe Database::BatchedBackgroundMigrationWorker do +RSpec.describe Database::BatchedBackgroundMigrationWorker, feature_category: :database do it_behaves_like 'it runs batched background migration jobs', :main, :events end diff --git a/spec/workers/database/ci_namespace_mirrors_consistency_check_worker_spec.rb b/spec/workers/database/ci_namespace_mirrors_consistency_check_worker_spec.rb index 1c083d1d8a3..6b6723a468f 100644 --- a/spec/workers/database/ci_namespace_mirrors_consistency_check_worker_spec.rb +++ b/spec/workers/database/ci_namespace_mirrors_consistency_check_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Database::CiNamespaceMirrorsConsistencyCheckWorker do +RSpec.describe Database::CiNamespaceMirrorsConsistencyCheckWorker, feature_category: :pods do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/database/ci_project_mirrors_consistency_check_worker_spec.rb b/spec/workers/database/ci_project_mirrors_consistency_check_worker_spec.rb index 8c839410ccd..613d40b57d8 100644 --- a/spec/workers/database/ci_project_mirrors_consistency_check_worker_spec.rb +++ b/spec/workers/database/ci_project_mirrors_consistency_check_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Database::CiProjectMirrorsConsistencyCheckWorker do +RSpec.describe Database::CiProjectMirrorsConsistencyCheckWorker, feature_category: :pods do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/database/drop_detached_partitions_worker_spec.rb b/spec/workers/database/drop_detached_partitions_worker_spec.rb index a10fcaaa5d9..2ab77e71070 100644 --- a/spec/workers/database/drop_detached_partitions_worker_spec.rb +++ b/spec/workers/database/drop_detached_partitions_worker_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe Database::DropDetachedPartitionsWorker do +RSpec.describe Database::DropDetachedPartitionsWorker, feature_category: :database do describe '#perform' do subject { described_class.new.perform } diff --git a/spec/workers/database/partition_management_worker_spec.rb b/spec/workers/database/partition_management_worker_spec.rb index e5362e95f48..203181ef28d 100644 --- a/spec/workers/database/partition_management_worker_spec.rb +++ b/spec/workers/database/partition_management_worker_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe Database::PartitionManagementWorker do +RSpec.describe Database::PartitionManagementWorker, feature_category: :database do describe '#perform' do subject { described_class.new.perform } diff --git a/spec/workers/delete_container_repository_worker_spec.rb b/spec/workers/delete_container_repository_worker_spec.rb index 6ad131b4c14..6260bea6949 100644 --- a/spec/workers/delete_container_repository_worker_spec.rb +++ b/spec/workers/delete_container_repository_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DeleteContainerRepositoryWorker do +RSpec.describe DeleteContainerRepositoryWorker, feature_category: :container_registry do let_it_be(:repository) { create(:container_repository) } let(:project) { repository.project } diff --git a/spec/workers/delete_diff_files_worker_spec.rb b/spec/workers/delete_diff_files_worker_spec.rb index c124847ca45..1f1b00e324e 100644 --- a/spec/workers/delete_diff_files_worker_spec.rb +++ b/spec/workers/delete_diff_files_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DeleteDiffFilesWorker do +RSpec.describe DeleteDiffFilesWorker, feature_category: :code_review_workflow do describe '#perform' do let(:merge_request) { create(:merge_request) } let(:merge_request_diff) { merge_request.merge_request_diff } diff --git a/spec/workers/delete_merged_branches_worker_spec.rb b/spec/workers/delete_merged_branches_worker_spec.rb index 056fcb1200d..f3b6dccad2e 100644 --- a/spec/workers/delete_merged_branches_worker_spec.rb +++ b/spec/workers/delete_merged_branches_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DeleteMergedBranchesWorker do +RSpec.describe DeleteMergedBranchesWorker, feature_category: :source_code_management do subject(:worker) { described_class.new } let(:project) { create(:project, :repository) } diff --git a/spec/workers/delete_user_worker_spec.rb b/spec/workers/delete_user_worker_spec.rb index 4046b670640..05c2b0e7930 100644 --- a/spec/workers/delete_user_worker_spec.rb +++ b/spec/workers/delete_user_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DeleteUserWorker do +RSpec.describe DeleteUserWorker, feature_category: :user_management do let!(:user) { create(:user) } let!(:current_user) { create(:user) } diff --git a/spec/workers/dependency_proxy/cleanup_blob_worker_spec.rb b/spec/workers/dependency_proxy/cleanup_blob_worker_spec.rb index b67a56cca7b..9ef5fd9ec93 100644 --- a/spec/workers/dependency_proxy/cleanup_blob_worker_spec.rb +++ b/spec/workers/dependency_proxy/cleanup_blob_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DependencyProxy::CleanupBlobWorker do +RSpec.describe DependencyProxy::CleanupBlobWorker, feature_category: :dependency_proxy do let_it_be(:factory_type) { :dependency_proxy_blob } it_behaves_like 'dependency_proxy_cleanup_worker' diff --git a/spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb b/spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb index 1100f9a7fae..3040189d1c8 100644 --- a/spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb +++ b/spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DependencyProxy::CleanupDependencyProxyWorker do +RSpec.describe DependencyProxy::CleanupDependencyProxyWorker, feature_category: :dependency_proxy do describe '#perform' do subject { described_class.new.perform } diff --git a/spec/workers/dependency_proxy/cleanup_manifest_worker_spec.rb b/spec/workers/dependency_proxy/cleanup_manifest_worker_spec.rb index d53b3e6a1fd..730acc49110 100644 --- a/spec/workers/dependency_proxy/cleanup_manifest_worker_spec.rb +++ b/spec/workers/dependency_proxy/cleanup_manifest_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DependencyProxy::CleanupManifestWorker do +RSpec.describe DependencyProxy::CleanupManifestWorker, feature_category: :dependency_proxy do let_it_be(:factory_type) { :dependency_proxy_manifest } it_behaves_like 'dependency_proxy_cleanup_worker' diff --git a/spec/workers/dependency_proxy/image_ttl_group_policy_worker_spec.rb b/spec/workers/dependency_proxy/image_ttl_group_policy_worker_spec.rb index 6a2fdfbe8f5..44a21439ff8 100644 --- a/spec/workers/dependency_proxy/image_ttl_group_policy_worker_spec.rb +++ b/spec/workers/dependency_proxy/image_ttl_group_policy_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DependencyProxy::ImageTtlGroupPolicyWorker do +RSpec.describe DependencyProxy::ImageTtlGroupPolicyWorker, feature_category: :dependency_proxy do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/deployments/archive_in_project_worker_spec.rb b/spec/workers/deployments/archive_in_project_worker_spec.rb index 6435fe8bea1..2d244344913 100644 --- a/spec/workers/deployments/archive_in_project_worker_spec.rb +++ b/spec/workers/deployments/archive_in_project_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Deployments::ArchiveInProjectWorker do +RSpec.describe Deployments::ArchiveInProjectWorker, feature_category: :continuous_delivery do subject { described_class.new.perform(deployment&.project_id) } describe '#perform' do diff --git a/spec/workers/deployments/drop_older_deployments_worker_spec.rb b/spec/workers/deployments/drop_older_deployments_worker_spec.rb index 0cf524ca16f..8637a7788cc 100644 --- a/spec/workers/deployments/drop_older_deployments_worker_spec.rb +++ b/spec/workers/deployments/drop_older_deployments_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Deployments::DropOlderDeploymentsWorker do +RSpec.describe Deployments::DropOlderDeploymentsWorker, feature_category: :continuous_delivery do subject { described_class.new.perform(deployment&.id) } describe '#perform' do diff --git a/spec/workers/deployments/hooks_worker_spec.rb b/spec/workers/deployments/hooks_worker_spec.rb index 7c5f288fa57..51614f8b0cb 100644 --- a/spec/workers/deployments/hooks_worker_spec.rb +++ b/spec/workers/deployments/hooks_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Deployments::HooksWorker do +RSpec.describe Deployments::HooksWorker, feature_category: :continuous_delivery do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/deployments/link_merge_request_worker_spec.rb b/spec/workers/deployments/link_merge_request_worker_spec.rb index a55dd897bc7..0e484c50f21 100644 --- a/spec/workers/deployments/link_merge_request_worker_spec.rb +++ b/spec/workers/deployments/link_merge_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Deployments::LinkMergeRequestWorker do +RSpec.describe Deployments::LinkMergeRequestWorker, feature_category: :continuous_delivery do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/deployments/update_environment_worker_spec.rb b/spec/workers/deployments/update_environment_worker_spec.rb index d67cbd62616..befe8576e88 100644 --- a/spec/workers/deployments/update_environment_worker_spec.rb +++ b/spec/workers/deployments/update_environment_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Deployments::UpdateEnvironmentWorker do +RSpec.describe Deployments::UpdateEnvironmentWorker, feature_category: :continuous_delivery do subject(:worker) { described_class.new } context 'when successful deployment' do diff --git a/spec/workers/design_management/copy_design_collection_worker_spec.rb b/spec/workers/design_management/copy_design_collection_worker_spec.rb index 45bfc47ca7e..daa69a8bd6d 100644 --- a/spec/workers/design_management/copy_design_collection_worker_spec.rb +++ b/spec/workers/design_management/copy_design_collection_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DesignManagement::CopyDesignCollectionWorker, :clean_gitlab_redis_shared_state do +RSpec.describe DesignManagement::CopyDesignCollectionWorker, :clean_gitlab_redis_shared_state, feature_category: :design_management do describe '#perform' do let_it_be(:user) { create(:user) } let_it_be(:issue) { create(:issue) } diff --git a/spec/workers/design_management/new_version_worker_spec.rb b/spec/workers/design_management/new_version_worker_spec.rb index 3320d7a062d..afc908d925a 100644 --- a/spec/workers/design_management/new_version_worker_spec.rb +++ b/spec/workers/design_management/new_version_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DesignManagement::NewVersionWorker do +RSpec.describe DesignManagement::NewVersionWorker, feature_category: :design_management do describe '#perform' do let(:worker) { described_class.new } diff --git a/spec/workers/destroy_pages_deployments_worker_spec.rb b/spec/workers/destroy_pages_deployments_worker_spec.rb index 2c20c9004ef..4bfde6d220a 100644 --- a/spec/workers/destroy_pages_deployments_worker_spec.rb +++ b/spec/workers/destroy_pages_deployments_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DestroyPagesDeploymentsWorker do +RSpec.describe DestroyPagesDeploymentsWorker, feature_category: :pages do subject(:worker) { described_class.new } let(:project) { create(:project) } diff --git a/spec/workers/detect_repository_languages_worker_spec.rb b/spec/workers/detect_repository_languages_worker_spec.rb index 217e16bd155..27d60720d24 100644 --- a/spec/workers/detect_repository_languages_worker_spec.rb +++ b/spec/workers/detect_repository_languages_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DetectRepositoryLanguagesWorker do +RSpec.describe DetectRepositoryLanguagesWorker, feature_category: :source_code_management do let_it_be(:project) { create(:project) } subject { described_class.new } diff --git a/spec/workers/disallow_two_factor_for_group_worker_spec.rb b/spec/workers/disallow_two_factor_for_group_worker_spec.rb index 3a875727cce..c732f8a3d00 100644 --- a/spec/workers/disallow_two_factor_for_group_worker_spec.rb +++ b/spec/workers/disallow_two_factor_for_group_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DisallowTwoFactorForGroupWorker do +RSpec.describe DisallowTwoFactorForGroupWorker, feature_category: :subgroups do let_it_be(:group) { create(:group, require_two_factor_authentication: true) } let_it_be(:user) { create(:user, require_two_factor_authentication_from_group: true) } diff --git a/spec/workers/disallow_two_factor_for_subgroups_worker_spec.rb b/spec/workers/disallow_two_factor_for_subgroups_worker_spec.rb index c3be8263171..7584355deab 100644 --- a/spec/workers/disallow_two_factor_for_subgroups_worker_spec.rb +++ b/spec/workers/disallow_two_factor_for_subgroups_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe DisallowTwoFactorForSubgroupsWorker do +RSpec.describe DisallowTwoFactorForSubgroupsWorker, feature_category: :subgroups do let_it_be(:group) { create(:group) } let_it_be(:subgroup_with_2fa) { create(:group, parent: group, require_two_factor_authentication: true) } let_it_be(:subgroup_without_2fa) { create(:group, parent: group, require_two_factor_authentication: false) } diff --git a/spec/workers/email_receiver_worker_spec.rb b/spec/workers/email_receiver_worker_spec.rb index dba535654a1..4c464c797e4 100644 --- a/spec/workers/email_receiver_worker_spec.rb +++ b/spec/workers/email_receiver_worker_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe EmailReceiverWorker, :mailer do +RSpec.describe EmailReceiverWorker, :mailer, feature_category: :team_planning do let(:raw_message) { fixture_file('emails/valid_reply.eml') } context "when reply by email is enabled" do diff --git a/spec/workers/emails_on_push_worker_spec.rb b/spec/workers/emails_on_push_worker_spec.rb index 7d11957e2df..9e8fad19c20 100644 --- a/spec/workers/emails_on_push_worker_spec.rb +++ b/spec/workers/emails_on_push_worker_spec.rb @@ -2,12 +2,12 @@ require 'spec_helper' -RSpec.describe EmailsOnPushWorker, :mailer do - include RepoHelpers +RSpec.describe EmailsOnPushWorker, :mailer, feature_category: :source_code_management do include EmailSpec::Matchers - let(:project) { create(:project, :repository) } - let(:user) { create(:user) } + let_it_be(:project) { create(:project, :repository) } + let_it_be(:user) { create(:user) } + let(:data) { Gitlab::DataBuilder::Push.build_sample(project, user) } let(:recipients) { user.email } let(:perform) { subject.perform(project.id, recipients, data.stringify_keys) } @@ -91,7 +91,7 @@ RSpec.describe EmailsOnPushWorker, :mailer do context "when there is an SMTP error" do before do - allow(Notify).to receive(:repository_push_email).and_raise(Net::SMTPFatalError) + allow(Notify).to receive(:repository_push_email).and_raise(Net::SMTPFatalError.new(nil)) allow(subject).to receive_message_chain(:logger, :info) perform end diff --git a/spec/workers/environments/auto_delete_cron_worker_spec.rb b/spec/workers/environments/auto_delete_cron_worker_spec.rb index b18f3da5d10..d7e707b225e 100644 --- a/spec/workers/environments/auto_delete_cron_worker_spec.rb +++ b/spec/workers/environments/auto_delete_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Environments::AutoDeleteCronWorker do +RSpec.describe Environments::AutoDeleteCronWorker, feature_category: :continuous_delivery do include CreateEnvironmentsHelpers let(:worker) { described_class.new } diff --git a/spec/workers/environments/auto_stop_cron_worker_spec.rb b/spec/workers/environments/auto_stop_cron_worker_spec.rb index 1e86597d288..ad44cf97e07 100644 --- a/spec/workers/environments/auto_stop_cron_worker_spec.rb +++ b/spec/workers/environments/auto_stop_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Environments::AutoStopCronWorker do +RSpec.describe Environments::AutoStopCronWorker, feature_category: :continuous_delivery do subject { worker.perform } let(:worker) { described_class.new } diff --git a/spec/workers/environments/auto_stop_worker_spec.rb b/spec/workers/environments/auto_stop_worker_spec.rb index cb162b5a01c..cfdca4a385c 100644 --- a/spec/workers/environments/auto_stop_worker_spec.rb +++ b/spec/workers/environments/auto_stop_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Environments::AutoStopWorker do +RSpec.describe Environments::AutoStopWorker, feature_category: :continuous_delivery do include CreateEnvironmentsHelpers subject { worker.perform(environment_id) } diff --git a/spec/workers/environments/canary_ingress/update_worker_spec.rb b/spec/workers/environments/canary_ingress/update_worker_spec.rb index e7782c2fba1..abfca54c850 100644 --- a/spec/workers/environments/canary_ingress/update_worker_spec.rb +++ b/spec/workers/environments/canary_ingress/update_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Environments::CanaryIngress::UpdateWorker do +RSpec.describe Environments::CanaryIngress::UpdateWorker, feature_category: :continuous_delivery do let_it_be(:environment) { create(:environment) } let(:worker) { described_class.new } diff --git a/spec/workers/error_tracking_issue_link_worker_spec.rb b/spec/workers/error_tracking_issue_link_worker_spec.rb index 90e747c8788..fcb39597f9e 100644 --- a/spec/workers/error_tracking_issue_link_worker_spec.rb +++ b/spec/workers/error_tracking_issue_link_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ErrorTrackingIssueLinkWorker do +RSpec.describe ErrorTrackingIssueLinkWorker, feature_category: :error_tracking do let_it_be(:error_tracking) { create(:project_error_tracking_setting) } let_it_be(:project) { error_tracking.project } let_it_be(:issue) { create(:issue, project: project) } diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb index c0d46a206ce..f080e2ef1c3 100644 --- a/spec/workers/every_sidekiq_worker_spec.rb +++ b/spec/workers/every_sidekiq_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Every Sidekiq worker' do +RSpec.describe 'Every Sidekiq worker', feature_category: :shared do let(:workers_without_defaults) do Gitlab::SidekiqConfig.workers - Gitlab::SidekiqConfig::DEFAULT_WORKERS.values end @@ -272,6 +272,7 @@ RSpec.describe 'Every Sidekiq worker' do 'Gitlab::GithubImport::ImportLfsObjectWorker' => 5, 'Gitlab::GithubImport::ImportNoteWorker' => 5, 'Gitlab::GithubImport::ImportProtectedBranchWorker' => 5, + 'Gitlab::GithubImport::ImportCollaboratorWorker' => 5, 'Gitlab::GithubImport::ImportPullRequestMergedByWorker' => 5, 'Gitlab::GithubImport::ImportPullRequestReviewWorker' => 5, 'Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker' => 5, @@ -285,6 +286,7 @@ RSpec.describe 'Every Sidekiq worker' do 'Gitlab::GithubImport::Stage::ImportAttachmentsWorker' => 5, 'Gitlab::GithubImport::Stage::ImportProtectedBranchesWorker' => 5, 'Gitlab::GithubImport::Stage::ImportNotesWorker' => 5, + 'Gitlab::GithubImport::Stage::ImportCollaboratorsWorker' => 5, 'Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker' => 5, 'Gitlab::GithubImport::Stage::ImportPullRequestsReviewRequestsWorker' => 5, 'Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker' => 5, diff --git a/spec/workers/expire_build_artifacts_worker_spec.rb b/spec/workers/expire_build_artifacts_worker_spec.rb index 3f8da3fb71c..2ef832eaaed 100644 --- a/spec/workers/expire_build_artifacts_worker_spec.rb +++ b/spec/workers/expire_build_artifacts_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ExpireBuildArtifactsWorker do +RSpec.describe ExpireBuildArtifactsWorker, feature_category: :build_artifacts do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/export_csv_worker_spec.rb b/spec/workers/export_csv_worker_spec.rb index 88ccfac0a02..2de6c58958f 100644 --- a/spec/workers/export_csv_worker_spec.rb +++ b/spec/workers/export_csv_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ExportCsvWorker do +RSpec.describe ExportCsvWorker, feature_category: :team_planning do let(:user) { create(:user) } let(:project) { create(:project, creator: user) } diff --git a/spec/workers/external_service_reactive_caching_worker_spec.rb b/spec/workers/external_service_reactive_caching_worker_spec.rb index 907894d9b9a..58d9bec343a 100644 --- a/spec/workers/external_service_reactive_caching_worker_spec.rb +++ b/spec/workers/external_service_reactive_caching_worker_spec.rb @@ -2,6 +2,6 @@ require 'spec_helper' -RSpec.describe ExternalServiceReactiveCachingWorker do +RSpec.describe ExternalServiceReactiveCachingWorker, feature_category: :shared do it_behaves_like 'reactive cacheable worker' end diff --git a/spec/workers/file_hook_worker_spec.rb b/spec/workers/file_hook_worker_spec.rb index c171dc37e5f..00cd0e9c98e 100644 --- a/spec/workers/file_hook_worker_spec.rb +++ b/spec/workers/file_hook_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe FileHookWorker do +RSpec.describe FileHookWorker, feature_category: :integrations do include RepoHelpers let(:filename) { 'my_file_hook.rb' } diff --git a/spec/workers/flush_counter_increments_worker_spec.rb b/spec/workers/flush_counter_increments_worker_spec.rb index 83670acf4b6..1bdda3100c9 100644 --- a/spec/workers/flush_counter_increments_worker_spec.rb +++ b/spec/workers/flush_counter_increments_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe FlushCounterIncrementsWorker, :counter_attribute do +RSpec.describe FlushCounterIncrementsWorker, :counter_attribute, feature_category: :shared do let(:project_statistics) { create(:project_statistics) } let(:model) { CounterAttributeModel.find(project_statistics.id) } diff --git a/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb b/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb index 4e8261f61c4..121f30ea9d5 100644 --- a/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb +++ b/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::AdvanceStageWorker, :clean_gitlab_redis_shared_state do +RSpec.describe Gitlab::GithubImport::AdvanceStageWorker, :clean_gitlab_redis_shared_state, feature_category: :importers do let(:project) { create(:project) } let(:import_state) { create(:import_state, project: project, jid: '123') } let(:worker) { described_class.new } diff --git a/spec/workers/gitlab/github_import/attachments/import_issue_worker_spec.rb b/spec/workers/gitlab/github_import/attachments/import_issue_worker_spec.rb index 6d617755861..fc03e14c20e 100644 --- a/spec/workers/gitlab/github_import/attachments/import_issue_worker_spec.rb +++ b/spec/workers/gitlab/github_import/attachments/import_issue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Attachments::ImportIssueWorker do +RSpec.describe Gitlab::GithubImport::Attachments::ImportIssueWorker, feature_category: :importers do subject(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/attachments/import_merge_request_worker_spec.rb b/spec/workers/gitlab/github_import/attachments/import_merge_request_worker_spec.rb index 66dfc027e6e..bd90cee567e 100644 --- a/spec/workers/gitlab/github_import/attachments/import_merge_request_worker_spec.rb +++ b/spec/workers/gitlab/github_import/attachments/import_merge_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Attachments::ImportMergeRequestWorker do +RSpec.describe Gitlab::GithubImport::Attachments::ImportMergeRequestWorker, feature_category: :importers do subject(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/attachments/import_note_worker_spec.rb b/spec/workers/gitlab/github_import/attachments/import_note_worker_spec.rb index 7b60cdecca6..7d8fb9bc788 100644 --- a/spec/workers/gitlab/github_import/attachments/import_note_worker_spec.rb +++ b/spec/workers/gitlab/github_import/attachments/import_note_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Attachments::ImportNoteWorker do +RSpec.describe Gitlab::GithubImport::Attachments::ImportNoteWorker, feature_category: :importers do subject(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/attachments/import_release_worker_spec.rb b/spec/workers/gitlab/github_import/attachments/import_release_worker_spec.rb index e49b2fb6504..50eebc6ce8c 100644 --- a/spec/workers/gitlab/github_import/attachments/import_release_worker_spec.rb +++ b/spec/workers/gitlab/github_import/attachments/import_release_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Attachments::ImportReleaseWorker do +RSpec.describe Gitlab::GithubImport::Attachments::ImportReleaseWorker, feature_category: :importers do subject(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/import_collaborator_worker_spec.rb b/spec/workers/gitlab/github_import/import_collaborator_worker_spec.rb new file mode 100644 index 00000000000..b9463fb9a2d --- /dev/null +++ b/spec/workers/gitlab/github_import/import_collaborator_worker_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::GithubImport::ImportCollaboratorWorker, feature_category: :importers do + let(:worker) { described_class.new } + + describe '#import' do + let(:project) do + instance_double('Project', full_path: 'foo/bar', id: 1, import_state: import_state) + end + + let(:import_state) { build_stubbed(:import_state, :started) } + let(:client) { instance_double('Gitlab::GithubImport::Client') } + let(:importer) { instance_double('Gitlab::GithubImport::Importer::NoteAttachmentsImporter') } + + it 'imports a collaborator' do + expect(Gitlab::GithubImport::Importer::CollaboratorImporter) + .to receive(:new) + .with( + an_instance_of(Gitlab::GithubImport::Representation::Collaborator), + project, + client + ) + .and_return(importer) + + expect(importer).to receive(:execute) + + expect(Gitlab::GithubImport::ObjectCounter) + .to receive(:increment) + .and_call_original + + worker.import( + project, client, { 'id' => 100500, 'login' => 'alice', 'role_name' => 'maintainer' } + ) + end + end +end diff --git a/spec/workers/gitlab/github_import/import_diff_note_worker_spec.rb b/spec/workers/gitlab/github_import/import_diff_note_worker_spec.rb index c92741e8f10..35d31848fe1 100644 --- a/spec/workers/gitlab/github_import/import_diff_note_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_diff_note_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportDiffNoteWorker do +RSpec.describe Gitlab::GithubImport::ImportDiffNoteWorker, feature_category: :importers do let(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/import_issue_event_worker_spec.rb b/spec/workers/gitlab/github_import/import_issue_event_worker_spec.rb index 03a6503fb84..aa8243154ef 100644 --- a/spec/workers/gitlab/github_import/import_issue_event_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_issue_event_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportIssueEventWorker do +RSpec.describe Gitlab::GithubImport::ImportIssueEventWorker, feature_category: :importers do subject(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/import_issue_worker_spec.rb b/spec/workers/gitlab/github_import/import_issue_worker_spec.rb index ef1d2e3f3e7..76f0b512af4 100644 --- a/spec/workers/gitlab/github_import/import_issue_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_issue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportIssueWorker do +RSpec.describe Gitlab::GithubImport::ImportIssueWorker, feature_category: :importers do let(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/import_note_worker_spec.rb b/spec/workers/gitlab/github_import/import_note_worker_spec.rb index 16ca5658f77..b11ea560516 100644 --- a/spec/workers/gitlab/github_import/import_note_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_note_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportNoteWorker do +RSpec.describe Gitlab::GithubImport::ImportNoteWorker, feature_category: :importers do let(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/import_protected_branch_worker_spec.rb b/spec/workers/gitlab/github_import/import_protected_branch_worker_spec.rb index c2b8ee661a3..d6e8f760033 100644 --- a/spec/workers/gitlab/github_import/import_protected_branch_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_protected_branch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportProtectedBranchWorker do +RSpec.describe Gitlab::GithubImport::ImportProtectedBranchWorker, feature_category: :importers do let(:worker) { described_class.new } let(:import_state) { build_stubbed(:import_state, :started) } diff --git a/spec/workers/gitlab/github_import/import_pull_request_merged_by_worker_spec.rb b/spec/workers/gitlab/github_import/import_pull_request_merged_by_worker_spec.rb index 728b4c6b440..6f771a1b79d 100644 --- a/spec/workers/gitlab/github_import/import_pull_request_merged_by_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_pull_request_merged_by_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportPullRequestMergedByWorker do +RSpec.describe Gitlab::GithubImport::ImportPullRequestMergedByWorker, feature_category: :importers do it { is_expected.to include_module(Gitlab::GithubImport::ObjectImporter) } describe '#representation_class' do diff --git a/spec/workers/gitlab/github_import/import_pull_request_review_worker_spec.rb b/spec/workers/gitlab/github_import/import_pull_request_review_worker_spec.rb index 0607add52cd..ede74a75ce5 100644 --- a/spec/workers/gitlab/github_import/import_pull_request_review_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_pull_request_review_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportPullRequestReviewWorker do +RSpec.describe Gitlab::GithubImport::ImportPullRequestReviewWorker, feature_category: :importers do it { is_expected.to include_module(Gitlab::GithubImport::ObjectImporter) } describe '#representation_class' do diff --git a/spec/workers/gitlab/github_import/import_pull_request_worker_spec.rb b/spec/workers/gitlab/github_import/import_pull_request_worker_spec.rb index 59f45b437c4..864075ca3d7 100644 --- a/spec/workers/gitlab/github_import/import_pull_request_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_pull_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportPullRequestWorker do +RSpec.describe Gitlab::GithubImport::ImportPullRequestWorker, feature_category: :importers do let(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/import_release_attachments_worker_spec.rb b/spec/workers/gitlab/github_import/import_release_attachments_worker_spec.rb index 1d32d5c0e21..f4f5353a9cf 100644 --- a/spec/workers/gitlab/github_import/import_release_attachments_worker_spec.rb +++ b/spec/workers/gitlab/github_import/import_release_attachments_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::ImportReleaseAttachmentsWorker do +RSpec.describe Gitlab::GithubImport::ImportReleaseAttachmentsWorker, feature_category: :importers do subject(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/pull_requests/import_review_request_worker_spec.rb b/spec/workers/gitlab/github_import/pull_requests/import_review_request_worker_spec.rb index fdcbfb18beb..99ed83ae2db 100644 --- a/spec/workers/gitlab/github_import/pull_requests/import_review_request_worker_spec.rb +++ b/spec/workers/gitlab/github_import/pull_requests/import_review_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker do +RSpec.describe Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker, feature_category: :importers do subject(:worker) { described_class.new } describe '#import' do diff --git a/spec/workers/gitlab/github_import/refresh_import_jid_worker_spec.rb b/spec/workers/gitlab/github_import/refresh_import_jid_worker_spec.rb index 3a8b585fa77..abba6cd7734 100644 --- a/spec/workers/gitlab/github_import/refresh_import_jid_worker_spec.rb +++ b/spec/workers/gitlab/github_import/refresh_import_jid_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::RefreshImportJidWorker do +RSpec.describe Gitlab::GithubImport::RefreshImportJidWorker, feature_category: :importers do let(:worker) { described_class.new } describe '.perform_in_the_future' do diff --git a/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb b/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb index 5f60dfc8ca1..e517f30ee2c 100644 --- a/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::FinishImportWorker do +RSpec.describe Gitlab::GithubImport::Stage::FinishImportWorker, feature_category: :importers do let(:project) { create(:project) } let(:worker) { described_class.new } diff --git a/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb index ecfece735af..2945bcbe641 100644 --- a/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportAttachmentsWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportAttachmentsWorker, feature_category: :importers do subject(:worker) { described_class.new } let_it_be(:project) { create(:project) } diff --git a/spec/workers/gitlab/github_import/stage/import_base_data_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_base_data_worker_spec.rb index 7b2218b1725..1ad027a007a 100644 --- a/spec/workers/gitlab/github_import/stage/import_base_data_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_base_data_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportBaseDataWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportBaseDataWorker, feature_category: :importers do let_it_be(:project) { create(:project) } let_it_be(:import_state) { create(:import_state, project: project) } diff --git a/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb new file mode 100644 index 00000000000..0eac9f21b77 --- /dev/null +++ b/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::GithubImport::Stage::ImportCollaboratorsWorker, feature_category: :importers do + let_it_be(:project) { create(:project) } + let_it_be(:import_state) { create(:import_state, project: project) } + + let(:worker) { described_class.new } + let(:importer) { instance_double(Gitlab::GithubImport::Importer::CollaboratorsImporter) } + let(:client) { instance_double(Gitlab::GithubImport::Client) } + + describe '#import' do + let(:push_rights_granted) { true } + + before do + allow(client).to receive(:repository).with(project.import_source) + .and_return({ permissions: { push: push_rights_granted } }) + end + + context 'when user has push access for this repo' do + it 'imports all the pull requests' do + waiter = Gitlab::JobWaiter.new(2, '123') + + expect(Gitlab::GithubImport::Importer::CollaboratorsImporter) + .to receive(:new) + .with(project, client) + .and_return(importer) + expect(importer).to receive(:execute).and_return(waiter) + + expect(import_state).to receive(:refresh_jid_expiration) + + expect(Gitlab::GithubImport::AdvanceStageWorker) + .to receive(:perform_async) + .with(project.id, { '123' => 2 }, :pull_requests_merged_by) + + worker.import(client, project) + end + end + + context 'when user do not have push access for this repo' do + let(:push_rights_granted) { false } + + it 'skips stage' do + expect(Gitlab::GithubImport::Importer::CollaboratorsImporter).not_to receive(:new) + + expect(Gitlab::GithubImport::AdvanceStageWorker) + .to receive(:perform_async) + .with(project.id, {}, :pull_requests_merged_by) + + worker.import(client, project) + end + end + + it 'raises an error' do + exception = StandardError.new('_some_error_') + + expect_next_instance_of(Gitlab::GithubImport::Importer::CollaboratorsImporter) do |importer| + expect(importer).to receive(:execute).and_raise(exception) + end + expect(Gitlab::Import::ImportFailureService).to receive(:track) + .with( + project_id: project.id, + exception: exception, + error_source: described_class.name, + fail_import: true, + metrics: true + ).and_call_original + + expect { worker.import(client, project) }.to raise_error(StandardError) + end + end +end diff --git a/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb index 199d1b9a3ca..c70ee0250e8 100644 --- a/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportIssueEventsWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportIssueEventsWorker, feature_category: :importers do subject(:worker) { described_class.new } let(:project) { create(:project) } diff --git a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb index beef0864715..872201ece93 100644 --- a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker, feature_category: :importers do let(:project) { create(:project) } let(:worker) { described_class.new } diff --git a/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb index 103d55890c4..2449c0505f5 100644 --- a/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportLfsObjectsWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportLfsObjectsWorker, feature_category: :importers do let(:project) { create(:project) } let(:worker) { described_class.new } diff --git a/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb index dbcf2083ec1..8c0004c0f3f 100644 --- a/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportNotesWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportNotesWorker, feature_category: :importers do let(:project) { create(:project) } let(:worker) { described_class.new } diff --git a/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb index 0770af524a1..f848293a3b2 100644 --- a/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportProtectedBranchesWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportProtectedBranchesWorker, feature_category: :importers do let_it_be(:project) { create(:project) } let_it_be(:import_state) { create(:import_state, project: project) } diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb index 5d6dcdc10ee..4ffc5a956a3 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker, feature_category: :importers do let(:project) { create(:project) } let(:import_state) { create(:import_state, project: project) } let(:worker) { described_class.new } diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb index 151de9bdffc..41c0b29df7c 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewRequestsWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewRequestsWorker, feature_category: :importers do subject(:worker) { described_class.new } let(:project) { instance_double(Project, id: 1, import_state: import_state) } diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb index 18a70273219..c68e84475cb 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker, feature_category: :importers do let(:project) { create(:project) } let(:import_state) { create(:import_state, project: project) } let(:worker) { described_class.new } diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb index b18b5ce64d1..6ebf93730eb 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker, feature_category: :importers do let_it_be(:project) { create(:project) } let_it_be(:import_state) { create(:import_state, project: project) } @@ -28,7 +28,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker do expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :pull_requests_merged_by) + .with(project.id, { '123' => 2 }, :collaborators) worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb index 24fca3b7c73..94d8155d371 100644 --- a/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do +RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker, feature_category: :importers do let_it_be(:project) { create(:project, :import_started) } let(:worker) { described_class.new } @@ -33,7 +33,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do :issues, project.import_source, options ).and_return([{ number: 5 }].each) - expect(Issue).to receive(:track_project_iid!).with(project, 5) + expect(Issue).to receive(:track_namespace_iid!).with(project.project_namespace, 5) expect(Gitlab::GithubImport::Stage::ImportBaseDataWorker) .to receive(:perform_async) @@ -54,7 +54,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do expect(InternalId).to receive(:exists?).and_return(false) expect(client).to receive(:each_object).with(:issues, project.import_source, options).and_return([nil].each) - expect(Issue).not_to receive(:track_project_iid!) + expect(Issue).not_to receive(:track_namespace_iid!) expect(Gitlab::GithubImport::Stage::ImportBaseDataWorker) .to receive(:perform_async) @@ -74,7 +74,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do expect(InternalId).to receive(:exists?).and_return(true) expect(client).not_to receive(:each_object) - expect(Issue).not_to receive(:track_project_iid!) + expect(Issue).not_to receive(:track_namespace_iid!) expect(Gitlab::GithubImport::Stage::ImportBaseDataWorker) .to receive(:perform_async) @@ -96,7 +96,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportRepositoryWorker do expect(InternalId).to receive(:exists?).and_return(false) expect(client).to receive(:each_object).and_return([nil].each) - expect(Issue).not_to receive(:track_project_iid!) + expect(Issue).not_to receive(:track_namespace_iid!) expect(Gitlab::Import::ImportFailureService).to receive(:track) .with( diff --git a/spec/workers/gitlab/import/stuck_import_job_spec.rb b/spec/workers/gitlab/import/stuck_import_job_spec.rb index 3a1463e98a0..52721168143 100644 --- a/spec/workers/gitlab/import/stuck_import_job_spec.rb +++ b/spec/workers/gitlab/import/stuck_import_job_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Import::StuckImportJob do +RSpec.describe Gitlab::Import::StuckImportJob, feature_category: :importers do let_it_be(:project) { create(:project, :import_started, import_source: 'foo/bar') } let(:worker) do diff --git a/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb b/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb index d12d5a605a7..9994896d3c8 100644 --- a/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb +++ b/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Import::StuckProjectImportJobsWorker do +RSpec.describe Gitlab::Import::StuckProjectImportJobsWorker, feature_category: :importers do let(:worker) { described_class.new } describe 'with scheduled import_status' do diff --git a/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb b/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb index 0244e69b7b6..5209395923f 100644 --- a/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::JiraImport::ImportIssueWorker do +RSpec.describe Gitlab::JiraImport::ImportIssueWorker, feature_category: :importers do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:jira_issue_label_1) { create(:label, project: project) } diff --git a/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb index 23a764bd972..d1bf71a2095 100644 --- a/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::JiraImport::Stage::FinishImportWorker do +RSpec.describe Gitlab::JiraImport::Stage::FinishImportWorker, feature_category: :importers do let_it_be(:project) { create(:project) } let_it_be(:worker) { described_class.new } diff --git a/spec/workers/gitlab/jira_import/stage/import_attachments_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/import_attachments_worker_spec.rb index 28da93b8d00..c594182bf75 100644 --- a/spec/workers/gitlab/jira_import/stage/import_attachments_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/import_attachments_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker do +RSpec.describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker, feature_category: :importers do let_it_be(:project) { create(:project, import_type: 'jira') } describe 'modules' do diff --git a/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb index 2b08a592164..594f9618770 100644 --- a/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::JiraImport::Stage::ImportIssuesWorker do +RSpec.describe Gitlab::JiraImport::Stage::ImportIssuesWorker, feature_category: :importers do include JiraIntegrationHelpers let_it_be(:user) { create(:user) } diff --git a/spec/workers/gitlab/jira_import/stage/import_labels_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/import_labels_worker_spec.rb index d15f2caba19..d9c2407a423 100644 --- a/spec/workers/gitlab/jira_import/stage/import_labels_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/import_labels_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::JiraImport::Stage::ImportLabelsWorker do +RSpec.describe Gitlab::JiraImport::Stage::ImportLabelsWorker, feature_category: :importers do include JiraIntegrationHelpers let_it_be(:user) { create(:user) } diff --git a/spec/workers/gitlab/jira_import/stage/import_notes_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/import_notes_worker_spec.rb index 2502bbf1df4..41216356033 100644 --- a/spec/workers/gitlab/jira_import/stage/import_notes_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/import_notes_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::JiraImport::Stage::ImportNotesWorker do +RSpec.describe Gitlab::JiraImport::Stage::ImportNotesWorker, feature_category: :importers do let_it_be(:project) { create(:project, import_type: 'jira') } describe 'modules' do diff --git a/spec/workers/gitlab/jira_import/stage/start_import_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/start_import_worker_spec.rb index e440884553f..ea0291b1c44 100644 --- a/spec/workers/gitlab/jira_import/stage/start_import_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/start_import_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::JiraImport::Stage::StartImportWorker do +RSpec.describe Gitlab::JiraImport::Stage::StartImportWorker, feature_category: :importers do let_it_be(:project) { create(:project, import_type: 'jira') } let_it_be(:jid) { '12345678' } diff --git a/spec/workers/gitlab/jira_import/stuck_jira_import_jobs_worker_spec.rb b/spec/workers/gitlab/jira_import/stuck_jira_import_jobs_worker_spec.rb index 92754513988..0f9f9b70c3e 100644 --- a/spec/workers/gitlab/jira_import/stuck_jira_import_jobs_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stuck_jira_import_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Gitlab::JiraImport::StuckJiraImportJobsWorker do +RSpec.describe ::Gitlab::JiraImport::StuckJiraImportJobsWorker, feature_category: :importers do let_it_be(:current_user) { create(:user) } let_it_be(:project) { create(:project) } diff --git a/spec/workers/gitlab/phabricator_import/base_worker_spec.rb b/spec/workers/gitlab/phabricator_import/base_worker_spec.rb index 18fa484aa7a..9adba391d0f 100644 --- a/spec/workers/gitlab/phabricator_import/base_worker_spec.rb +++ b/spec/workers/gitlab/phabricator_import/base_worker_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe Gitlab::PhabricatorImport::BaseWorker do +RSpec.describe Gitlab::PhabricatorImport::BaseWorker, feature_category: :importers do let(:subclass) do # Creating an anonymous class for a worker is complicated, as we generate the # queue name from the class name. diff --git a/spec/workers/gitlab/phabricator_import/import_tasks_worker_spec.rb b/spec/workers/gitlab/phabricator_import/import_tasks_worker_spec.rb index 221b6202166..6c1da983640 100644 --- a/spec/workers/gitlab/phabricator_import/import_tasks_worker_spec.rb +++ b/spec/workers/gitlab/phabricator_import/import_tasks_worker_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe Gitlab::PhabricatorImport::ImportTasksWorker do +RSpec.describe Gitlab::PhabricatorImport::ImportTasksWorker, feature_category: :importers do describe '#perform' do it 'calls the correct importer' do project = create(:project, :import_started, import_url: "https://the.phab.ulr") diff --git a/spec/workers/gitlab_performance_bar_stats_worker_spec.rb b/spec/workers/gitlab_performance_bar_stats_worker_spec.rb index 3638add1524..45fb58826ba 100644 --- a/spec/workers/gitlab_performance_bar_stats_worker_spec.rb +++ b/spec/workers/gitlab_performance_bar_stats_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GitlabPerformanceBarStatsWorker do +RSpec.describe GitlabPerformanceBarStatsWorker, feature_category: :metrics do include ExclusiveLeaseHelpers subject(:worker) { described_class.new } diff --git a/spec/workers/gitlab_service_ping_worker_spec.rb b/spec/workers/gitlab_service_ping_worker_spec.rb index f17847a7b33..1d16e8c3496 100644 --- a/spec/workers/gitlab_service_ping_worker_spec.rb +++ b/spec/workers/gitlab_service_ping_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GitlabServicePingWorker, :clean_gitlab_redis_shared_state do +RSpec.describe GitlabServicePingWorker, :clean_gitlab_redis_shared_state, feature_category: :service_ping do let(:payload) { { recorded_at: Time.current.rfc3339 } } before do @@ -14,15 +14,13 @@ RSpec.describe GitlabServicePingWorker, :clean_gitlab_redis_shared_state do allow(subject).to receive(:sleep) end - it 'does not run for GitLab.com when triggered from cron' do - allow(Gitlab).to receive(:com?).and_return(true) + it 'does not run for SaaS when triggered from cron', :saas do expect(ServicePing::SubmitService).not_to receive(:new) subject.perform end - it 'runs for GitLab.com when triggered manually' do - allow(Gitlab).to receive(:com?).and_return(true) + it 'runs for SaaS when triggered manually', :saas do expect(ServicePing::SubmitService).to receive(:new) subject.perform('triggered_from_cron' => false) diff --git a/spec/workers/gitlab_shell_worker_spec.rb b/spec/workers/gitlab_shell_worker_spec.rb index 838f2ef4ba4..9fff4489667 100644 --- a/spec/workers/gitlab_shell_worker_spec.rb +++ b/spec/workers/gitlab_shell_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GitlabShellWorker, :sidekiq_inline do +RSpec.describe GitlabShellWorker, :sidekiq_inline, feature_category: :source_code_management do describe '#perform' do Gitlab::Shell::PERMITTED_ACTIONS.each do |action| describe "with the #{action} action" do diff --git a/spec/workers/google_cloud/create_cloudsql_instance_worker_spec.rb b/spec/workers/google_cloud/create_cloudsql_instance_worker_spec.rb index 5d595a3679b..7aea40807e8 100644 --- a/spec/workers/google_cloud/create_cloudsql_instance_worker_spec.rb +++ b/spec/workers/google_cloud/create_cloudsql_instance_worker_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require 'google/apis/sqladmin_v1beta4' -RSpec.describe GoogleCloud::CreateCloudsqlInstanceWorker do +RSpec.describe GoogleCloud::CreateCloudsqlInstanceWorker, feature_category: :shared do let(:random_user) { create(:user) } let(:project) { create(:project) } let(:worker_options) do diff --git a/spec/workers/group_destroy_worker_spec.rb b/spec/workers/group_destroy_worker_spec.rb index 82ae9010a24..fba4573718a 100644 --- a/spec/workers/group_destroy_worker_spec.rb +++ b/spec/workers/group_destroy_worker_spec.rb @@ -2,20 +2,29 @@ require 'spec_helper' -RSpec.describe GroupDestroyWorker do - let(:group) { create(:group) } - let!(:project) { create(:project, namespace: group) } - let(:user) { create(:user) } +RSpec.describe GroupDestroyWorker, feature_category: :subgroups do + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, namespace: group) } + let_it_be(:user) { create(:user) } before do group.add_owner(user) end - subject { described_class.new } + subject(:worker) { described_class.new } + + include_examples 'an idempotent worker' do + let(:job_args) { [group.id, user.id] } + + it 'does not change groups when run twice' do + expect { worker.perform(group.id, user.id) }.to change { Group.count }.by(-1) + expect { worker.perform(group.id, user.id) }.not_to change { Group.count } + end + end describe "#perform" do - it "deletes the project" do - subject.perform(group.id, user.id) + it "deletes the group and associated projects" do + worker.perform(group.id, user.id) expect(Group.all).not_to include(group) expect(Project.all).not_to include(project) diff --git a/spec/workers/group_export_worker_spec.rb b/spec/workers/group_export_worker_spec.rb index 4e58e3886a4..54f9c38a506 100644 --- a/spec/workers/group_export_worker_spec.rb +++ b/spec/workers/group_export_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GroupExportWorker do +RSpec.describe GroupExportWorker, feature_category: :importers do let!(:user) { create(:user) } let!(:group) { create(:group) } diff --git a/spec/workers/group_import_worker_spec.rb b/spec/workers/group_import_worker_spec.rb index 5171de7086b..9aa6aaec24c 100644 --- a/spec/workers/group_import_worker_spec.rb +++ b/spec/workers/group_import_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GroupImportWorker do +RSpec.describe GroupImportWorker, feature_category: :importers do let(:user) { create(:user) } let(:group) { create(:group) } diff --git a/spec/workers/groups/update_statistics_worker_spec.rb b/spec/workers/groups/update_statistics_worker_spec.rb index 7fc166ed300..f47606f0580 100644 --- a/spec/workers/groups/update_statistics_worker_spec.rb +++ b/spec/workers/groups/update_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Groups::UpdateStatisticsWorker do +RSpec.describe Groups::UpdateStatisticsWorker, feature_category: :source_code_management do let_it_be(:group) { create(:group) } let(:statistics) { %w(wiki_size) } diff --git a/spec/workers/groups/update_two_factor_requirement_for_members_worker_spec.rb b/spec/workers/groups/update_two_factor_requirement_for_members_worker_spec.rb index 9d202b9452f..aa1ca698095 100644 --- a/spec/workers/groups/update_two_factor_requirement_for_members_worker_spec.rb +++ b/spec/workers/groups/update_two_factor_requirement_for_members_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Groups::UpdateTwoFactorRequirementForMembersWorker do +RSpec.describe Groups::UpdateTwoFactorRequirementForMembersWorker, feature_category: :system_access do let_it_be(:group) { create(:group) } let(:worker) { described_class.new } diff --git a/spec/workers/hashed_storage/migrator_worker_spec.rb b/spec/workers/hashed_storage/migrator_worker_spec.rb index e014297756e..f188928cf92 100644 --- a/spec/workers/hashed_storage/migrator_worker_spec.rb +++ b/spec/workers/hashed_storage/migrator_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe HashedStorage::MigratorWorker do +RSpec.describe HashedStorage::MigratorWorker, feature_category: :source_code_management do subject(:worker) { described_class.new } let(:projects) { create_list(:project, 2, :legacy_storage, :empty_repo) } diff --git a/spec/workers/hashed_storage/project_migrate_worker_spec.rb b/spec/workers/hashed_storage/project_migrate_worker_spec.rb index fd460888932..84592e85eaa 100644 --- a/spec/workers/hashed_storage/project_migrate_worker_spec.rb +++ b/spec/workers/hashed_storage/project_migrate_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe HashedStorage::ProjectMigrateWorker, :clean_gitlab_redis_shared_state do +RSpec.describe HashedStorage::ProjectMigrateWorker, :clean_gitlab_redis_shared_state, feature_category: :source_code_management do include ExclusiveLeaseHelpers let(:migration_service) { ::Projects::HashedStorage::MigrationService } diff --git a/spec/workers/hashed_storage/project_rollback_worker_spec.rb b/spec/workers/hashed_storage/project_rollback_worker_spec.rb index fc89ac728b1..f27b5e4b9ce 100644 --- a/spec/workers/hashed_storage/project_rollback_worker_spec.rb +++ b/spec/workers/hashed_storage/project_rollback_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe HashedStorage::ProjectRollbackWorker, :clean_gitlab_redis_shared_state do +RSpec.describe HashedStorage::ProjectRollbackWorker, :clean_gitlab_redis_shared_state, feature_category: :source_code_management do include ExclusiveLeaseHelpers describe '#perform' do diff --git a/spec/workers/hashed_storage/rollbacker_worker_spec.rb b/spec/workers/hashed_storage/rollbacker_worker_spec.rb index 46cca068273..af8957d9b96 100644 --- a/spec/workers/hashed_storage/rollbacker_worker_spec.rb +++ b/spec/workers/hashed_storage/rollbacker_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe HashedStorage::RollbackerWorker do +RSpec.describe HashedStorage::RollbackerWorker, feature_category: :source_code_management do subject(:worker) { described_class.new } let(:projects) { create_list(:project, 2, :empty_repo) } diff --git a/spec/workers/import_issues_csv_worker_spec.rb b/spec/workers/import_issues_csv_worker_spec.rb index 919ab2b1adf..7f38119d499 100644 --- a/spec/workers/import_issues_csv_worker_spec.rb +++ b/spec/workers/import_issues_csv_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ImportIssuesCsvWorker do +RSpec.describe ImportIssuesCsvWorker, feature_category: :team_planning do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } diff --git a/spec/workers/incident_management/add_severity_system_note_worker_spec.rb b/spec/workers/incident_management/add_severity_system_note_worker_spec.rb index 4d6e6610a92..cd19c5694b5 100644 --- a/spec/workers/incident_management/add_severity_system_note_worker_spec.rb +++ b/spec/workers/incident_management/add_severity_system_note_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe IncidentManagement::AddSeveritySystemNoteWorker do +RSpec.describe IncidentManagement::AddSeveritySystemNoteWorker, feature_category: :incident_management do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } let_it_be(:incident) { create(:incident, project: project) } diff --git a/spec/workers/incident_management/close_incident_worker_spec.rb b/spec/workers/incident_management/close_incident_worker_spec.rb index 145ee780573..bf967a42ceb 100644 --- a/spec/workers/incident_management/close_incident_worker_spec.rb +++ b/spec/workers/incident_management/close_incident_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe IncidentManagement::CloseIncidentWorker do +RSpec.describe IncidentManagement::CloseIncidentWorker, feature_category: :incident_management do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/incident_management/pager_duty/process_incident_worker_spec.rb b/spec/workers/incident_management/pager_duty/process_incident_worker_spec.rb index b81f1a575b5..f537acfaa05 100644 --- a/spec/workers/incident_management/pager_duty/process_incident_worker_spec.rb +++ b/spec/workers/incident_management/pager_duty/process_incident_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe IncidentManagement::PagerDuty::ProcessIncidentWorker do +RSpec.describe IncidentManagement::PagerDuty::ProcessIncidentWorker, feature_category: :incident_management do let_it_be(:project) { create(:project) } let_it_be(:incident_management_setting) { create(:project_incident_management_setting, project: project, pagerduty_active: true) } diff --git a/spec/workers/incident_management/process_alert_worker_v2_spec.rb b/spec/workers/incident_management/process_alert_worker_v2_spec.rb index 6cde8b758fa..476b6f04942 100644 --- a/spec/workers/incident_management/process_alert_worker_v2_spec.rb +++ b/spec/workers/incident_management/process_alert_worker_v2_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe IncidentManagement::ProcessAlertWorkerV2 do +RSpec.describe IncidentManagement::ProcessAlertWorkerV2, feature_category: :incident_management do let_it_be(:project) { create(:project) } let_it_be(:settings) { create(:project_incident_management_setting, project: project, create_issue: true) } diff --git a/spec/workers/integrations/create_external_cross_reference_worker_spec.rb b/spec/workers/integrations/create_external_cross_reference_worker_spec.rb index 8e586b90905..ee974fe2b28 100644 --- a/spec/workers/integrations/create_external_cross_reference_worker_spec.rb +++ b/spec/workers/integrations/create_external_cross_reference_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Integrations::CreateExternalCrossReferenceWorker do +RSpec.describe Integrations::CreateExternalCrossReferenceWorker, feature_category: :integrations do include AfterNextHelpers using RSpec::Parameterized::TableSyntax diff --git a/spec/workers/integrations/execute_worker_spec.rb b/spec/workers/integrations/execute_worker_spec.rb index 0e585e3006c..717e3c65820 100644 --- a/spec/workers/integrations/execute_worker_spec.rb +++ b/spec/workers/integrations/execute_worker_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe Integrations::ExecuteWorker, '#perform' do +RSpec.describe Integrations::ExecuteWorker, '#perform', feature_category: :integrations do let_it_be(:integration) { create(:jira_integration) } let(:worker) { described_class.new } diff --git a/spec/workers/integrations/irker_worker_spec.rb b/spec/workers/integrations/irker_worker_spec.rb index 3b7b9af72fd..257a6f72709 100644 --- a/spec/workers/integrations/irker_worker_spec.rb +++ b/spec/workers/integrations/irker_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Integrations::IrkerWorker, '#perform' do +RSpec.describe Integrations::IrkerWorker, '#perform', feature_category: :integrations do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } let_it_be(:push_data) { HashWithIndifferentAccess.new(Gitlab::DataBuilder::Push.build_sample(project, user)) } diff --git a/spec/workers/invalid_gpg_signature_update_worker_spec.rb b/spec/workers/invalid_gpg_signature_update_worker_spec.rb index 25c48b55cbb..81a15e79579 100644 --- a/spec/workers/invalid_gpg_signature_update_worker_spec.rb +++ b/spec/workers/invalid_gpg_signature_update_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe InvalidGpgSignatureUpdateWorker do +RSpec.describe InvalidGpgSignatureUpdateWorker, feature_category: :source_code_management do context 'when GpgKey is found' do it 'calls NotificationService.new.run' do gpg_key = create(:gpg_key) diff --git a/spec/workers/issuable/label_links_destroy_worker_spec.rb b/spec/workers/issuable/label_links_destroy_worker_spec.rb index a838f1c8017..d993c6cb22f 100644 --- a/spec/workers/issuable/label_links_destroy_worker_spec.rb +++ b/spec/workers/issuable/label_links_destroy_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Issuable::LabelLinksDestroyWorker do +RSpec.describe Issuable::LabelLinksDestroyWorker, feature_category: :team_planning do let(:job_args) { [1, 'MergeRequest'] } let(:service) { double } diff --git a/spec/workers/issuable_export_csv_worker_spec.rb b/spec/workers/issuable_export_csv_worker_spec.rb index a5172d916b6..66198157edb 100644 --- a/spec/workers/issuable_export_csv_worker_spec.rb +++ b/spec/workers/issuable_export_csv_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe IssuableExportCsvWorker do +RSpec.describe IssuableExportCsvWorker, feature_category: :team_planning do let(:user) { create(:user) } let(:project) { create(:project, creator: user) } let(:params) { {} } @@ -50,6 +50,19 @@ RSpec.describe IssuableExportCsvWorker do end end + shared_examples 'export with selected fields' do + let(:selected_fields) { %w[Title Description'] } + + it 'calls the export service with selected fields' do + params[:selected_fields] = selected_fields + + expect(export_service) + .to receive(:new).with(anything, project, selected_fields).once.and_call_original + + subject + end + end + context 'when issuable type is MergeRequest' do let(:issuable_type) { :merge_request } @@ -58,7 +71,7 @@ RSpec.describe IssuableExportCsvWorker do end it 'calls the MR export service' do - expect(MergeRequests::ExportCsvService).to receive(:new).with(anything, project).once.and_call_original + expect(MergeRequests::ExportCsvService).to receive(:new).with(anything, project, []).once.and_call_original subject end @@ -68,6 +81,34 @@ RSpec.describe IssuableExportCsvWorker do subject end + + it_behaves_like 'export with selected fields' do + let(:export_service) { MergeRequests::ExportCsvService } + end + end + + context 'for type WorkItem' do + let(:issuable_type) { :work_item } + + it 'emails a CSV' do + expect { subject }.to change { ActionMailer::Base.deliveries.size }.by(1) + end + + it 'calls the work item export service' do + expect(WorkItems::ExportCsvService).to receive(:new).with(anything, project, []).once.and_call_original + + subject + end + + it 'calls the WorkItemsFinder' do + expect(WorkItems::WorkItemsFinder).to receive(:new).once.and_call_original + + subject + end + + it_behaves_like 'export with selected fields' do + let(:export_service) { WorkItems::ExportCsvService } + end end context 'when issuable type is User' do diff --git a/spec/workers/issuables/clear_groups_issue_counter_worker_spec.rb b/spec/workers/issuables/clear_groups_issue_counter_worker_spec.rb index ac430f42e7a..e8f39388328 100644 --- a/spec/workers/issuables/clear_groups_issue_counter_worker_spec.rb +++ b/spec/workers/issuables/clear_groups_issue_counter_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Issuables::ClearGroupsIssueCounterWorker do +RSpec.describe Issuables::ClearGroupsIssueCounterWorker, feature_category: :team_planning do describe '#perform' do let_it_be(:user) { create(:user) } let_it_be(:parent_group) { create(:group) } diff --git a/spec/workers/issue_due_scheduler_worker_spec.rb b/spec/workers/issue_due_scheduler_worker_spec.rb index aecff4a3d93..8988dc86168 100644 --- a/spec/workers/issue_due_scheduler_worker_spec.rb +++ b/spec/workers/issue_due_scheduler_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe IssueDueSchedulerWorker do +RSpec.describe IssueDueSchedulerWorker, feature_category: :team_planning do describe '#perform' do it 'schedules one MailScheduler::IssueDueWorker per project with open issues due tomorrow' do project1 = create(:project) diff --git a/spec/workers/issues/close_worker_spec.rb b/spec/workers/issues/close_worker_spec.rb index 3902618ae03..488be7eb067 100644 --- a/spec/workers/issues/close_worker_spec.rb +++ b/spec/workers/issues/close_worker_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe Issues::CloseWorker do +RSpec.describe Issues::CloseWorker, feature_category: :team_planning do describe "#perform" do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :public, :repository) } diff --git a/spec/workers/issues/placement_worker_spec.rb b/spec/workers/issues/placement_worker_spec.rb index 33fa0b31b72..710b3d07938 100644 --- a/spec/workers/issues/placement_worker_spec.rb +++ b/spec/workers/issues/placement_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Issues::PlacementWorker do +RSpec.describe Issues::PlacementWorker, feature_category: :team_planning do describe '#perform' do let_it_be(:time) { Time.now.utc } let_it_be(:group) { create(:group) } diff --git a/spec/workers/issues/rebalancing_worker_spec.rb b/spec/workers/issues/rebalancing_worker_spec.rb index e1c0b348a4f..e0dccf0c56e 100644 --- a/spec/workers/issues/rebalancing_worker_spec.rb +++ b/spec/workers/issues/rebalancing_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Issues::RebalancingWorker do +RSpec.describe Issues::RebalancingWorker, feature_category: :team_planning do describe '#perform' do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } diff --git a/spec/workers/issues/reschedule_stuck_issue_rebalances_worker_spec.rb b/spec/workers/issues/reschedule_stuck_issue_rebalances_worker_spec.rb index 6723c425f34..fa23ffe92f1 100644 --- a/spec/workers/issues/reschedule_stuck_issue_rebalances_worker_spec.rb +++ b/spec/workers/issues/reschedule_stuck_issue_rebalances_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Issues::RescheduleStuckIssueRebalancesWorker, :clean_gitlab_redis_shared_state do +RSpec.describe Issues::RescheduleStuckIssueRebalancesWorker, :clean_gitlab_redis_shared_state, feature_category: :team_planning do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } diff --git a/spec/workers/jira_connect/forward_event_worker_spec.rb b/spec/workers/jira_connect/forward_event_worker_spec.rb index d3db07b8cb4..1be59d846f2 100644 --- a/spec/workers/jira_connect/forward_event_worker_spec.rb +++ b/spec/workers/jira_connect/forward_event_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe JiraConnect::ForwardEventWorker do +RSpec.describe JiraConnect::ForwardEventWorker, feature_category: :integrations do describe '#perform' do let!(:jira_connect_installation) { create(:jira_connect_installation, instance_url: self_managed_url, client_key: client_key, shared_secret: shared_secret) } let(:base_path) { '/-/jira_connect' } diff --git a/spec/workers/jira_connect/retry_request_worker_spec.rb b/spec/workers/jira_connect/retry_request_worker_spec.rb index 7a93e5fe41d..e96a050da13 100644 --- a/spec/workers/jira_connect/retry_request_worker_spec.rb +++ b/spec/workers/jira_connect/retry_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe JiraConnect::RetryRequestWorker do +RSpec.describe JiraConnect::RetryRequestWorker, feature_category: :integrations do describe '#perform' do let(:jwt) { 'some-jwt' } let(:event_url) { 'https://example.com/somewhere' } diff --git a/spec/workers/jira_connect/sync_branch_worker_spec.rb b/spec/workers/jira_connect/sync_branch_worker_spec.rb index 349ccd10694..54b1915b253 100644 --- a/spec/workers/jira_connect/sync_branch_worker_spec.rb +++ b/spec/workers/jira_connect/sync_branch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe JiraConnect::SyncBranchWorker do +RSpec.describe JiraConnect::SyncBranchWorker, feature_category: :integrations do include AfterNextHelpers it_behaves_like 'worker with data consistency', diff --git a/spec/workers/jira_connect/sync_builds_worker_spec.rb b/spec/workers/jira_connect/sync_builds_worker_spec.rb index 9be0cccae2b..6ef15b084a3 100644 --- a/spec/workers/jira_connect/sync_builds_worker_spec.rb +++ b/spec/workers/jira_connect/sync_builds_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::JiraConnect::SyncBuildsWorker do +RSpec.describe ::JiraConnect::SyncBuildsWorker, feature_category: :integrations do include AfterNextHelpers it_behaves_like 'worker with data consistency', diff --git a/spec/workers/jira_connect/sync_deployments_worker_spec.rb b/spec/workers/jira_connect/sync_deployments_worker_spec.rb index 86ba11ebe9c..2e72a94bc1e 100644 --- a/spec/workers/jira_connect/sync_deployments_worker_spec.rb +++ b/spec/workers/jira_connect/sync_deployments_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::JiraConnect::SyncDeploymentsWorker do +RSpec.describe ::JiraConnect::SyncDeploymentsWorker, feature_category: :integrations do include AfterNextHelpers it_behaves_like 'worker with data consistency', diff --git a/spec/workers/jira_connect/sync_feature_flags_worker_spec.rb b/spec/workers/jira_connect/sync_feature_flags_worker_spec.rb index 6763aefcbec..c2dbd52398f 100644 --- a/spec/workers/jira_connect/sync_feature_flags_worker_spec.rb +++ b/spec/workers/jira_connect/sync_feature_flags_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::JiraConnect::SyncFeatureFlagsWorker do +RSpec.describe ::JiraConnect::SyncFeatureFlagsWorker, feature_category: :integrations do include AfterNextHelpers it_behaves_like 'worker with data consistency', diff --git a/spec/workers/jira_connect/sync_merge_request_worker_spec.rb b/spec/workers/jira_connect/sync_merge_request_worker_spec.rb index 65976566b22..23abb915d68 100644 --- a/spec/workers/jira_connect/sync_merge_request_worker_spec.rb +++ b/spec/workers/jira_connect/sync_merge_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe JiraConnect::SyncMergeRequestWorker do +RSpec.describe JiraConnect::SyncMergeRequestWorker, feature_category: :integrations do include AfterNextHelpers it_behaves_like 'worker with data consistency', diff --git a/spec/workers/jira_connect/sync_project_worker_spec.rb b/spec/workers/jira_connect/sync_project_worker_spec.rb index d172bde2400..afd56a3b5c1 100644 --- a/spec/workers/jira_connect/sync_project_worker_spec.rb +++ b/spec/workers/jira_connect/sync_project_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe JiraConnect::SyncProjectWorker, factory_default: :keep do +RSpec.describe JiraConnect::SyncProjectWorker, factory_default: :keep, feature_category: :integrations do include AfterNextHelpers it_behaves_like 'worker with data consistency', diff --git a/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb b/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb index 09d58a1189e..19860f32b29 100644 --- a/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb +++ b/spec/workers/loose_foreign_keys/cleanup_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe LooseForeignKeys::CleanupWorker do +RSpec.describe LooseForeignKeys::CleanupWorker, feature_category: :pods do include MigrationsHelpers using RSpec::Parameterized::TableSyntax diff --git a/spec/workers/mail_scheduler/issue_due_worker_spec.rb b/spec/workers/mail_scheduler/issue_due_worker_spec.rb index c03cc0bda61..9bdfcd7ca49 100644 --- a/spec/workers/mail_scheduler/issue_due_worker_spec.rb +++ b/spec/workers/mail_scheduler/issue_due_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MailScheduler::IssueDueWorker do +RSpec.describe MailScheduler::IssueDueWorker, feature_category: :team_planning do describe '#perform' do let(:worker) { described_class.new } let(:project) { create(:project) } diff --git a/spec/workers/mail_scheduler/notification_service_worker_spec.rb b/spec/workers/mail_scheduler/notification_service_worker_spec.rb index 482d99a43c2..5ba7a0c555f 100644 --- a/spec/workers/mail_scheduler/notification_service_worker_spec.rb +++ b/spec/workers/mail_scheduler/notification_service_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MailScheduler::NotificationServiceWorker do +RSpec.describe MailScheduler::NotificationServiceWorker, feature_category: :team_planning do let(:worker) { described_class.new } let(:method) { 'new_key' } diff --git a/spec/workers/member_invitation_reminder_emails_worker_spec.rb b/spec/workers/member_invitation_reminder_emails_worker_spec.rb index bb4ff466584..4c6295285ea 100644 --- a/spec/workers/member_invitation_reminder_emails_worker_spec.rb +++ b/spec/workers/member_invitation_reminder_emails_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MemberInvitationReminderEmailsWorker do +RSpec.describe MemberInvitationReminderEmailsWorker, feature_category: :subgroups do describe '#perform' do subject { described_class.new.perform } diff --git a/spec/workers/members_destroyer/unassign_issuables_worker_spec.rb b/spec/workers/members_destroyer/unassign_issuables_worker_spec.rb index 2a325be1225..51fca67ae99 100644 --- a/spec/workers/members_destroyer/unassign_issuables_worker_spec.rb +++ b/spec/workers/members_destroyer/unassign_issuables_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MembersDestroyer::UnassignIssuablesWorker do +RSpec.describe MembersDestroyer::UnassignIssuablesWorker, feature_category: :user_management do let_it_be(:group) { create(:group, :private) } let_it_be(:user, reload: true) { create(:user) } diff --git a/spec/workers/merge_request_cleanup_refs_worker_spec.rb b/spec/workers/merge_request_cleanup_refs_worker_spec.rb index 1de927a81e4..a2df31037be 100644 --- a/spec/workers/merge_request_cleanup_refs_worker_spec.rb +++ b/spec/workers/merge_request_cleanup_refs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequestCleanupRefsWorker do +RSpec.describe MergeRequestCleanupRefsWorker, feature_category: :code_review_workflow do let(:worker) { described_class.new } describe '#perform_work' do @@ -30,12 +30,12 @@ RSpec.describe MergeRequestCleanupRefsWorker do expect(cleanup_schedule.completed_at).to be_nil end - context "and cleanup schedule has already failed #{described_class::FAILURE_THRESHOLD} times" do - let(:failed_count) { described_class::FAILURE_THRESHOLD } + context "and cleanup schedule has already failed #{WebHooks::AutoDisabling::FAILURE_THRESHOLD} times" do + let(:failed_count) { WebHooks::AutoDisabling::FAILURE_THRESHOLD } it 'marks the cleanup schedule as failed and track the failure' do expect(cleanup_schedule.reload).to be_failed - expect(cleanup_schedule.failed_count).to eq(described_class::FAILURE_THRESHOLD + 1) + expect(cleanup_schedule.failed_count).to eq(failed_count + 1) expect(cleanup_schedule.completed_at).to be_nil end end diff --git a/spec/workers/merge_request_mergeability_check_worker_spec.rb b/spec/workers/merge_request_mergeability_check_worker_spec.rb index 32debcf9651..fd959803006 100644 --- a/spec/workers/merge_request_mergeability_check_worker_spec.rb +++ b/spec/workers/merge_request_mergeability_check_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequestMergeabilityCheckWorker do +RSpec.describe MergeRequestMergeabilityCheckWorker, feature_category: :code_review_workflow do subject { described_class.new } describe '#perform' do diff --git a/spec/workers/merge_requests/close_issue_worker_spec.rb b/spec/workers/merge_requests/close_issue_worker_spec.rb index 72fb3be7470..0facd34e790 100644 --- a/spec/workers/merge_requests/close_issue_worker_spec.rb +++ b/spec/workers/merge_requests/close_issue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::CloseIssueWorker do +RSpec.describe MergeRequests::CloseIssueWorker, feature_category: :code_review_workflow do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/merge_requests/create_approval_event_worker_spec.rb b/spec/workers/merge_requests/create_approval_event_worker_spec.rb index 8389949ecc9..a9a46420fd5 100644 --- a/spec/workers/merge_requests/create_approval_event_worker_spec.rb +++ b/spec/workers/merge_requests/create_approval_event_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::CreateApprovalEventWorker do +RSpec.describe MergeRequests::CreateApprovalEventWorker, feature_category: :code_review_workflow do let!(:user) { create(:user) } let!(:project) { create(:project) } let!(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/workers/merge_requests/create_approval_note_worker_spec.rb b/spec/workers/merge_requests/create_approval_note_worker_spec.rb index f58d38599fc..1a9e15c18f0 100644 --- a/spec/workers/merge_requests/create_approval_note_worker_spec.rb +++ b/spec/workers/merge_requests/create_approval_note_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::CreateApprovalNoteWorker do +RSpec.describe MergeRequests::CreateApprovalNoteWorker, feature_category: :code_review_workflow do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/workers/merge_requests/delete_source_branch_worker_spec.rb b/spec/workers/merge_requests/delete_source_branch_worker_spec.rb index e17ad02e272..d8e49f444a9 100644 --- a/spec/workers/merge_requests/delete_source_branch_worker_spec.rb +++ b/spec/workers/merge_requests/delete_source_branch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::DeleteSourceBranchWorker do +RSpec.describe MergeRequests::DeleteSourceBranchWorker, feature_category: :source_code_management do let_it_be(:user) { create(:user) } let_it_be(:merge_request) { create(:merge_request, author: user) } diff --git a/spec/workers/merge_requests/execute_approval_hooks_worker_spec.rb b/spec/workers/merge_requests/execute_approval_hooks_worker_spec.rb index 0130ef63f50..13c97f8fe49 100644 --- a/spec/workers/merge_requests/execute_approval_hooks_worker_spec.rb +++ b/spec/workers/merge_requests/execute_approval_hooks_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::ExecuteApprovalHooksWorker do +RSpec.describe MergeRequests::ExecuteApprovalHooksWorker, feature_category: :source_code_management do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/workers/merge_requests/handle_assignees_change_worker_spec.rb b/spec/workers/merge_requests/handle_assignees_change_worker_spec.rb index 4b45f3562d6..f776c6408ed 100644 --- a/spec/workers/merge_requests/handle_assignees_change_worker_spec.rb +++ b/spec/workers/merge_requests/handle_assignees_change_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::HandleAssigneesChangeWorker do +RSpec.describe MergeRequests::HandleAssigneesChangeWorker, feature_category: :code_review_workflow do include AfterNextHelpers let_it_be(:merge_request) { create(:merge_request) } diff --git a/spec/workers/merge_requests/resolve_todos_after_approval_worker_spec.rb b/spec/workers/merge_requests/resolve_todos_after_approval_worker_spec.rb index f8316a8ff05..39443d48ff6 100644 --- a/spec/workers/merge_requests/resolve_todos_after_approval_worker_spec.rb +++ b/spec/workers/merge_requests/resolve_todos_after_approval_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::ResolveTodosAfterApprovalWorker do +RSpec.describe MergeRequests::ResolveTodosAfterApprovalWorker, feature_category: :code_review_workflow do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/workers/merge_requests/resolve_todos_worker_spec.rb b/spec/workers/merge_requests/resolve_todos_worker_spec.rb index 223b8b6803c..1164a1c1ddd 100644 --- a/spec/workers/merge_requests/resolve_todos_worker_spec.rb +++ b/spec/workers/merge_requests/resolve_todos_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::ResolveTodosWorker do +RSpec.describe MergeRequests::ResolveTodosWorker, feature_category: :code_review_workflow do include AfterNextHelpers let_it_be(:merge_request) { create(:merge_request) } diff --git a/spec/workers/merge_requests/update_head_pipeline_worker_spec.rb b/spec/workers/merge_requests/update_head_pipeline_worker_spec.rb index 3574b8296a4..912afb59412 100644 --- a/spec/workers/merge_requests/update_head_pipeline_worker_spec.rb +++ b/spec/workers/merge_requests/update_head_pipeline_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeRequests::UpdateHeadPipelineWorker do +RSpec.describe MergeRequests::UpdateHeadPipelineWorker, feature_category: :code_review_workflow do include ProjectForksHelper let_it_be(:project) { create(:project, :repository) } diff --git a/spec/workers/merge_worker_spec.rb b/spec/workers/merge_worker_spec.rb index 0268bc2388f..9c6a6564df6 100644 --- a/spec/workers/merge_worker_spec.rb +++ b/spec/workers/merge_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MergeWorker do +RSpec.describe MergeWorker, feature_category: :source_code_management do describe "remove source branch" do let!(:merge_request) { create(:merge_request, source_branch: "markdown") } let!(:source_project) { merge_request.source_project } diff --git a/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb b/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb index 491ea64cff1..c7e2bbc2ad9 100644 --- a/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb +++ b/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Metrics::Dashboard::PruneOldAnnotationsWorker do +RSpec.describe Metrics::Dashboard::PruneOldAnnotationsWorker, feature_category: :metrics do let_it_be(:now) { DateTime.parse('2020-06-02T00:12:00Z') } let_it_be(:two_weeks_old_annotation) { create(:metrics_dashboard_annotation, starting_at: now.advance(weeks: -2)) } let_it_be(:one_day_old_annotation) { create(:metrics_dashboard_annotation, starting_at: now.advance(days: -1)) } diff --git a/spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb b/spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb index e0a5a8fd448..75866a4eca2 100644 --- a/spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb +++ b/spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Metrics::Dashboard::ScheduleAnnotationsPruneWorker do +RSpec.describe Metrics::Dashboard::ScheduleAnnotationsPruneWorker, feature_category: :metrics do describe '#perform' do it 'schedules annotations prune job with default cut off date' do expect(Metrics::Dashboard::PruneOldAnnotationsWorker).to receive(:perform_async) diff --git a/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb b/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb index 4b670a753e7..f7d67b2064e 100644 --- a/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb +++ b/spec/workers/metrics/dashboard/sync_dashboards_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Metrics::Dashboard::SyncDashboardsWorker do +RSpec.describe Metrics::Dashboard::SyncDashboardsWorker, feature_category: :metrics do include MetricsDashboardHelpers subject(:worker) { described_class.new } diff --git a/spec/workers/migrate_external_diffs_worker_spec.rb b/spec/workers/migrate_external_diffs_worker_spec.rb index 36669b4e694..cb5e3ff3651 100644 --- a/spec/workers/migrate_external_diffs_worker_spec.rb +++ b/spec/workers/migrate_external_diffs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe MigrateExternalDiffsWorker do +RSpec.describe MigrateExternalDiffsWorker, feature_category: :code_review_workflow do let(:worker) { described_class.new } let(:diff) { create(:merge_request).merge_request_diff } diff --git a/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb b/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb index 2e7b6356692..237b5081bb1 100644 --- a/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb +++ b/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Namespaces::InProductMarketingEmailsWorker, '#perform', unless: Gitlab.ee? do +RSpec.describe Namespaces::InProductMarketingEmailsWorker, '#perform', unless: Gitlab.ee?, feature_category: :experimentation_activation do # Running this in EE would call the overridden method, which can't be tested in CE. # The EE code is covered in a separate EE spec. diff --git a/spec/workers/namespaces/process_sync_events_worker_spec.rb b/spec/workers/namespaces/process_sync_events_worker_spec.rb index 9f389089609..efa0053c145 100644 --- a/spec/workers/namespaces/process_sync_events_worker_spec.rb +++ b/spec/workers/namespaces/process_sync_events_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Namespaces::ProcessSyncEventsWorker do +RSpec.describe Namespaces::ProcessSyncEventsWorker, feature_category: :pods do let!(:group1) { create(:group) } let!(:group2) { create(:group) } let!(:group3) { create(:group) } diff --git a/spec/workers/namespaces/prune_aggregation_schedules_worker_spec.rb b/spec/workers/namespaces/prune_aggregation_schedules_worker_spec.rb index d8c60932d92..02856e16552 100644 --- a/spec/workers/namespaces/prune_aggregation_schedules_worker_spec.rb +++ b/spec/workers/namespaces/prune_aggregation_schedules_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Namespaces::PruneAggregationSchedulesWorker, '#perform', :clean_gitlab_redis_shared_state do +RSpec.describe Namespaces::PruneAggregationSchedulesWorker, '#perform', :clean_gitlab_redis_shared_state, feature_category: :source_code_management do include ExclusiveLeaseHelpers let(:namespaces) { create_list(:namespace, 5, :with_aggregation_schedule) } diff --git a/spec/workers/namespaces/root_statistics_worker_spec.rb b/spec/workers/namespaces/root_statistics_worker_spec.rb index e047c94816f..8409fffca26 100644 --- a/spec/workers/namespaces/root_statistics_worker_spec.rb +++ b/spec/workers/namespaces/root_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Namespaces::RootStatisticsWorker, '#perform' do +RSpec.describe Namespaces::RootStatisticsWorker, '#perform', feature_category: :source_code_management do let(:group) { create(:group, :with_aggregation_schedule) } subject(:worker) { described_class.new } diff --git a/spec/workers/namespaces/schedule_aggregation_worker_spec.rb b/spec/workers/namespaces/schedule_aggregation_worker_spec.rb index 62f9be501cc..69bd0f1ce47 100644 --- a/spec/workers/namespaces/schedule_aggregation_worker_spec.rb +++ b/spec/workers/namespaces/schedule_aggregation_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Namespaces::ScheduleAggregationWorker, '#perform', :clean_gitlab_redis_shared_state do +RSpec.describe Namespaces::ScheduleAggregationWorker, '#perform', :clean_gitlab_redis_shared_state, feature_category: :source_code_management do let(:group) { create(:group) } subject(:worker) { described_class.new } diff --git a/spec/workers/namespaces/update_root_statistics_worker_spec.rb b/spec/workers/namespaces/update_root_statistics_worker_spec.rb index f2f633a39ca..85fd68094ce 100644 --- a/spec/workers/namespaces/update_root_statistics_worker_spec.rb +++ b/spec/workers/namespaces/update_root_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Namespaces::UpdateRootStatisticsWorker do +RSpec.describe Namespaces::UpdateRootStatisticsWorker, feature_category: :source_code_management do let(:namespace_id) { 123 } let(:event) do diff --git a/spec/workers/new_issue_worker_spec.rb b/spec/workers/new_issue_worker_spec.rb index b9053b10419..540296374ef 100644 --- a/spec/workers/new_issue_worker_spec.rb +++ b/spec/workers/new_issue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe NewIssueWorker do +RSpec.describe NewIssueWorker, feature_category: :team_planning do include AfterNextHelpers describe '#perform' do diff --git a/spec/workers/new_merge_request_worker_spec.rb b/spec/workers/new_merge_request_worker_spec.rb index a8e1c3f4bf1..58f6792f9a0 100644 --- a/spec/workers/new_merge_request_worker_spec.rb +++ b/spec/workers/new_merge_request_worker_spec.rb @@ -107,18 +107,6 @@ RSpec.describe NewMergeRequestWorker, feature_category: :code_review_workflow do stub_feature_flags(add_prepared_state_to_mr: true) end - context 'when the merge request is prepared' do - before do - merge_request.update!(prepared_at: Time.current) - end - - it 'does not call the create service' do - expect(MergeRequests::AfterCreateService).not_to receive(:new) - - worker.perform(merge_request.id, user.id) - end - end - context 'when the merge request is not prepared' do it 'calls the create service' do expect_next_instance_of(MergeRequests::AfterCreateService, project: merge_request.target_project, current_user: user) do |service| diff --git a/spec/workers/new_note_worker_spec.rb b/spec/workers/new_note_worker_spec.rb index 7ba3fe94254..651b5742854 100644 --- a/spec/workers/new_note_worker_spec.rb +++ b/spec/workers/new_note_worker_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe NewNoteWorker do +RSpec.describe NewNoteWorker, feature_category: :team_planning do context 'when Note found' do let(:note) { create(:note) } diff --git a/spec/workers/object_pool/create_worker_spec.rb b/spec/workers/object_pool/create_worker_spec.rb index 4ec409bdf47..573cb3413f5 100644 --- a/spec/workers/object_pool/create_worker_spec.rb +++ b/spec/workers/object_pool/create_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ObjectPool::CreateWorker do +RSpec.describe ObjectPool::CreateWorker, feature_category: :shared do let(:pool) { create(:pool_repository, :scheduled) } subject { described_class.new } diff --git a/spec/workers/object_pool/destroy_worker_spec.rb b/spec/workers/object_pool/destroy_worker_spec.rb index 130a666a42e..f83d3814c63 100644 --- a/spec/workers/object_pool/destroy_worker_spec.rb +++ b/spec/workers/object_pool/destroy_worker_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe ObjectPool::DestroyWorker do +RSpec.describe ObjectPool::DestroyWorker, feature_category: :shared do describe '#perform' do context 'when no pool is in the database' do it "doesn't raise an error" do diff --git a/spec/workers/object_pool/join_worker_spec.rb b/spec/workers/object_pool/join_worker_spec.rb index 335c45e14e0..e0173cad53b 100644 --- a/spec/workers/object_pool/join_worker_spec.rb +++ b/spec/workers/object_pool/join_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ObjectPool::JoinWorker do +RSpec.describe ObjectPool::JoinWorker, feature_category: :shared do let(:pool) { create(:pool_repository, :ready) } let(:project) { pool.source_project } let(:repository) { project.repository } diff --git a/spec/workers/onboarding/issue_created_worker_spec.rb b/spec/workers/onboarding/issue_created_worker_spec.rb index 70a0156d444..d12f51ceff6 100644 --- a/spec/workers/onboarding/issue_created_worker_spec.rb +++ b/spec/workers/onboarding/issue_created_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Onboarding::IssueCreatedWorker, '#perform' do +RSpec.describe Onboarding::IssueCreatedWorker, '#perform', feature_category: :onboarding do let_it_be(:issue) { create(:issue) } let(:namespace) { issue.project.namespace } diff --git a/spec/workers/onboarding/pipeline_created_worker_spec.rb b/spec/workers/onboarding/pipeline_created_worker_spec.rb index 75bdea28eef..e6dc0f9b689 100644 --- a/spec/workers/onboarding/pipeline_created_worker_spec.rb +++ b/spec/workers/onboarding/pipeline_created_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Onboarding::PipelineCreatedWorker, '#perform' do +RSpec.describe Onboarding::PipelineCreatedWorker, '#perform', feature_category: :onboarding do let_it_be(:ci_pipeline) { create(:ci_pipeline) } it_behaves_like 'records an onboarding progress action', :pipeline_created do diff --git a/spec/workers/onboarding/progress_worker_spec.rb b/spec/workers/onboarding/progress_worker_spec.rb index bbf4875069e..da760c23367 100644 --- a/spec/workers/onboarding/progress_worker_spec.rb +++ b/spec/workers/onboarding/progress_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Onboarding::ProgressWorker, '#perform' do +RSpec.describe Onboarding::ProgressWorker, '#perform', feature_category: :onboarding do let_it_be(:namespace) { create(:namespace) } let_it_be(:action) { 'git_pull' } diff --git a/spec/workers/onboarding/user_added_worker_spec.rb b/spec/workers/onboarding/user_added_worker_spec.rb index 6dbd875c93b..d32bd5ee19c 100644 --- a/spec/workers/onboarding/user_added_worker_spec.rb +++ b/spec/workers/onboarding/user_added_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Onboarding::UserAddedWorker, '#perform' do +RSpec.describe Onboarding::UserAddedWorker, '#perform', feature_category: :onboarding do let_it_be(:namespace) { create(:group) } subject { described_class.new.perform(namespace.id) } diff --git a/spec/workers/packages/cleanup/execute_policy_worker_spec.rb b/spec/workers/packages/cleanup/execute_policy_worker_spec.rb index 6325a82ed3d..fc3ed1f3a05 100644 --- a/spec/workers/packages/cleanup/execute_policy_worker_spec.rb +++ b/spec/workers/packages/cleanup/execute_policy_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::Cleanup::ExecutePolicyWorker do +RSpec.describe Packages::Cleanup::ExecutePolicyWorker, feature_category: :package_registry do let(:worker) { described_class.new } describe '#perform_work' do diff --git a/spec/workers/packages/cleanup_package_file_worker_spec.rb b/spec/workers/packages/cleanup_package_file_worker_spec.rb index 95cf65c18c5..6e42565abbc 100644 --- a/spec/workers/packages/cleanup_package_file_worker_spec.rb +++ b/spec/workers/packages/cleanup_package_file_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::CleanupPackageFileWorker do +RSpec.describe Packages::CleanupPackageFileWorker, feature_category: :package_registry do let_it_be_with_reload(:package) { create(:package) } let(:worker) { described_class.new } diff --git a/spec/workers/packages/cleanup_package_registry_worker_spec.rb b/spec/workers/packages/cleanup_package_registry_worker_spec.rb index e12f2198f66..f70103070ef 100644 --- a/spec/workers/packages/cleanup_package_registry_worker_spec.rb +++ b/spec/workers/packages/cleanup_package_registry_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::CleanupPackageRegistryWorker do +RSpec.describe Packages::CleanupPackageRegistryWorker, feature_category: :package_registry do describe '#perform' do let_it_be_with_reload(:package_files) { create_list(:package_file, 2, :pending_destruction) } let_it_be(:policy) { create(:packages_cleanup_policy, :runnable) } diff --git a/spec/workers/packages/composer/cache_cleanup_worker_spec.rb b/spec/workers/packages/composer/cache_cleanup_worker_spec.rb index 39eac4e4ae1..67d4ce36437 100644 --- a/spec/workers/packages/composer/cache_cleanup_worker_spec.rb +++ b/spec/workers/packages/composer/cache_cleanup_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::Composer::CacheCleanupWorker, type: :worker do +RSpec.describe Packages::Composer::CacheCleanupWorker, type: :worker, feature_category: :package_registry do describe '#perform' do let_it_be(:group) { create(:group) } diff --git a/spec/workers/packages/composer/cache_update_worker_spec.rb b/spec/workers/packages/composer/cache_update_worker_spec.rb index 6c17d49e986..cc3047895d4 100644 --- a/spec/workers/packages/composer/cache_update_worker_spec.rb +++ b/spec/workers/packages/composer/cache_update_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::Composer::CacheUpdateWorker, type: :worker do +RSpec.describe Packages::Composer::CacheUpdateWorker, type: :worker, feature_category: :package_registry do describe '#perform' do let_it_be(:package_name) { 'sample-project' } let_it_be(:json) { { 'name' => package_name } } diff --git a/spec/workers/packages/debian/generate_distribution_worker_spec.rb b/spec/workers/packages/debian/generate_distribution_worker_spec.rb index c4e974ec8eb..acdfcc5275f 100644 --- a/spec/workers/packages/debian/generate_distribution_worker_spec.rb +++ b/spec/workers/packages/debian/generate_distribution_worker_spec.rb @@ -4,13 +4,13 @@ require 'spec_helper' RSpec.describe Packages::Debian::GenerateDistributionWorker, type: :worker, feature_category: :package_registry do describe '#perform' do - let(:container_type) { distribution.container_type } + let(:container_type_as_string) { container_type.to_s } let(:distribution_id) { distribution.id } - subject { described_class.new.perform(container_type, distribution_id) } + subject { described_class.new.perform(container_type_as_string, distribution_id) } - let(:subject2) { described_class.new.perform(container_type, distribution_id) } - let(:subject3) { described_class.new.perform(container_type, distribution_id) } + let(:subject2) { described_class.new.perform(container_type_as_string, distribution_id) } + let(:subject3) { described_class.new.perform(container_type_as_string, distribution_id) } include_context 'with published Debian package' @@ -54,7 +54,7 @@ RSpec.describe Packages::Debian::GenerateDistributionWorker, type: :worker, feat context 'with valid parameters' do it_behaves_like 'an idempotent worker' do - let(:job_args) { [container_type, distribution_id] } + let(:job_args) { [container_type_as_string, distribution_id] } it_behaves_like 'Generate Debian Distribution and component files' end diff --git a/spec/workers/packages/debian/process_changes_worker_spec.rb b/spec/workers/packages/debian/process_changes_worker_spec.rb index b96b75e93b9..ddd608e768c 100644 --- a/spec/workers/packages/debian/process_changes_worker_spec.rb +++ b/spec/workers/packages/debian/process_changes_worker_spec.rb @@ -88,7 +88,7 @@ RSpec.describe Packages::Debian::ProcessChangesWorker, type: :worker, feature_ca expect { subject } .to not_change { Packages::Package.count } .and change { Packages::PackageFile.count }.by(-1) - .and change { incoming.package_files.count }.from(7).to(6) + .and change { incoming.package_files.count }.from(8).to(7) end end @@ -104,7 +104,7 @@ RSpec.describe Packages::Debian::ProcessChangesWorker, type: :worker, feature_ca expect { subject } .to not_change { Packages::Package.count } .and change { Packages::PackageFile.count }.by(-1) - .and change { incoming.package_files.count }.from(7).to(6) + .and change { incoming.package_files.count }.from(8).to(7) expect { package_file.reload }.to raise_error(ActiveRecord::RecordNotFound) end @@ -120,7 +120,7 @@ RSpec.describe Packages::Debian::ProcessChangesWorker, type: :worker, feature_ca expect { subject } .to change { Packages::Package.count }.from(1).to(2) .and not_change { Packages::PackageFile.count } - .and change { incoming.package_files.count }.from(7).to(0) + .and change { incoming.package_files.count }.from(8).to(0) .and change { package_file&.debian_file_metadatum&.reload&.file_type }.from('unknown').to('changes') created_package = Packages::Package.last diff --git a/spec/workers/packages/debian/process_package_file_worker_spec.rb b/spec/workers/packages/debian/process_package_file_worker_spec.rb index 239ee8e1035..44769ec6a14 100644 --- a/spec/workers/packages/debian/process_package_file_worker_spec.rb +++ b/spec/workers/packages/debian/process_package_file_worker_spec.rb @@ -31,6 +31,7 @@ RSpec.describe Packages::Debian::ProcessPackageFileWorker, type: :worker, featur where(:case_name, :expected_file_type, :file_name, :component_name) do 'with a deb' | 'deb' | 'libsample0_1.2.3~alpha2_amd64.deb' | 'main' 'with an udeb' | 'udeb' | 'sample-udeb_1.2.3~alpha2_amd64.udeb' | 'contrib' + 'with a ddeb' | 'ddeb' | 'sample-ddeb_1.2.3~alpha2_amd64.ddeb' | 'main' end with_them do diff --git a/spec/workers/packages/go/sync_packages_worker_spec.rb b/spec/workers/packages/go/sync_packages_worker_spec.rb index 5eeef1f7c08..5fdb7a242f6 100644 --- a/spec/workers/packages/go/sync_packages_worker_spec.rb +++ b/spec/workers/packages/go/sync_packages_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::Go::SyncPackagesWorker, type: :worker do +RSpec.describe Packages::Go::SyncPackagesWorker, type: :worker, feature_category: :package_registry do include_context 'basic Go module' before do diff --git a/spec/workers/packages/helm/extraction_worker_spec.rb b/spec/workers/packages/helm/extraction_worker_spec.rb index 70a090d6989..a764c2ad939 100644 --- a/spec/workers/packages/helm/extraction_worker_spec.rb +++ b/spec/workers/packages/helm/extraction_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::Helm::ExtractionWorker, type: :worker do +RSpec.describe Packages::Helm::ExtractionWorker, type: :worker, feature_category: :package_registry do describe '#perform' do let_it_be(:package) { create(:helm_package, without_package_files: true, status: 'processing') } diff --git a/spec/workers/packages/mark_package_files_for_destruction_worker_spec.rb b/spec/workers/packages/mark_package_files_for_destruction_worker_spec.rb index 15d9e4c347b..29fbf17d49a 100644 --- a/spec/workers/packages/mark_package_files_for_destruction_worker_spec.rb +++ b/spec/workers/packages/mark_package_files_for_destruction_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::MarkPackageFilesForDestructionWorker, :aggregate_failures do +RSpec.describe Packages::MarkPackageFilesForDestructionWorker, :aggregate_failures, feature_category: :package_registry do describe '#perform' do let_it_be(:package) { create(:package) } let_it_be(:package_files) { create_list(:package_file, 3, package: package) } diff --git a/spec/workers/packages/nuget/extraction_worker_spec.rb b/spec/workers/packages/nuget/extraction_worker_spec.rb index 5186c037dc5..d6cc2315fb3 100644 --- a/spec/workers/packages/nuget/extraction_worker_spec.rb +++ b/spec/workers/packages/nuget/extraction_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::Nuget::ExtractionWorker, type: :worker do +RSpec.describe Packages::Nuget::ExtractionWorker, type: :worker, feature_category: :package_registry do describe '#perform' do let!(:package) { create(:nuget_package) } let(:package_file) { package.package_files.first } diff --git a/spec/workers/packages/rubygems/extraction_worker_spec.rb b/spec/workers/packages/rubygems/extraction_worker_spec.rb index 0e67f3ac62e..8ad4c2e6447 100644 --- a/spec/workers/packages/rubygems/extraction_worker_spec.rb +++ b/spec/workers/packages/rubygems/extraction_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Packages::Rubygems::ExtractionWorker, type: :worker do +RSpec.describe Packages::Rubygems::ExtractionWorker, type: :worker, feature_category: :package_registry do describe '#perform' do let_it_be(:package) { create(:rubygems_package, :processing) } diff --git a/spec/workers/pages_domain_removal_cron_worker_spec.rb b/spec/workers/pages_domain_removal_cron_worker_spec.rb index f152d019de6..eb9f87bd831 100644 --- a/spec/workers/pages_domain_removal_cron_worker_spec.rb +++ b/spec/workers/pages_domain_removal_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PagesDomainRemovalCronWorker do +RSpec.describe PagesDomainRemovalCronWorker, feature_category: :pages do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb b/spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb index 70ffef5342e..5711b7787ea 100644 --- a/spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb +++ b/spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PagesDomainSslRenewalCronWorker do +RSpec.describe PagesDomainSslRenewalCronWorker, feature_category: :pages do include LetsEncryptHelpers subject(:worker) { described_class.new } diff --git a/spec/workers/pages_domain_ssl_renewal_worker_spec.rb b/spec/workers/pages_domain_ssl_renewal_worker_spec.rb index f8149b23a08..daaa939ecfe 100644 --- a/spec/workers/pages_domain_ssl_renewal_worker_spec.rb +++ b/spec/workers/pages_domain_ssl_renewal_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PagesDomainSslRenewalWorker do +RSpec.describe PagesDomainSslRenewalWorker, feature_category: :pages do include LetsEncryptHelpers subject(:worker) { described_class.new } diff --git a/spec/workers/pages_domain_verification_cron_worker_spec.rb b/spec/workers/pages_domain_verification_cron_worker_spec.rb index 01eaf984c90..be30e45fc94 100644 --- a/spec/workers/pages_domain_verification_cron_worker_spec.rb +++ b/spec/workers/pages_domain_verification_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PagesDomainVerificationCronWorker do +RSpec.describe PagesDomainVerificationCronWorker, feature_category: :pages do subject(:worker) { described_class.new } describe '#perform', :sidekiq do diff --git a/spec/workers/pages_domain_verification_worker_spec.rb b/spec/workers/pages_domain_verification_worker_spec.rb index 6d2f9ee2f8d..08f383c954f 100644 --- a/spec/workers/pages_domain_verification_worker_spec.rb +++ b/spec/workers/pages_domain_verification_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PagesDomainVerificationWorker do +RSpec.describe PagesDomainVerificationWorker, feature_category: :pages do subject(:worker) { described_class.new } let(:domain) { create(:pages_domain) } diff --git a/spec/workers/pages_worker_spec.rb b/spec/workers/pages_worker_spec.rb index f0d29037fa4..74da4707205 100644 --- a/spec/workers/pages_worker_spec.rb +++ b/spec/workers/pages_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PagesWorker, :sidekiq_inline do +RSpec.describe PagesWorker, :sidekiq_inline, feature_category: :pages do let_it_be(:ci_build) { create(:ci_build) } context 'when called with the deploy action' do diff --git a/spec/workers/partition_creation_worker_spec.rb b/spec/workers/partition_creation_worker_spec.rb index 5d15870b7f6..ab525fd5ce2 100644 --- a/spec/workers/partition_creation_worker_spec.rb +++ b/spec/workers/partition_creation_worker_spec.rb @@ -2,7 +2,7 @@ # require 'spec_helper' -RSpec.describe PartitionCreationWorker do +RSpec.describe PartitionCreationWorker, feature_category: :database do subject { described_class.new.perform } let(:management_worker) { double } 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 7c3c48b3f80..7a3491b49d6 100644 --- a/spec/workers/personal_access_tokens/expired_notification_worker_spec.rb +++ b/spec/workers/personal_access_tokens/expired_notification_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PersonalAccessTokens::ExpiredNotificationWorker, type: :worker do +RSpec.describe PersonalAccessTokens::ExpiredNotificationWorker, type: :worker, feature_category: :system_access do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/personal_access_tokens/expiring_worker_spec.rb b/spec/workers/personal_access_tokens/expiring_worker_spec.rb index 7fa777b911a..01ce4e85fe2 100644 --- a/spec/workers/personal_access_tokens/expiring_worker_spec.rb +++ b/spec/workers/personal_access_tokens/expiring_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PersonalAccessTokens::ExpiringWorker, type: :worker do +RSpec.describe PersonalAccessTokens::ExpiringWorker, type: :worker, feature_category: :system_access do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/pipeline_hooks_worker_spec.rb b/spec/workers/pipeline_hooks_worker_spec.rb index 5d28b1e129a..a8b0f91bf7d 100644 --- a/spec/workers/pipeline_hooks_worker_spec.rb +++ b/spec/workers/pipeline_hooks_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PipelineHooksWorker do +RSpec.describe PipelineHooksWorker, feature_category: :continuous_integration do describe '#perform' do context 'when pipeline exists' do let(:pipeline) { create(:ci_pipeline) } diff --git a/spec/workers/pipeline_metrics_worker_spec.rb b/spec/workers/pipeline_metrics_worker_spec.rb index c73b84e26a6..f7b397d91a6 100644 --- a/spec/workers/pipeline_metrics_worker_spec.rb +++ b/spec/workers/pipeline_metrics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PipelineMetricsWorker do +RSpec.describe PipelineMetricsWorker, feature_category: :continuous_integration do let(:project) { create(:project, :repository) } let!(:merge_request) do diff --git a/spec/workers/pipeline_notification_worker_spec.rb b/spec/workers/pipeline_notification_worker_spec.rb index 672debd0501..05d0186e873 100644 --- a/spec/workers/pipeline_notification_worker_spec.rb +++ b/spec/workers/pipeline_notification_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PipelineNotificationWorker, :mailer do +RSpec.describe PipelineNotificationWorker, :mailer, feature_category: :continuous_integration do let_it_be(:pipeline) { create(:ci_pipeline) } describe '#execute' do diff --git a/spec/workers/pipeline_process_worker_spec.rb b/spec/workers/pipeline_process_worker_spec.rb index 6e95b7a4753..6c6851c51ce 100644 --- a/spec/workers/pipeline_process_worker_spec.rb +++ b/spec/workers/pipeline_process_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PipelineProcessWorker do +RSpec.describe PipelineProcessWorker, feature_category: :continuous_integration do let_it_be(:pipeline) { create(:ci_pipeline) } include_examples 'an idempotent worker' do diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 210987555c9..bd1bfc46d53 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PostReceive do +RSpec.describe PostReceive, feature_category: :source_code_management do include AfterNextHelpers let(:changes) do @@ -280,7 +280,6 @@ RSpec.describe PostReceive do let(:category) { described_class.name } let(:namespace) { project.namespace } let(:user) { project.creator } - let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } let(:label) { 'counts.source_code_pushes' } let(:property) { 'source_code_pushes' } let(:context) { [Gitlab::Tracking::ServicePingContext.new(data_source: :redis, key_path: label).to_h] } diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb index 143809e8f2a..1fc77c42cbc 100644 --- a/spec/workers/process_commit_worker_spec.rb +++ b/spec/workers/process_commit_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ProcessCommitWorker do +RSpec.describe ProcessCommitWorker, feature_category: :source_code_management do let(:worker) { described_class.new } let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } diff --git a/spec/workers/project_cache_worker_spec.rb b/spec/workers/project_cache_worker_spec.rb index 3c807ef9ffd..508dacea2fb 100644 --- a/spec/workers/project_cache_worker_spec.rb +++ b/spec/workers/project_cache_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ProjectCacheWorker do +RSpec.describe ProjectCacheWorker, feature_category: :source_code_management do include ExclusiveLeaseHelpers let_it_be(:project) { create(:project, :repository) } diff --git a/spec/workers/project_destroy_worker_spec.rb b/spec/workers/project_destroy_worker_spec.rb index 25508928bbf..d699393d7a0 100644 --- a/spec/workers/project_destroy_worker_spec.rb +++ b/spec/workers/project_destroy_worker_spec.rb @@ -2,15 +2,26 @@ require 'spec_helper' -RSpec.describe ProjectDestroyWorker do - let(:project) { create(:project, :repository, pending_delete: true) } - let!(:repository) { project.repository.raw } +RSpec.describe ProjectDestroyWorker, feature_category: :source_code_management do + let_it_be(:project) { create(:project, :repository, pending_delete: true) } + let_it_be(:repository) { project.repository.raw } - subject { described_class.new } + let(:user) { project.first_owner } + + subject(:worker) { described_class.new } + + include_examples 'an idempotent worker' do + let(:job_args) { [project.id, user.id, {}] } + + it 'does not change projects when run twice' do + expect { worker.perform(project.id, user.id, {}) }.to change { Project.count }.by(-1) + expect { worker.perform(project.id, user.id, {}) }.not_to change { Project.count } + end + end describe '#perform' do it 'deletes the project' do - subject.perform(project.id, project.first_owner.id, {}) + worker.perform(project.id, user.id, {}) expect(Project.all).not_to include(project) expect(repository).not_to exist @@ -18,13 +29,13 @@ RSpec.describe ProjectDestroyWorker do it 'does not raise error when project could not be found' do expect do - subject.perform(-1, project.first_owner.id, {}) + worker.perform(-1, user.id, {}) end.not_to raise_error end it 'does not raise error when user could not be found' do expect do - subject.perform(project.id, -1, {}) + worker.perform(project.id, -1, {}) end.not_to raise_error end end diff --git a/spec/workers/project_export_worker_spec.rb b/spec/workers/project_export_worker_spec.rb index dd0a921059d..eaf1536da63 100644 --- a/spec/workers/project_export_worker_spec.rb +++ b/spec/workers/project_export_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ProjectExportWorker do +RSpec.describe ProjectExportWorker, feature_category: :importers do it_behaves_like 'export worker' context 'exporters duration measuring' do diff --git a/spec/workers/projects/after_import_worker_spec.rb b/spec/workers/projects/after_import_worker_spec.rb index 85d15c89b0a..5af4f49d6e0 100644 --- a/spec/workers/projects/after_import_worker_spec.rb +++ b/spec/workers/projects/after_import_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::AfterImportWorker do +RSpec.describe Projects::AfterImportWorker, feature_category: :importers do subject { worker.perform(project.id) } let(:worker) { described_class.new } diff --git a/spec/workers/projects/finalize_project_statistics_refresh_worker_spec.rb b/spec/workers/projects/finalize_project_statistics_refresh_worker_spec.rb index 932ba29f806..1379b6785eb 100644 --- a/spec/workers/projects/finalize_project_statistics_refresh_worker_spec.rb +++ b/spec/workers/projects/finalize_project_statistics_refresh_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::FinalizeProjectStatisticsRefreshWorker do +RSpec.describe Projects::FinalizeProjectStatisticsRefreshWorker, feature_category: :projects do let_it_be(:record) { create(:project_build_artifacts_size_refresh, :finalizing) } describe '#perform' do diff --git a/spec/workers/projects/import_export/create_relation_exports_worker_spec.rb b/spec/workers/projects/import_export/create_relation_exports_worker_spec.rb new file mode 100644 index 00000000000..2ff91150fda --- /dev/null +++ b/spec/workers/projects/import_export/create_relation_exports_worker_spec.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Projects::ImportExport::CreateRelationExportsWorker, feature_category: :importers do + let_it_be(:user) { build_stubbed(:user) } + let_it_be(:project) { create(:project) } + + let(:after_export_strategy) { {} } + let(:job_args) { [user.id, project.id, after_export_strategy] } + + before do + allow_next_instance_of(described_class) do |job| + allow(job).to receive(:jid) { SecureRandom.hex(8) } + end + end + + it_behaves_like 'an idempotent worker' + + context 'when job is re-enqueued after an interuption and same JID is used' do + before do + allow_next_instance_of(described_class) do |job| + allow(job).to receive(:jid).and_return(1234) + end + end + + it_behaves_like 'an idempotent worker' + + it 'does not start the export process twice' do + project.export_jobs.create!(jid: 1234, status_event: :start) + + expect { described_class.new.perform(user.id, project.id, after_export_strategy) } + .to change { Projects::ImportExport::WaitRelationExportsWorker.jobs.size }.by(0) + end + end + + it 'creates a export_job and sets the status to `started`' do + described_class.new.perform(user.id, project.id, after_export_strategy) + + export_job = project.export_jobs.last + expect(export_job.started?).to eq(true) + end + + it 'creates relation export records and enqueues a worker for each relation to be exported' do + allow(Projects::ImportExport::RelationExport).to receive(:relation_names_list).and_return(%w[relation_1 relation_2]) + + expect { described_class.new.perform(user.id, project.id, after_export_strategy) } + .to change { Projects::ImportExport::RelationExportWorker.jobs.size }.by(2) + + relation_exports = project.export_jobs.last.relation_exports + expect(relation_exports.collect(&:relation)).to match_array(%w[relation_1 relation_2]) + end + + it 'enqueues a WaitRelationExportsWorker' do + allow(Projects::ImportExport::WaitRelationExportsWorker).to receive(:perform_in) + + described_class.new.perform(user.id, project.id, after_export_strategy) + + export_job = project.export_jobs.last + expect(Projects::ImportExport::WaitRelationExportsWorker).to have_received(:perform_in).with( + described_class::INITIAL_DELAY, + export_job.id, + user.id, + after_export_strategy + ) + end +end diff --git a/spec/workers/projects/import_export/relation_export_worker_spec.rb b/spec/workers/projects/import_export/relation_export_worker_spec.rb index 236650fe55b..16ee73040b1 100644 --- a/spec/workers/projects/import_export/relation_export_worker_spec.rb +++ b/spec/workers/projects/import_export/relation_export_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::ImportExport::RelationExportWorker, type: :worker do +RSpec.describe Projects::ImportExport::RelationExportWorker, type: :worker, feature_category: :importers do let(:project_relation_export) { create(:project_relation_export) } let(:job_args) { [project_relation_export.id] } @@ -11,26 +11,61 @@ RSpec.describe Projects::ImportExport::RelationExportWorker, type: :worker do describe '#perform' do subject(:worker) { described_class.new } - context 'when relation export has initial state queued' do - let(:project_relation_export) { create(:project_relation_export) } + context 'when relation export has initial status `queued`' do + it 'exports the relation' do + expect_next_instance_of(Projects::ImportExport::RelationExportService) do |service| + expect(service).to receive(:execute) + end - it 'calls RelationExportService' do + worker.perform(project_relation_export.id) + end + end + + context 'when relation export has status `started`' do + let(:project_relation_export) { create(:project_relation_export, :started) } + + it 'retries the export of the relation' do expect_next_instance_of(Projects::ImportExport::RelationExportService) do |service| expect(service).to receive(:execute) end worker.perform(project_relation_export.id) + + expect(project_relation_export.reload.queued?).to eq(true) end end - context 'when relation export does not have queued state' do - let(:project_relation_export) { create(:project_relation_export, status_event: :start) } + context 'when relation export does not have status `queued` or `started`' do + let(:project_relation_export) { create(:project_relation_export, :finished) } - it 'does not call RelationExportService' do + it 'does not export the relation' do expect(Projects::ImportExport::RelationExportService).not_to receive(:new) worker.perform(project_relation_export.id) end end end + + describe '.sidekiq_retries_exhausted' do + let(:job) { { 'args' => [project_relation_export.id], 'error_message' => 'Error message' } } + + it 'sets relation export status to `failed`' do + described_class.sidekiq_retries_exhausted_block.call(job) + + expect(project_relation_export.reload.failed?).to eq(true) + end + + it 'logs the error message' do + expect_next_instance_of(Gitlab::Export::Logger) do |logger| + expect(logger).to receive(:error).with( + hash_including( + message: 'Project relation export failed', + export_error: 'Error message' + ) + ) + end + + described_class.sidekiq_retries_exhausted_block.call(job) + end + end end diff --git a/spec/workers/projects/import_export/wait_relation_exports_worker_spec.rb b/spec/workers/projects/import_export/wait_relation_exports_worker_spec.rb new file mode 100644 index 00000000000..52394b8998e --- /dev/null +++ b/spec/workers/projects/import_export/wait_relation_exports_worker_spec.rb @@ -0,0 +1,123 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Projects::ImportExport::WaitRelationExportsWorker, feature_category: :importers do + let_it_be(:user) { create(:user) } + let_it_be(:project_export_job) { create(:project_export_job, :started) } + + let(:after_export_strategy) { {} } + let(:job_args) { [project_export_job.id, user.id, after_export_strategy] } + + def create_relation_export(trait, relation, export_error = nil) + create(:project_relation_export, trait, + { project_export_job: project_export_job, relation: relation, export_error: export_error } + ) + end + + before do + allow_next_instance_of(described_class) do |job| + allow(job).to receive(:jid) { SecureRandom.hex(8) } + end + end + + context 'when export job status is not `started`' do + it 'does not perform any operation and finishes the worker' do + finished_export_job = create(:project_export_job, :finished) + + expect { described_class.new.perform(finished_export_job.id, user.id, after_export_strategy) } + .to change { Projects::ImportExport::ParallelProjectExportWorker.jobs.size }.by(0) + .and change { described_class.jobs.size }.by(0) + end + end + + context 'when there are relation exports with status `queued`' do + before do + create_relation_export(:finished, 'labels') + create_relation_export(:started, 'milestones') + create_relation_export(:queued, 'merge_requests') + end + + it 'does not enqueue ParallelProjectExportWorker and re-enqueue WaitRelationExportsWorker' do + expect { described_class.new.perform(*job_args) } + .to change { Projects::ImportExport::ParallelProjectExportWorker.jobs.size }.by(0) + .and change { described_class.jobs.size }.by(1) + end + end + + context 'when there are relation exports with status `started`' do + let(:started_relation_export) { create_relation_export(:started, 'releases') } + + before do + create_relation_export(:finished, 'labels') + create_relation_export(:queued, 'merge_requests') + end + + context 'when the Sidekiq Job exporting the relation is still running' do + it "does not change relation export's status and re-enqueue WaitRelationExportsWorker" do + allow(Gitlab::SidekiqStatus).to receive(:running?).with(started_relation_export.jid).and_return(true) + + expect { described_class.new.perform(*job_args) } + .to change { described_class.jobs.size }.by(1) + + expect(started_relation_export.reload.started?).to eq(true) + end + end + + context 'when the Sidekiq Job exporting the relation is still is no longer running' do + it "set the relation export's status to `failed`" do + allow(Gitlab::SidekiqStatus).to receive(:running?).with(started_relation_export.jid).and_return(false) + + expect { described_class.new.perform(*job_args) } + .to change { described_class.jobs.size }.by(1) + + expect(started_relation_export.reload.failed?).to eq(true) + end + end + end + + context 'when all relation exports have status `finished`' do + before do + create_relation_export(:finished, 'labels') + create_relation_export(:finished, 'issues') + end + + it 'enqueues ParallelProjectExportWorker and does not reenqueue WaitRelationExportsWorker' do + expect { described_class.new.perform(*job_args) } + .to change { Projects::ImportExport::ParallelProjectExportWorker.jobs.size }.by(1) + .and change { described_class.jobs.size }.by(0) + end + + it_behaves_like 'an idempotent worker' + end + + context 'when at least one relation export has status `failed` and the rest have status `finished` or `failed`' do + before do + create_relation_export(:finished, 'labels') + create_relation_export(:failed, 'issues', 'Failed to export issues') + create_relation_export(:failed, 'releases', 'Failed to export releases') + end + + it_behaves_like 'an idempotent worker' do + it 'notifies the failed exports to the user' do + expect_next_instance_of(NotificationService) do |notification_service| + expect(notification_service).to receive(:project_not_exported) + .with( + project_export_job.project, + user, + array_including(['Failed to export issues', 'Failed to export releases']) + ) + .once + end + + described_class.new.perform(*job_args) + end + end + + it 'does not enqueue ParallelProjectExportWorker and re-enqueue WaitRelationExportsWorker' do + expect { described_class.new.perform(*job_args) } + .to change { Projects::ImportExport::ParallelProjectExportWorker.jobs.size }.by(0) + .and change { described_class.jobs.size }.by(0) + end + end +end diff --git a/spec/workers/projects/inactive_projects_deletion_cron_worker_spec.rb b/spec/workers/projects/inactive_projects_deletion_cron_worker_spec.rb index f3c6434dc85..15234827efa 100644 --- a/spec/workers/projects/inactive_projects_deletion_cron_worker_spec.rb +++ b/spec/workers/projects/inactive_projects_deletion_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::InactiveProjectsDeletionCronWorker do +RSpec.describe Projects::InactiveProjectsDeletionCronWorker, feature_category: :compliance_management do include ProjectHelpers shared_examples 'worker is running for more than 4 minutes' do diff --git a/spec/workers/projects/inactive_projects_deletion_notification_worker_spec.rb b/spec/workers/projects/inactive_projects_deletion_notification_worker_spec.rb index 3ddfec0d346..28668188497 100644 --- a/spec/workers/projects/inactive_projects_deletion_notification_worker_spec.rb +++ b/spec/workers/projects/inactive_projects_deletion_notification_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::InactiveProjectsDeletionNotificationWorker do +RSpec.describe Projects::InactiveProjectsDeletionNotificationWorker, feature_category: :compliance_management do describe "#perform" do subject(:worker) { described_class.new } diff --git a/spec/workers/projects/post_creation_worker_spec.rb b/spec/workers/projects/post_creation_worker_spec.rb index b702eed9ea4..2c50a07cf48 100644 --- a/spec/workers/projects/post_creation_worker_spec.rb +++ b/spec/workers/projects/post_creation_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::PostCreationWorker do +RSpec.describe Projects::PostCreationWorker, feature_category: :source_code_management do let_it_be(:user) { create :user } let(:worker) { described_class.new } diff --git a/spec/workers/projects/process_sync_events_worker_spec.rb b/spec/workers/projects/process_sync_events_worker_spec.rb index a10a4797b2c..77ccf14a32b 100644 --- a/spec/workers/projects/process_sync_events_worker_spec.rb +++ b/spec/workers/projects/process_sync_events_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::ProcessSyncEventsWorker do +RSpec.describe Projects::ProcessSyncEventsWorker, feature_category: :pods do let!(:group) { create(:group) } let!(:project) { create(:project) } diff --git a/spec/workers/projects/record_target_platforms_worker_spec.rb b/spec/workers/projects/record_target_platforms_worker_spec.rb index 01852f252b7..c1e99d52473 100644 --- a/spec/workers/projects/record_target_platforms_worker_spec.rb +++ b/spec/workers/projects/record_target_platforms_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::RecordTargetPlatformsWorker do +RSpec.describe Projects::RecordTargetPlatformsWorker, feature_category: :projects do include ExclusiveLeaseHelpers let_it_be(:swift) { create(:programming_language, name: 'Swift') } diff --git a/spec/workers/projects/refresh_build_artifacts_size_statistics_worker_spec.rb b/spec/workers/projects/refresh_build_artifacts_size_statistics_worker_spec.rb index 99627ff1ad2..f2b7e75fa10 100644 --- a/spec/workers/projects/refresh_build_artifacts_size_statistics_worker_spec.rb +++ b/spec/workers/projects/refresh_build_artifacts_size_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::RefreshBuildArtifactsSizeStatisticsWorker do +RSpec.describe Projects::RefreshBuildArtifactsSizeStatisticsWorker, feature_category: :build_artifacts do let(:worker) { described_class.new } describe '#perform_work' do diff --git a/spec/workers/projects/schedule_bulk_repository_shard_moves_worker_spec.rb b/spec/workers/projects/schedule_bulk_repository_shard_moves_worker_spec.rb index 7eff8e4dcd7..1d328280389 100644 --- a/spec/workers/projects/schedule_bulk_repository_shard_moves_worker_spec.rb +++ b/spec/workers/projects/schedule_bulk_repository_shard_moves_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::ScheduleBulkRepositoryShardMovesWorker do +RSpec.describe Projects::ScheduleBulkRepositoryShardMovesWorker, feature_category: :gitaly do it_behaves_like 'schedules bulk repository shard moves' do let_it_be_with_reload(:container) { create(:project, :repository) } diff --git a/spec/workers/projects/schedule_refresh_build_artifacts_size_statistics_worker_spec.rb b/spec/workers/projects/schedule_refresh_build_artifacts_size_statistics_worker_spec.rb index b5775f37678..b2111b2efb0 100644 --- a/spec/workers/projects/schedule_refresh_build_artifacts_size_statistics_worker_spec.rb +++ b/spec/workers/projects/schedule_refresh_build_artifacts_size_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::ScheduleRefreshBuildArtifactsSizeStatisticsWorker do +RSpec.describe Projects::ScheduleRefreshBuildArtifactsSizeStatisticsWorker, feature_category: :build_artifacts do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/projects/update_repository_storage_worker_spec.rb b/spec/workers/projects/update_repository_storage_worker_spec.rb index 7570d706325..91445c2bbf6 100644 --- a/spec/workers/projects/update_repository_storage_worker_spec.rb +++ b/spec/workers/projects/update_repository_storage_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::UpdateRepositoryStorageWorker do +RSpec.describe Projects::UpdateRepositoryStorageWorker, feature_category: :source_code_management do subject { described_class.new } it_behaves_like 'an update storage move worker' do diff --git a/spec/workers/propagate_integration_group_worker_spec.rb b/spec/workers/propagate_integration_group_worker_spec.rb index 60442438a1d..0d797d22137 100644 --- a/spec/workers/propagate_integration_group_worker_spec.rb +++ b/spec/workers/propagate_integration_group_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PropagateIntegrationGroupWorker do +RSpec.describe PropagateIntegrationGroupWorker, feature_category: :integrations do describe '#perform' do let_it_be(:group) { create(:group) } let_it_be(:another_group) { create(:group) } diff --git a/spec/workers/propagate_integration_inherit_descendant_worker_spec.rb b/spec/workers/propagate_integration_inherit_descendant_worker_spec.rb index c9a7bfaa8b6..d69dd45a209 100644 --- a/spec/workers/propagate_integration_inherit_descendant_worker_spec.rb +++ b/spec/workers/propagate_integration_inherit_descendant_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PropagateIntegrationInheritDescendantWorker do +RSpec.describe PropagateIntegrationInheritDescendantWorker, feature_category: :integrations do let_it_be(:group) { create(:group) } let_it_be(:subgroup) { create(:group, parent: group) } let_it_be(:group_integration) { create(:redmine_integration, :group, group: group) } diff --git a/spec/workers/propagate_integration_inherit_worker_spec.rb b/spec/workers/propagate_integration_inherit_worker_spec.rb index dd5d246d7f9..f5535696fd1 100644 --- a/spec/workers/propagate_integration_inherit_worker_spec.rb +++ b/spec/workers/propagate_integration_inherit_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PropagateIntegrationInheritWorker do +RSpec.describe PropagateIntegrationInheritWorker, feature_category: :integrations do describe '#perform' do let_it_be(:integration) { create(:redmine_integration, :instance) } let_it_be(:integration1) { create(:redmine_integration, inherit_from_id: integration.id) } diff --git a/spec/workers/propagate_integration_worker_spec.rb b/spec/workers/propagate_integration_worker_spec.rb index 030caefb833..90134b5cd64 100644 --- a/spec/workers/propagate_integration_worker_spec.rb +++ b/spec/workers/propagate_integration_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PropagateIntegrationWorker do +RSpec.describe PropagateIntegrationWorker, feature_category: :integrations do describe '#perform' do let(:project) { create(:project) } let(:integration) do diff --git a/spec/workers/prune_old_events_worker_spec.rb b/spec/workers/prune_old_events_worker_spec.rb index c1ba9128475..8046fff2cf3 100644 --- a/spec/workers/prune_old_events_worker_spec.rb +++ b/spec/workers/prune_old_events_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PruneOldEventsWorker do +RSpec.describe PruneOldEventsWorker, feature_category: :user_profile do describe '#perform' do let(:user) { create(:user) } @@ -30,5 +30,17 @@ RSpec.describe PruneOldEventsWorker do subject.perform expect(not_expired_3_years_event).to be_present end + + context 'with ops_prune_old_events FF disabled' do + before do + stub_feature_flags(ops_prune_old_events: false) + end + + it 'does not delete' do + subject.perform + + expect(Event.find_by(id: expired_event.id)).to be_present + end + end end end diff --git a/spec/workers/purge_dependency_proxy_cache_worker_spec.rb b/spec/workers/purge_dependency_proxy_cache_worker_spec.rb index 84315fd6ee9..49ef73bad53 100644 --- a/spec/workers/purge_dependency_proxy_cache_worker_spec.rb +++ b/spec/workers/purge_dependency_proxy_cache_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PurgeDependencyProxyCacheWorker do +RSpec.describe PurgeDependencyProxyCacheWorker, feature_category: :dependency_proxy do let_it_be(:user) { create(:admin) } let_it_be_with_refind(:blob) { create(:dependency_proxy_blob ) } let_it_be_with_reload(:group) { blob.group } diff --git a/spec/workers/reactive_caching_worker_spec.rb b/spec/workers/reactive_caching_worker_spec.rb index 63b26817a7a..4e9d638c1e1 100644 --- a/spec/workers/reactive_caching_worker_spec.rb +++ b/spec/workers/reactive_caching_worker_spec.rb @@ -2,6 +2,6 @@ require 'spec_helper' -RSpec.describe ReactiveCachingWorker do +RSpec.describe ReactiveCachingWorker, feature_category: :shared do it_behaves_like 'reactive cacheable worker' end diff --git a/spec/workers/rebase_worker_spec.rb b/spec/workers/rebase_worker_spec.rb index 4bdfd7219f2..eec221094e6 100644 --- a/spec/workers/rebase_worker_spec.rb +++ b/spec/workers/rebase_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RebaseWorker, '#perform' do +RSpec.describe RebaseWorker, '#perform', feature_category: :source_code_management do include ProjectForksHelper context 'when rebasing an MR from a fork where upstream has protected branches' do diff --git a/spec/workers/releases/create_evidence_worker_spec.rb b/spec/workers/releases/create_evidence_worker_spec.rb index 7e3edcfe44a..8631b154920 100644 --- a/spec/workers/releases/create_evidence_worker_spec.rb +++ b/spec/workers/releases/create_evidence_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Releases::CreateEvidenceWorker do +RSpec.describe Releases::CreateEvidenceWorker, feature_category: :release_evidence do let(:project) { create(:project, :repository) } let(:release) { create(:release, project: project) } let(:pipeline) { create(:ci_empty_pipeline, sha: release.sha, project: project) } diff --git a/spec/workers/releases/manage_evidence_worker_spec.rb b/spec/workers/releases/manage_evidence_worker_spec.rb index 0004a4f4bfb..ca33e28b760 100644 --- a/spec/workers/releases/manage_evidence_worker_spec.rb +++ b/spec/workers/releases/manage_evidence_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Releases::ManageEvidenceWorker do +RSpec.describe Releases::ManageEvidenceWorker, feature_category: :release_evidence do let(:project) { create(:project, :repository) } shared_examples_for 'does not create a new Evidence record' do diff --git a/spec/workers/remote_mirror_notification_worker_spec.rb b/spec/workers/remote_mirror_notification_worker_spec.rb index e415e72645c..46f44d0047b 100644 --- a/spec/workers/remote_mirror_notification_worker_spec.rb +++ b/spec/workers/remote_mirror_notification_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoteMirrorNotificationWorker, :mailer do +RSpec.describe RemoteMirrorNotificationWorker, :mailer, feature_category: :source_code_management do let_it_be(:project) { create(:project, :repository, :remote_mirror) } let_it_be(:mirror) { project.remote_mirrors.first } diff --git a/spec/workers/remove_expired_group_links_worker_spec.rb b/spec/workers/remove_expired_group_links_worker_spec.rb index 7bdf6fc0d59..e08cc3fb5c5 100644 --- a/spec/workers/remove_expired_group_links_worker_spec.rb +++ b/spec/workers/remove_expired_group_links_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoveExpiredGroupLinksWorker do +RSpec.describe RemoveExpiredGroupLinksWorker, feature_category: :system_access do describe '#perform' do context 'ProjectGroupLinks' do let!(:expired_project_group_link) { create(:project_group_link, expires_at: 1.hour.ago) } diff --git a/spec/workers/remove_expired_members_worker_spec.rb b/spec/workers/remove_expired_members_worker_spec.rb index 062a9bcfa83..354ce3fc9b4 100644 --- a/spec/workers/remove_expired_members_worker_spec.rb +++ b/spec/workers/remove_expired_members_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoveExpiredMembersWorker do +RSpec.describe RemoveExpiredMembersWorker, feature_category: :system_access do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/remove_unaccepted_member_invites_worker_spec.rb b/spec/workers/remove_unaccepted_member_invites_worker_spec.rb index 96d7cf535ed..97ddf9223b3 100644 --- a/spec/workers/remove_unaccepted_member_invites_worker_spec.rb +++ b/spec/workers/remove_unaccepted_member_invites_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoveUnacceptedMemberInvitesWorker do +RSpec.describe RemoveUnacceptedMemberInvitesWorker, feature_category: :system_access do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb index 2562a7bc6fe..56dc3511cfc 100644 --- a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb +++ b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RemoveUnreferencedLfsObjectsWorker do +RSpec.describe RemoveUnreferencedLfsObjectsWorker, feature_category: :source_code_management do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/repository_check/batch_worker_spec.rb b/spec/workers/repository_check/batch_worker_spec.rb index 643b55af573..bb4a4844b9b 100644 --- a/spec/workers/repository_check/batch_worker_spec.rb +++ b/spec/workers/repository_check/batch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RepositoryCheck::BatchWorker do +RSpec.describe RepositoryCheck::BatchWorker, feature_category: :source_code_management do let(:shard_name) { 'default' } subject { described_class.new } diff --git a/spec/workers/repository_check/clear_worker_spec.rb b/spec/workers/repository_check/clear_worker_spec.rb index b5f09e8a05f..dd11a2705ac 100644 --- a/spec/workers/repository_check/clear_worker_spec.rb +++ b/spec/workers/repository_check/clear_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RepositoryCheck::ClearWorker do +RSpec.describe RepositoryCheck::ClearWorker, feature_category: :source_code_management do it 'clears repository check columns' do project = create(:project) project.update_columns( diff --git a/spec/workers/repository_check/dispatch_worker_spec.rb b/spec/workers/repository_check/dispatch_worker_spec.rb index 829abc7d895..34ecc645675 100644 --- a/spec/workers/repository_check/dispatch_worker_spec.rb +++ b/spec/workers/repository_check/dispatch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RepositoryCheck::DispatchWorker do +RSpec.describe RepositoryCheck::DispatchWorker, feature_category: :source_code_management do subject { described_class.new } it 'does nothing when repository checks are disabled' do diff --git a/spec/workers/repository_check/single_repository_worker_spec.rb b/spec/workers/repository_check/single_repository_worker_spec.rb index 0a37a296e7a..3e52ce781ee 100644 --- a/spec/workers/repository_check/single_repository_worker_spec.rb +++ b/spec/workers/repository_check/single_repository_worker_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require 'fileutils' -RSpec.describe RepositoryCheck::SingleRepositoryWorker do +RSpec.describe RepositoryCheck::SingleRepositoryWorker, feature_category: :source_code_management do subject(:worker) { described_class.new } before do diff --git a/spec/workers/repository_cleanup_worker_spec.rb b/spec/workers/repository_cleanup_worker_spec.rb index 2b700b944d2..1e80a48451b 100644 --- a/spec/workers/repository_cleanup_worker_spec.rb +++ b/spec/workers/repository_cleanup_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RepositoryCleanupWorker do +RSpec.describe RepositoryCleanupWorker, feature_category: :source_code_management do let(:project) { create(:project) } let(:user) { create(:user) } diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index 85dee935001..3a5528b6a04 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RepositoryForkWorker do +RSpec.describe RepositoryForkWorker, feature_category: :source_code_management do include ProjectForksHelper describe 'modules' do diff --git a/spec/workers/repository_update_remote_mirror_worker_spec.rb b/spec/workers/repository_update_remote_mirror_worker_spec.rb index ef6a8d76d2c..c1987658b0d 100644 --- a/spec/workers/repository_update_remote_mirror_worker_spec.rb +++ b/spec/workers/repository_update_remote_mirror_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RepositoryUpdateRemoteMirrorWorker, :clean_gitlab_redis_shared_state do +RSpec.describe RepositoryUpdateRemoteMirrorWorker, :clean_gitlab_redis_shared_state, feature_category: :source_code_management do let_it_be(:remote_mirror) { create(:remote_mirror) } let(:scheduled_time) { Time.current - 5.minutes } diff --git a/spec/workers/schedule_merge_request_cleanup_refs_worker_spec.rb b/spec/workers/schedule_merge_request_cleanup_refs_worker_spec.rb index 49730d9ab8c..b93202fe9b3 100644 --- a/spec/workers/schedule_merge_request_cleanup_refs_worker_spec.rb +++ b/spec/workers/schedule_merge_request_cleanup_refs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ScheduleMergeRequestCleanupRefsWorker do +RSpec.describe ScheduleMergeRequestCleanupRefsWorker, feature_category: :code_review_workflow do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/schedule_migrate_external_diffs_worker_spec.rb b/spec/workers/schedule_migrate_external_diffs_worker_spec.rb index 09a0124f6e0..061467a28e0 100644 --- a/spec/workers/schedule_migrate_external_diffs_worker_spec.rb +++ b/spec/workers/schedule_migrate_external_diffs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ScheduleMigrateExternalDiffsWorker do +RSpec.describe ScheduleMigrateExternalDiffsWorker, feature_category: :code_review_workflow do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/self_monitoring_project_create_worker_spec.rb b/spec/workers/self_monitoring_project_create_worker_spec.rb index b618b8ede99..cc31804acc1 100644 --- a/spec/workers/self_monitoring_project_create_worker_spec.rb +++ b/spec/workers/self_monitoring_project_create_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe SelfMonitoringProjectCreateWorker do +RSpec.describe SelfMonitoringProjectCreateWorker, feature_category: :projects do describe '#perform' do let(:service_class) { Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService } let(:service) { instance_double(service_class) } diff --git a/spec/workers/self_monitoring_project_delete_worker_spec.rb b/spec/workers/self_monitoring_project_delete_worker_spec.rb index 9a53fe59a40..808f65a25bd 100644 --- a/spec/workers/self_monitoring_project_delete_worker_spec.rb +++ b/spec/workers/self_monitoring_project_delete_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe SelfMonitoringProjectDeleteWorker do +RSpec.describe SelfMonitoringProjectDeleteWorker, feature_category: :projects do let_it_be(:jid) { 'b5b28910d97563e58c2fe55f' } let_it_be(:data_key) { "self_monitoring_delete_result:#{jid}" } diff --git a/spec/workers/service_desk_email_receiver_worker_spec.rb b/spec/workers/service_desk_email_receiver_worker_spec.rb index 60fc951f627..bed66875f34 100644 --- a/spec/workers/service_desk_email_receiver_worker_spec.rb +++ b/spec/workers/service_desk_email_receiver_worker_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe ServiceDeskEmailReceiverWorker, :mailer do +RSpec.describe ServiceDeskEmailReceiverWorker, :mailer, feature_category: :service_desk do describe '#perform' do let(:worker) { described_class.new } let(:email) { fixture_file('emails/service_desk_custom_address.eml') } diff --git a/spec/workers/snippets/schedule_bulk_repository_shard_moves_worker_spec.rb b/spec/workers/snippets/schedule_bulk_repository_shard_moves_worker_spec.rb index be7d8ebe2d3..d31600d9cba 100644 --- a/spec/workers/snippets/schedule_bulk_repository_shard_moves_worker_spec.rb +++ b/spec/workers/snippets/schedule_bulk_repository_shard_moves_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Snippets::ScheduleBulkRepositoryShardMovesWorker do +RSpec.describe Snippets::ScheduleBulkRepositoryShardMovesWorker, feature_category: :gitaly do it_behaves_like 'schedules bulk repository shard moves' do let_it_be_with_reload(:container) { create(:snippet, :repository).tap { |snippet| snippet.create_repository } } diff --git a/spec/workers/snippets/update_repository_storage_worker_spec.rb b/spec/workers/snippets/update_repository_storage_worker_spec.rb index 38e9012e9c5..b26384fc75c 100644 --- a/spec/workers/snippets/update_repository_storage_worker_spec.rb +++ b/spec/workers/snippets/update_repository_storage_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Snippets::UpdateRepositoryStorageWorker do +RSpec.describe Snippets::UpdateRepositoryStorageWorker, feature_category: :source_code_management do subject { described_class.new } it_behaves_like 'an update storage move worker' do diff --git a/spec/workers/ssh_keys/expired_notification_worker_spec.rb b/spec/workers/ssh_keys/expired_notification_worker_spec.rb index 26d9460d73e..f3ba586c21e 100644 --- a/spec/workers/ssh_keys/expired_notification_worker_spec.rb +++ b/spec/workers/ssh_keys/expired_notification_worker_spec.rb @@ -2,12 +2,11 @@ require 'spec_helper' -RSpec.describe SshKeys::ExpiredNotificationWorker, type: :worker do +RSpec.describe SshKeys::ExpiredNotificationWorker, type: :worker, feature_category: :compliance_management do subject(:worker) { described_class.new } it 'uses a cronjob queue' do expect(worker.sidekiq_options_hash).to include( - 'queue' => 'cronjob:ssh_keys_expired_notification', 'queue_namespace' => :cronjob ) end diff --git a/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb b/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb index e907d035020..f6eaf76b54d 100644 --- a/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb +++ b/spec/workers/ssh_keys/expiring_soon_notification_worker_spec.rb @@ -2,12 +2,11 @@ require 'spec_helper' -RSpec.describe SshKeys::ExpiringSoonNotificationWorker, type: :worker do +RSpec.describe SshKeys::ExpiringSoonNotificationWorker, type: :worker, feature_category: :compliance_management do subject(:worker) { described_class.new } it 'uses a cronjob queue' do expect(worker.sidekiq_options_hash).to include( - 'queue' => 'cronjob:ssh_keys_expiring_soon_notification', 'queue_namespace' => :cronjob ) end diff --git a/spec/workers/stage_update_worker_spec.rb b/spec/workers/stage_update_worker_spec.rb index e50c7183153..bb2f63d3b50 100644 --- a/spec/workers/stage_update_worker_spec.rb +++ b/spec/workers/stage_update_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe StageUpdateWorker do +RSpec.describe StageUpdateWorker, feature_category: :continuous_integration do describe '#perform' do context 'when stage exists' do let(:stage) { create(:ci_stage) } diff --git a/spec/workers/stuck_ci_jobs_worker_spec.rb b/spec/workers/stuck_ci_jobs_worker_spec.rb index 19ff8ec55c2..1c5f54dc55f 100644 --- a/spec/workers/stuck_ci_jobs_worker_spec.rb +++ b/spec/workers/stuck_ci_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe StuckCiJobsWorker do +RSpec.describe StuckCiJobsWorker, feature_category: :continuous_integration do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/stuck_export_jobs_worker_spec.rb b/spec/workers/stuck_export_jobs_worker_spec.rb index cbc7adc8e3f..0e300b0077b 100644 --- a/spec/workers/stuck_export_jobs_worker_spec.rb +++ b/spec/workers/stuck_export_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe StuckExportJobsWorker do +RSpec.describe StuckExportJobsWorker, feature_category: :importers do let(:worker) { described_class.new } shared_examples 'project export job detection' do diff --git a/spec/workers/stuck_merge_jobs_worker_spec.rb b/spec/workers/stuck_merge_jobs_worker_spec.rb index bade2e1ca1b..44dc6550cdb 100644 --- a/spec/workers/stuck_merge_jobs_worker_spec.rb +++ b/spec/workers/stuck_merge_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe StuckMergeJobsWorker do +RSpec.describe StuckMergeJobsWorker, feature_category: :code_review_workflow do describe 'perform' do let(:worker) { described_class.new } diff --git a/spec/workers/system_hook_push_worker_spec.rb b/spec/workers/system_hook_push_worker_spec.rb index 43a3f8e3e19..35e44e635cc 100644 --- a/spec/workers/system_hook_push_worker_spec.rb +++ b/spec/workers/system_hook_push_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe SystemHookPushWorker do +RSpec.describe SystemHookPushWorker, feature_category: :source_code_management do include RepoHelpers subject { described_class.new } diff --git a/spec/workers/tasks_to_be_done/create_worker_spec.rb b/spec/workers/tasks_to_be_done/create_worker_spec.rb index c3c3612f9a7..643424ae068 100644 --- a/spec/workers/tasks_to_be_done/create_worker_spec.rb +++ b/spec/workers/tasks_to_be_done/create_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TasksToBeDone::CreateWorker do +RSpec.describe TasksToBeDone::CreateWorker, feature_category: :onboarding do let_it_be(:member_task) { create(:member_task, tasks: MemberTask::TASKS.values) } let_it_be(:current_user) { create(:user) } diff --git a/spec/workers/terraform/states/destroy_worker_spec.rb b/spec/workers/terraform/states/destroy_worker_spec.rb index 02e79373279..7cc20e0ad5d 100644 --- a/spec/workers/terraform/states/destroy_worker_spec.rb +++ b/spec/workers/terraform/states/destroy_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Terraform::States::DestroyWorker do +RSpec.describe Terraform::States::DestroyWorker, feature_category: :infrastructure_as_code do let(:state) { create(:terraform_state) } describe '#perform' do diff --git a/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb b/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb index 86202fac1ed..54e2061217f 100644 --- a/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb +++ b/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodosDestroyer::ConfidentialIssueWorker do +RSpec.describe TodosDestroyer::ConfidentialIssueWorker, feature_category: :team_planning do let(:service) { double } it "calls the Todos::Destroy::ConfidentialIssueService with issue_id parameter" do diff --git a/spec/workers/todos_destroyer/destroyed_designs_worker_spec.rb b/spec/workers/todos_destroyer/destroyed_designs_worker_spec.rb index 113faeb0d2f..b85ea1a5847 100644 --- a/spec/workers/todos_destroyer/destroyed_designs_worker_spec.rb +++ b/spec/workers/todos_destroyer/destroyed_designs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodosDestroyer::DestroyedDesignsWorker do +RSpec.describe TodosDestroyer::DestroyedDesignsWorker, feature_category: :team_planning do let(:service) { double } it 'calls the Todos::Destroy::DesignService with design_ids parameter' do diff --git a/spec/workers/todos_destroyer/destroyed_issuable_worker_spec.rb b/spec/workers/todos_destroyer/destroyed_issuable_worker_spec.rb index 6ccad25ad76..72adc7ba0c7 100644 --- a/spec/workers/todos_destroyer/destroyed_issuable_worker_spec.rb +++ b/spec/workers/todos_destroyer/destroyed_issuable_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodosDestroyer::DestroyedIssuableWorker do +RSpec.describe TodosDestroyer::DestroyedIssuableWorker, feature_category: :team_planning do let(:job_args) { [1, 'MergeRequest'] } it 'calls the Todos::Destroy::DestroyedIssuableService' do diff --git a/spec/workers/todos_destroyer/entity_leave_worker_spec.rb b/spec/workers/todos_destroyer/entity_leave_worker_spec.rb index db3b0252056..d7682ad0e5e 100644 --- a/spec/workers/todos_destroyer/entity_leave_worker_spec.rb +++ b/spec/workers/todos_destroyer/entity_leave_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodosDestroyer::EntityLeaveWorker do +RSpec.describe TodosDestroyer::EntityLeaveWorker, feature_category: :team_planning do it "calls the Todos::Destroy::EntityLeaveService with the params it was given" do service = double diff --git a/spec/workers/todos_destroyer/group_private_worker_spec.rb b/spec/workers/todos_destroyer/group_private_worker_spec.rb index 4903edd4bbe..4d49a852a3e 100644 --- a/spec/workers/todos_destroyer/group_private_worker_spec.rb +++ b/spec/workers/todos_destroyer/group_private_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodosDestroyer::GroupPrivateWorker do +RSpec.describe TodosDestroyer::GroupPrivateWorker, feature_category: :team_planning do it "calls the Todos::Destroy::GroupPrivateService with the params it was given" do service = double diff --git a/spec/workers/todos_destroyer/private_features_worker_spec.rb b/spec/workers/todos_destroyer/private_features_worker_spec.rb index 88d9be051d0..834e0fb2201 100644 --- a/spec/workers/todos_destroyer/private_features_worker_spec.rb +++ b/spec/workers/todos_destroyer/private_features_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodosDestroyer::PrivateFeaturesWorker do +RSpec.describe TodosDestroyer::PrivateFeaturesWorker, feature_category: :team_planning do it "calls the Todos::Destroy::PrivateFeaturesService with the params it was given" do service = double diff --git a/spec/workers/todos_destroyer/project_private_worker_spec.rb b/spec/workers/todos_destroyer/project_private_worker_spec.rb index 4e54fbdb275..2435fcade22 100644 --- a/spec/workers/todos_destroyer/project_private_worker_spec.rb +++ b/spec/workers/todos_destroyer/project_private_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodosDestroyer::ProjectPrivateWorker do +RSpec.describe TodosDestroyer::ProjectPrivateWorker, feature_category: :team_planning do it "calls the Todos::Destroy::ProjectPrivateService with the params it was given" do service = double diff --git a/spec/workers/trending_projects_worker_spec.rb b/spec/workers/trending_projects_worker_spec.rb index 1f1e312e457..b6acd01f7c4 100644 --- a/spec/workers/trending_projects_worker_spec.rb +++ b/spec/workers/trending_projects_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TrendingProjectsWorker do +RSpec.describe TrendingProjectsWorker, feature_category: :source_code_management do describe '#perform' do it 'refreshes the trending projects' do expect(TrendingProject).to receive(:refresh!) diff --git a/spec/workers/update_container_registry_info_worker_spec.rb b/spec/workers/update_container_registry_info_worker_spec.rb index ace9e55cbce..a8c501efd51 100644 --- a/spec/workers/update_container_registry_info_worker_spec.rb +++ b/spec/workers/update_container_registry_info_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UpdateContainerRegistryInfoWorker do +RSpec.describe UpdateContainerRegistryInfoWorker, feature_category: :container_registry do describe '#perform' do it 'calls UpdateContainerRegistryInfoService' do expect_next_instance_of(UpdateContainerRegistryInfoService) do |service| diff --git a/spec/workers/update_external_pull_requests_worker_spec.rb b/spec/workers/update_external_pull_requests_worker_spec.rb index cb6a4e2ebf8..254a4b69f3b 100644 --- a/spec/workers/update_external_pull_requests_worker_spec.rb +++ b/spec/workers/update_external_pull_requests_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UpdateExternalPullRequestsWorker do +RSpec.describe UpdateExternalPullRequestsWorker, feature_category: :continuous_integration do describe '#perform' do let_it_be(:project) { create(:project, import_source: 'tanuki/repository') } let_it_be(:user) { create(:user) } diff --git a/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb b/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb index 5ed600e308b..5eae275be36 100644 --- a/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb +++ b/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UpdateHeadPipelineForMergeRequestWorker do +RSpec.describe UpdateHeadPipelineForMergeRequestWorker, feature_category: :continuous_integration do describe '#perform' do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository) } diff --git a/spec/workers/update_highest_role_worker_spec.rb b/spec/workers/update_highest_role_worker_spec.rb index cd127f26e95..94811260f0e 100644 --- a/spec/workers/update_highest_role_worker_spec.rb +++ b/spec/workers/update_highest_role_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UpdateHighestRoleWorker, :clean_gitlab_redis_shared_state do +RSpec.describe UpdateHighestRoleWorker, :clean_gitlab_redis_shared_state, feature_category: :subscription_cost_management do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/update_merge_requests_worker_spec.rb b/spec/workers/update_merge_requests_worker_spec.rb index 64fcc2bd388..de164fe352a 100644 --- a/spec/workers/update_merge_requests_worker_spec.rb +++ b/spec/workers/update_merge_requests_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UpdateMergeRequestsWorker do +RSpec.describe UpdateMergeRequestsWorker, feature_category: :code_review_workflow do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } let_it_be(:oldrev) { "123456" } diff --git a/spec/workers/update_project_statistics_worker_spec.rb b/spec/workers/update_project_statistics_worker_spec.rb index 2f356376d7c..c5e6f45a201 100644 --- a/spec/workers/update_project_statistics_worker_spec.rb +++ b/spec/workers/update_project_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UpdateProjectStatisticsWorker do +RSpec.describe UpdateProjectStatisticsWorker, feature_category: :source_code_management do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/upload_checksum_worker_spec.rb b/spec/workers/upload_checksum_worker_spec.rb index 75d7509b6e6..6c47a8e198c 100644 --- a/spec/workers/upload_checksum_worker_spec.rb +++ b/spec/workers/upload_checksum_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UploadChecksumWorker do +RSpec.describe UploadChecksumWorker, feature_category: :geo_replication do describe '#perform' do subject { described_class.new } diff --git a/spec/workers/user_status_cleanup/batch_worker_spec.rb b/spec/workers/user_status_cleanup/batch_worker_spec.rb index 2fd84d0e085..e2ad12672de 100644 --- a/spec/workers/user_status_cleanup/batch_worker_spec.rb +++ b/spec/workers/user_status_cleanup/batch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe UserStatusCleanup::BatchWorker do +RSpec.describe UserStatusCleanup::BatchWorker, feature_category: :user_profile do include_examples 'an idempotent worker' do subject do perform_multiple([], worker: described_class.new) diff --git a/spec/workers/users/create_statistics_worker_spec.rb b/spec/workers/users/create_statistics_worker_spec.rb index 2118cc42f3a..2c1c7738533 100644 --- a/spec/workers/users/create_statistics_worker_spec.rb +++ b/spec/workers/users/create_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Users::CreateStatisticsWorker do +RSpec.describe Users::CreateStatisticsWorker, feature_category: :user_profile do describe '#perform' do subject { described_class.new.perform } diff --git a/spec/workers/users/deactivate_dormant_users_worker_spec.rb b/spec/workers/users/deactivate_dormant_users_worker_spec.rb index a8318de669b..1fb936b1fc2 100644 --- a/spec/workers/users/deactivate_dormant_users_worker_spec.rb +++ b/spec/workers/users/deactivate_dormant_users_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Users::DeactivateDormantUsersWorker do +RSpec.describe Users::DeactivateDormantUsersWorker, feature_category: :subscription_cost_management do using RSpec::Parameterized::TableSyntax describe '#perform' do @@ -12,8 +12,7 @@ RSpec.describe Users::DeactivateDormantUsersWorker do subject(:worker) { described_class.new } - it 'does not run for GitLab.com' do - expect(Gitlab).to receive(:com?).and_return(true) + it 'does not run for SaaS', :saas do # Now makes a call to current settings to determine period of dormancy worker.perform diff --git a/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb b/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb index 7c585542e30..73faffb5387 100644 --- a/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb +++ b/spec/workers/users/migrate_records_to_ghost_user_in_batches_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Users::MigrateRecordsToGhostUserInBatchesWorker do +RSpec.describe Users::MigrateRecordsToGhostUserInBatchesWorker, feature_category: :subscription_cost_management do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/web_hook_worker_spec.rb b/spec/workers/web_hook_worker_spec.rb index e2ff36975c4..e39017c4ccf 100644 --- a/spec/workers/web_hook_worker_spec.rb +++ b/spec/workers/web_hook_worker_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe WebHookWorker do +RSpec.describe WebHookWorker, feature_category: :integrations do include AfterNextHelpers let_it_be(:project_hook) { create(:project_hook) } diff --git a/spec/workers/web_hooks/log_destroy_worker_spec.rb b/spec/workers/web_hooks/log_destroy_worker_spec.rb index 0c107c05360..8c7d29d559d 100644 --- a/spec/workers/web_hooks/log_destroy_worker_spec.rb +++ b/spec/workers/web_hooks/log_destroy_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WebHooks::LogDestroyWorker do +RSpec.describe WebHooks::LogDestroyWorker, feature_category: :integrations do include AfterNextHelpers let_it_be(:project) { create(:project) } diff --git a/spec/workers/x509_certificate_revoke_worker_spec.rb b/spec/workers/x509_certificate_revoke_worker_spec.rb index 392cb52d084..badeff25b34 100644 --- a/spec/workers/x509_certificate_revoke_worker_spec.rb +++ b/spec/workers/x509_certificate_revoke_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe X509CertificateRevokeWorker do +RSpec.describe X509CertificateRevokeWorker, feature_category: :source_code_management do describe '#perform' do context 'with a revoked certificate' do subject { described_class.new } diff --git a/spec/workers/x509_issuer_crl_check_worker_spec.rb b/spec/workers/x509_issuer_crl_check_worker_spec.rb index 5564147d274..55e2e8d335d 100644 --- a/spec/workers/x509_issuer_crl_check_worker_spec.rb +++ b/spec/workers/x509_issuer_crl_check_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe X509IssuerCrlCheckWorker do +RSpec.describe X509IssuerCrlCheckWorker, feature_category: :source_code_management do subject(:worker) { described_class.new } let(:project) { create(:project, :public, :repository) } |