diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 21:09:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 21:09:02 +0000 |
commit | 76623c12c136f43f24c3966ed4b469e2c0b434b7 (patch) | |
tree | 7c5ec884c25e03e4fea131a4d112a9d0ccfd59b8 /spec | |
parent | b042382bbf5a4977c5b5c6b0a9a33f4e8ca8d16d (diff) | |
download | gitlab-ce-76623c12c136f43f24c3966ed4b469e2c0b434b7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
72 files changed, 325 insertions, 240 deletions
diff --git a/spec/features/admin/admin_mode/workers_spec.rb b/spec/features/admin/admin_mode/workers_spec.rb index 8c515b8d220..e33c9d7e64c 100644 --- a/spec/features/admin/admin_mode/workers_spec.rb +++ b/spec/features/admin/admin_mode/workers_spec.rb @@ -37,7 +37,7 @@ describe 'Admin mode for workers', :do_not_mock_admin_mode, :request_store, :cle gitlab_enable_admin_mode_sign_in(user) end - it 'can delete user', :sidekiq, :js do + it 'can delete user', :js do visit admin_user_path(user_to_delete) click_button 'Delete user' diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 0ff3809a915..b7ec445a7aa 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -282,6 +282,32 @@ describe 'GFM autocomplete', :js do end end + context 'assignees' do + let(:issue_assignee) { create(:issue, project: project) } + + before do + issue_assignee.update(assignees: [user]) + + visit project_issue_path(project, issue_assignee) + + wait_for_requests + end + + it 'lists users who are currently not assigned to the issue when using /assign' do + note = find('#note-body') + page.within '.timeline-content-form' do + note.native.send_keys('/as') + end + + find('.atwho-view li', text: '/assign') + note.native.send_keys(:tab) + + wait_for_requests + + expect(find('#at-view-users .atwho-view-ul')).not_to have_content(user.username) + end + end + context 'labels' do it 'opens autocomplete menu for Labels when field starts with text with item escaping HTML characters' do create(:label, project: project, title: label_xss_title) diff --git a/spec/frontend/monitoring/components/charts/time_series_spec.js b/spec/frontend/monitoring/components/charts/time_series_spec.js index c734a706c9c..d4f197a708f 100644 --- a/spec/frontend/monitoring/components/charts/time_series_spec.js +++ b/spec/frontend/monitoring/components/charts/time_series_spec.js @@ -385,7 +385,7 @@ describe('Time series component', () => { describe('when tooltip is showing deployment data', () => { const mockSha = 'mockSha'; - const commitUrl = `${mockProjectDir}/commit/${mockSha}`; + const commitUrl = `${mockProjectDir}/-/commit/${mockSha}`; beforeEach(done => { timeSeriesAreaChart.vm.tooltip.isDeployment = true; diff --git a/spec/frontend/monitoring/mock_data.js b/spec/frontend/monitoring/mock_data.js index 0c985ba4fca..4d83933f2b8 100644 --- a/spec/frontend/monitoring/mock_data.js +++ b/spec/frontend/monitoring/mock_data.js @@ -169,7 +169,7 @@ export const deploymentData = [ iid: 3, sha: 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', commitUrl: - 'http://test.host/frontend-fixtures/environments-project/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', + 'http://test.host/frontend-fixtures/environments-project/-/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', ref: { name: 'master', }, @@ -183,7 +183,7 @@ export const deploymentData = [ iid: 2, sha: 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', commitUrl: - 'http://test.host/frontend-fixtures/environments-project/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', + 'http://test.host/frontend-fixtures/environments-project/-/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', ref: { name: 'master', }, @@ -197,7 +197,7 @@ export const deploymentData = [ iid: 1, sha: '6511e58faafaa7ad2228990ec57f19d66f7db7c2', commitUrl: - 'http://test.host/frontend-fixtures/environments-project/commit/6511e58faafaa7ad2228990ec57f19d66f7db7c2', + 'http://test.host/frontend-fixtures/environments-project/-/commit/6511e58faafaa7ad2228990ec57f19d66f7db7c2', ref: { name: 'update2-readme', }, diff --git a/spec/helpers/events_helper_spec.rb b/spec/helpers/events_helper_spec.rb index fa553710274..062fa8f106e 100644 --- a/spec/helpers/events_helper_spec.rb +++ b/spec/helpers/events_helper_spec.rb @@ -98,7 +98,7 @@ describe EventsHelper do it 'returns a commit note url' do event.target = create(:note_on_commit, note: '+1 from me') - expect(subject).to eq("#{project_base_url}/commit/#{event.target.commit_id}#note_#{event.target.id}") + expect(subject).to eq("#{project_base_url}/-/commit/#{event.target.commit_id}#note_#{event.target.id}") end it 'returns a project snippet note url' do diff --git a/spec/javascripts/ide/stores/modules/commit/actions_spec.js b/spec/javascripts/ide/stores/modules/commit/actions_spec.js index 557244e237e..056822bcfe5 100644 --- a/spec/javascripts/ide/stores/modules/commit/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/commit/actions_spec.js @@ -131,7 +131,7 @@ describe('IDE commit module actions', () => { .dispatch('commit/setLastCommitMessage', { short_id: '123' }) .then(() => { expect(store.state.lastCommitMsg).toContain( - 'Your changes have been committed. Commit <a href="http://testing/commit/123" class="commit-sha">123</a>', + 'Your changes have been committed. Commit <a href="http://testing/-/commit/123" class="commit-sha">123</a>', ); }) .then(done) @@ -149,7 +149,7 @@ describe('IDE commit module actions', () => { }) .then(() => { expect(store.state.lastCommitMsg).toBe( - 'Your changes have been committed. Commit <a href="http://testing/commit/123" class="commit-sha">123</a> with 1 additions, 2 deletions.', + 'Your changes have been committed. Commit <a href="http://testing/-/commit/123" class="commit-sha">123</a> with 1 additions, 2 deletions.', ); }) .then(done) @@ -407,7 +407,7 @@ describe('IDE commit module actions', () => { .dispatch('commit/commitChanges') .then(() => { expect(store.state.lastCommitMsg).toBe( - 'Your changes have been committed. Commit <a href="webUrl/commit/123" class="commit-sha">123</a> with 1 additions, 2 deletions.', + 'Your changes have been committed. Commit <a href="webUrl/-/commit/123" class="commit-sha">123</a> with 1 additions, 2 deletions.', ); done(); diff --git a/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb b/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb index 44f537ca8dd..f25804c3ca2 100644 --- a/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb +++ b/spec/lib/gitlab/background_migration/populate_untracked_uploads_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' # Rollback DB to 10.5 (later than this was originally written for) because it still needs to work. -describe Gitlab::BackgroundMigration::PopulateUntrackedUploads, :sidekiq, :migration, schema: 20180208183958 do +describe Gitlab::BackgroundMigration::PopulateUntrackedUploads, :migration, schema: 20180208183958 do include MigrationsHelpers::TrackUntrackedUploadsHelpers subject { described_class.new } diff --git a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb index 591368ee98e..9072431e8f6 100644 --- a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb +++ b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' # Rollback DB to 10.5 (later than this was originally written for) because it still needs to work. -describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :sidekiq, :migration, schema: 20180208183958 do +describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :migration, schema: 20180208183958 do include MigrationsHelpers::TrackUntrackedUploadsHelpers let!(:untracked_files_for_uploads) { table(:untracked_files_for_uploads) } diff --git a/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb b/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb index 399db4ac259..cee9a3e8822 100644 --- a/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb +++ b/spec/lib/gitlab/background_migration/schedule_calculate_wiki_sizes_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190527194900_schedule_calculate_wiki_sizes.rb') -describe ScheduleCalculateWikiSizes, :migration, :sidekiq do +describe ScheduleCalculateWikiSizes, :migration do let(:migration_class) { Gitlab::BackgroundMigration::CalculateWikiSizes } let(:migration_name) { migration_class.to_s.demodulize } diff --git a/spec/lib/gitlab/background_migration_spec.rb b/spec/lib/gitlab/background_migration_spec.rb index 66a0b11606f..9546550bfc5 100644 --- a/spec/lib/gitlab/background_migration_spec.rb +++ b/spec/lib/gitlab/background_migration_spec.rb @@ -76,7 +76,7 @@ describe Gitlab::BackgroundMigration do end end - context 'when there are scheduled jobs present', :sidekiq, :redis do + context 'when there are scheduled jobs present', :redis do it 'steals all jobs from the scheduled sets' do Sidekiq::Testing.disable! do BackgroundMigrationWorker.perform_in(10.minutes, 'Object') @@ -91,7 +91,7 @@ describe Gitlab::BackgroundMigration do end end - context 'when there are enqueued and scheduled jobs present', :sidekiq, :redis do + context 'when there are enqueued and scheduled jobs present', :redis do it 'steals from the scheduled sets queue first' do Sidekiq::Testing.disable! do expect(described_class).to receive(:perform) @@ -107,7 +107,7 @@ describe Gitlab::BackgroundMigration do end end - context 'when retry_dead_jobs is true', :sidekiq, :redis do + context 'when retry_dead_jobs is true', :redis do let(:retry_queue) do [double(args: ['Object', [3]], queue: described_class.queue, delete: true)] end @@ -186,7 +186,7 @@ describe Gitlab::BackgroundMigration do end end - context 'when there are scheduled jobs present', :sidekiq, :redis do + context 'when there are scheduled jobs present', :redis do before do Sidekiq::Testing.disable! do BackgroundMigrationWorker.perform_in(10.minutes, 'Foo') diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index 7a8e79fecb1..4cf2553b90d 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -1158,7 +1158,7 @@ describe Gitlab::Database::MigrationHelpers do end end - describe 'sidekiq migration helpers', :sidekiq, :redis do + describe 'sidekiq migration helpers', :redis do let(:worker) do Class.new do include Sidekiq::Worker @@ -1221,7 +1221,7 @@ describe Gitlab::Database::MigrationHelpers do end end - describe '#bulk_queue_background_migration_jobs_by_range', :sidekiq do + describe '#bulk_queue_background_migration_jobs_by_range' do context 'when the model has an ID column' do let!(:id1) { create(:user).id } let!(:id2) { create(:user).id } @@ -1293,7 +1293,7 @@ describe Gitlab::Database::MigrationHelpers do end end - describe '#queue_background_migration_jobs_by_range_at_intervals', :sidekiq do + describe '#queue_background_migration_jobs_by_range_at_intervals' do context 'when the model has an ID column' do let!(:id1) { create(:user).id } let!(:id2) { create(:user).id } diff --git a/spec/lib/gitlab/etag_caching/router_spec.rb b/spec/lib/gitlab/etag_caching/router_spec.rb index 4cbabb5ad8d..b69e4668d61 100644 --- a/spec/lib/gitlab/etag_caching/router_spec.rb +++ b/spec/lib/gitlab/etag_caching/router_spec.rb @@ -59,7 +59,7 @@ describe Gitlab::EtagCaching::Router do it 'matches commit pipelines endpoint' do result = described_class.match( - '/my-group/my-project/commit/aa8260d253a53f73f6c26c734c72fdd600f6e6d4/pipelines.json' + '/my-group/my-project/-/commit/aa8260d253a53f73f6c26c734c72fdd600f6e6d4/pipelines.json' ) expect(result).to be_present diff --git a/spec/lib/gitlab/hashed_storage/migrator_spec.rb b/spec/lib/gitlab/hashed_storage/migrator_spec.rb index ce7f2c4530d..f3cbb811679 100644 --- a/spec/lib/gitlab/hashed_storage/migrator_spec.rb +++ b/spec/lib/gitlab/hashed_storage/migrator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do +describe Gitlab::HashedStorage::Migrator, :redis do describe '#bulk_schedule_migration' do it 'schedules job to HashedStorage::MigratorWorker' do Sidekiq::Testing.fake! do diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index 22c2fc5545e..81f6138e2bf 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -215,6 +215,7 @@ ci_pipelines: - vulnerabilities_occurrence_pipelines - vulnerability_findings - pipeline_config +- security_scans pipeline_variables: - pipeline stages: diff --git a/spec/lib/gitlab/sidekiq_versioning_spec.rb b/spec/lib/gitlab/sidekiq_versioning_spec.rb index dade5961775..11c866894c2 100644 --- a/spec/lib/gitlab/sidekiq_versioning_spec.rb +++ b/spec/lib/gitlab/sidekiq_versioning_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::SidekiqVersioning, :sidekiq, :redis do +describe Gitlab::SidekiqVersioning, :redis do let(:foo_worker) do Class.new do def self.name diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb index d349c2928b0..49011b100ab 100644 --- a/spec/lib/gitlab/url_builder_spec.rb +++ b/spec/lib/gitlab/url_builder_spec.rb @@ -10,7 +10,7 @@ describe Gitlab::UrlBuilder do url = described_class.build(commit) - expect(url).to eq "#{Settings.gitlab['url']}/#{commit.project.full_path}/commit/#{commit.id}" + expect(url).to eq "#{Settings.gitlab['url']}/#{commit.project.full_path}/-/commit/#{commit.id}" end end @@ -86,7 +86,7 @@ describe Gitlab::UrlBuilder do url = described_class.build(note) - expect(url).to eq "#{Settings.gitlab['url']}/#{note.project.full_path}/commit/#{note.commit_id}#note_#{note.id}" + expect(url).to eq "#{Settings.gitlab['url']}/#{note.project.full_path}/-/commit/#{note.commit_id}#note_#{note.id}" end end @@ -96,7 +96,7 @@ describe Gitlab::UrlBuilder do url = described_class.build(note) - expect(url).to eq "#{Settings.gitlab['url']}/#{note.project.full_path}/commit/#{note.commit_id}#note_#{note.id}" + expect(url).to eq "#{Settings.gitlab['url']}/#{note.project.full_path}/-/commit/#{note.commit_id}#note_#{note.id}" end end diff --git a/spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb b/spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb index 53c176fc46f..0453ac87436 100644 --- a/spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb +++ b/spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190924152703_migrate_issue_trackers_data.rb') -describe MigrateIssueTrackersData, :migration, :sidekiq do +describe MigrateIssueTrackersData, :migration do let(:services) { table(:services) } let(:migration_class) { Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData } let(:migration_name) { migration_class.to_s.demodulize } diff --git a/spec/migrations/active_record/schedule_set_confidential_note_events_on_services_spec.rb b/spec/migrations/active_record/schedule_set_confidential_note_events_on_services_spec.rb index f4155eab1bf..4de43e21ed3 100644 --- a/spec/migrations/active_record/schedule_set_confidential_note_events_on_services_spec.rb +++ b/spec/migrations/active_record/schedule_set_confidential_note_events_on_services_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180122154930_schedule_set_confidential_note_events_on_services.rb') -describe ScheduleSetConfidentialNoteEventsOnServices, :migration, :sidekiq do +describe ScheduleSetConfidentialNoteEventsOnServices, :migration do let(:services_table) { table(:services) } let(:migration_class) { Gitlab::BackgroundMigration::SetConfidentialNoteEventsOnServices } let(:migration_name) { migration_class.to_s.demodulize } diff --git a/spec/migrations/assure_commits_count_for_merge_request_diff_spec.rb b/spec/migrations/assure_commits_count_for_merge_request_diff_spec.rb index ae53b4e6443..17342dcaab3 100644 --- a/spec/migrations/assure_commits_count_for_merge_request_diff_spec.rb +++ b/spec/migrations/assure_commits_count_for_merge_request_diff_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20180425131009_assure_commits_count_for_merge_request_diff.rb') -describe AssureCommitsCountForMergeRequestDiff, :migration, :sidekiq, :redis do +describe AssureCommitsCountForMergeRequestDiff, :migration, :redis do let(:migration) { spy('migration') } before do diff --git a/spec/migrations/cleanup_build_stage_migration_spec.rb b/spec/migrations/cleanup_build_stage_migration_spec.rb index 532212810c8..2142b7b5275 100644 --- a/spec/migrations/cleanup_build_stage_migration_spec.rb +++ b/spec/migrations/cleanup_build_stage_migration_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20180420010616_cleanup_build_stage_migration.rb') -describe CleanupBuildStageMigration, :migration, :sidekiq, :redis do +describe CleanupBuildStageMigration, :migration, :redis do let(:migration) { spy('migration') } before do diff --git a/spec/migrations/cleanup_legacy_artifact_migration_spec.rb b/spec/migrations/cleanup_legacy_artifact_migration_spec.rb index dc269d32e5a..0ab7d7ec05f 100644 --- a/spec/migrations/cleanup_legacy_artifact_migration_spec.rb +++ b/spec/migrations/cleanup_legacy_artifact_migration_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20190104182041_cleanup_legacy_artifact_migration.rb') -describe CleanupLegacyArtifactMigration, :migration, :sidekiq, :redis do +describe CleanupLegacyArtifactMigration, :migration, :redis do let(:migration) { spy('migration') } context 'when still legacy artifacts exist' do diff --git a/spec/migrations/cleanup_stages_position_migration_spec.rb b/spec/migrations/cleanup_stages_position_migration_spec.rb index 649fda1bb4e..c2077629919 100644 --- a/spec/migrations/cleanup_stages_position_migration_spec.rb +++ b/spec/migrations/cleanup_stages_position_migration_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180604123514_cleanup_stages_position_migration.rb') -describe CleanupStagesPositionMigration, :migration, :sidekiq, :redis do +describe CleanupStagesPositionMigration, :migration, :redis do let(:migration) { spy('migration') } before do diff --git a/spec/migrations/enqueue_reset_merge_status_second_run_spec.rb b/spec/migrations/enqueue_reset_merge_status_second_run_spec.rb index 3c880c6f5fd..bdc248f2cf2 100644 --- a/spec/migrations/enqueue_reset_merge_status_second_run_spec.rb +++ b/spec/migrations/enqueue_reset_merge_status_second_run_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190620112608_enqueue_reset_merge_status_second_run.rb') -describe EnqueueResetMergeStatusSecondRun, :migration, :sidekiq do +describe EnqueueResetMergeStatusSecondRun, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:namespace) { namespaces.create(name: 'gitlab', path: 'gitlab-org') } diff --git a/spec/migrations/enqueue_reset_merge_status_spec.rb b/spec/migrations/enqueue_reset_merge_status_spec.rb index a6dd2e08079..4b312a3bc62 100644 --- a/spec/migrations/enqueue_reset_merge_status_spec.rb +++ b/spec/migrations/enqueue_reset_merge_status_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190528180441_enqueue_reset_merge_status.rb') -describe EnqueueResetMergeStatus, :migration, :sidekiq do +describe EnqueueResetMergeStatus, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:namespace) { namespaces.create(name: 'gitlab', path: 'gitlab-org') } diff --git a/spec/migrations/enqueue_verify_pages_domain_workers_spec.rb b/spec/migrations/enqueue_verify_pages_domain_workers_spec.rb index 327fb09ffec..8efaab871a1 100644 --- a/spec/migrations/enqueue_verify_pages_domain_workers_spec.rb +++ b/spec/migrations/enqueue_verify_pages_domain_workers_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180216121030_enqueue_verify_pages_domain_workers') -describe EnqueueVerifyPagesDomainWorkers, :sidekiq, :migration do +describe EnqueueVerifyPagesDomainWorkers, :migration do around do |example| Sidekiq::Testing.fake! do example.run diff --git a/spec/migrations/migrate_cluster_configure_worker_sidekiq_queue_spec.rb b/spec/migrations/migrate_cluster_configure_worker_sidekiq_queue_spec.rb index 4e7438fc182..a3ed9b722d5 100644 --- a/spec/migrations/migrate_cluster_configure_worker_sidekiq_queue_spec.rb +++ b/spec/migrations/migrate_cluster_configure_worker_sidekiq_queue_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20181219145520_migrate_cluster_configure_worker_sidekiq_queue.rb') -describe MigrateClusterConfigureWorkerSidekiqQueue, :sidekiq, :redis do +describe MigrateClusterConfigureWorkerSidekiqQueue, :redis do include Gitlab::Database::MigrationHelpers include StubWorker diff --git a/spec/migrations/migrate_create_trace_artifact_sidekiq_queue_spec.rb b/spec/migrations/migrate_create_trace_artifact_sidekiq_queue_spec.rb index d54aac50dc8..6e0bd487d1f 100644 --- a/spec/migrations/migrate_create_trace_artifact_sidekiq_queue_spec.rb +++ b/spec/migrations/migrate_create_trace_artifact_sidekiq_queue_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb') -describe MigrateCreateTraceArtifactSidekiqQueue, :sidekiq, :redis do +describe MigrateCreateTraceArtifactSidekiqQueue, :redis do include Gitlab::Database::MigrationHelpers include StubWorker diff --git a/spec/migrations/migrate_discussion_id_on_promoted_epics_spec.rb b/spec/migrations/migrate_discussion_id_on_promoted_epics_spec.rb index 5e25d1aed82..deeea74bd3b 100644 --- a/spec/migrations/migrate_discussion_id_on_promoted_epics_spec.rb +++ b/spec/migrations/migrate_discussion_id_on_promoted_epics_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190715193142_migrate_discussion_id_on_promoted_epics.rb') -describe MigrateDiscussionIdOnPromotedEpics, :migration, :sidekiq do +describe MigrateDiscussionIdOnPromotedEpics, :migration do let(:migration_class) { described_class::MIGRATION } let(:migration_name) { migration_class.to_s.demodulize } diff --git a/spec/migrations/migrate_legacy_artifacts_to_job_artifacts_spec.rb b/spec/migrations/migrate_legacy_artifacts_to_job_artifacts_spec.rb index 98bbe0ed5a2..d6259023c01 100644 --- a/spec/migrations/migrate_legacy_artifacts_to_job_artifacts_spec.rb +++ b/spec/migrations/migrate_legacy_artifacts_to_job_artifacts_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb') -describe MigrateLegacyArtifactsToJobArtifacts, :migration, :sidekiq do +describe MigrateLegacyArtifactsToJobArtifacts, :migration do let(:migration_class) { Gitlab::BackgroundMigration::MigrateLegacyArtifacts } let(:migration_name) { migration_class.to_s.demodulize } diff --git a/spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb b/spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb index 6a188f34854..aa4951b2f14 100644 --- a/spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb +++ b/spec/migrations/migrate_object_storage_upload_sidekiq_queue_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180603190921_migrate_object_storage_upload_sidekiq_queue.rb') -describe MigrateObjectStorageUploadSidekiqQueue, :sidekiq, :redis do +describe MigrateObjectStorageUploadSidekiqQueue, :redis do include Gitlab::Database::MigrationHelpers include StubWorker diff --git a/spec/migrations/migrate_storage_migrator_sidekiq_queue_spec.rb b/spec/migrations/migrate_storage_migrator_sidekiq_queue_spec.rb index d8f39ce4e71..557eb52632f 100644 --- a/spec/migrations/migrate_storage_migrator_sidekiq_queue_spec.rb +++ b/spec/migrations/migrate_storage_migrator_sidekiq_queue_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190124200344_migrate_storage_migrator_sidekiq_queue.rb') -describe MigrateStorageMigratorSidekiqQueue, :sidekiq, :redis do +describe MigrateStorageMigratorSidekiqQueue, :redis do include Gitlab::Database::MigrationHelpers include StubWorker diff --git a/spec/migrations/migrate_update_head_pipeline_for_merge_request_sidekiq_queue_spec.rb b/spec/migrations/migrate_update_head_pipeline_for_merge_request_sidekiq_queue_spec.rb index e517eef1320..204c38b3fc5 100644 --- a/spec/migrations/migrate_update_head_pipeline_for_merge_request_sidekiq_queue_spec.rb +++ b/spec/migrations/migrate_update_head_pipeline_for_merge_request_sidekiq_queue_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb') -describe MigrateUpdateHeadPipelineForMergeRequestSidekiqQueue, :sidekiq, :redis do +describe MigrateUpdateHeadPipelineForMergeRequestSidekiqQueue, :redis do include Gitlab::Database::MigrationHelpers include StubWorker diff --git a/spec/migrations/patch_prometheus_services_for_shared_cluster_applications_spec.rb b/spec/migrations/patch_prometheus_services_for_shared_cluster_applications_spec.rb index 83f994c2a94..170251277e2 100644 --- a/spec/migrations/patch_prometheus_services_for_shared_cluster_applications_spec.rb +++ b/spec/migrations/patch_prometheus_services_for_shared_cluster_applications_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20200114113341_patch_prometheus_services_for_shared_cluster_applications.rb') -describe PatchPrometheusServicesForSharedClusterApplications, :migration, :sidekiq do +describe PatchPrometheusServicesForSharedClusterApplications, :migration do include MigrationHelpers::PrometheusServiceHelpers let(:namespaces) { table(:namespaces) } diff --git a/spec/migrations/reschedule_builds_stages_migration_spec.rb b/spec/migrations/reschedule_builds_stages_migration_spec.rb index f9707d8f90b..8127934afab 100644 --- a/spec/migrations/reschedule_builds_stages_migration_spec.rb +++ b/spec/migrations/reschedule_builds_stages_migration_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180405101928_reschedule_builds_stages_migration') -describe RescheduleBuildsStagesMigration, :sidekiq, :migration do +describe RescheduleBuildsStagesMigration, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:pipelines) { table(:ci_pipelines) } diff --git a/spec/migrations/reschedule_commits_count_for_merge_request_diff_spec.rb b/spec/migrations/reschedule_commits_count_for_merge_request_diff_spec.rb index a62650c44fb..0e34e63fcc1 100644 --- a/spec/migrations/reschedule_commits_count_for_merge_request_diff_spec.rb +++ b/spec/migrations/reschedule_commits_count_for_merge_request_diff_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20180309121820_reschedule_commits_count_for_merge_request_diff') -describe RescheduleCommitsCountForMergeRequestDiff, :migration, :sidekiq do +describe RescheduleCommitsCountForMergeRequestDiff, :migration do let(:merge_request_diffs) { table(:merge_request_diffs) } let(:merge_requests) { table(:merge_requests) } let(:projects) { table(:projects) } diff --git a/spec/migrations/schedule_digest_personal_access_tokens_spec.rb b/spec/migrations/schedule_digest_personal_access_tokens_spec.rb index ff859d07ff2..915397f0f4f 100644 --- a/spec/migrations/schedule_digest_personal_access_tokens_spec.rb +++ b/spec/migrations/schedule_digest_personal_access_tokens_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180913142237_schedule_digest_personal_access_tokens.rb') -describe ScheduleDigestPersonalAccessTokens, :migration, :sidekiq do +describe ScheduleDigestPersonalAccessTokens, :migration do let(:personal_access_tokens) { table(:personal_access_tokens) } let(:users) { table(:users) } diff --git a/spec/migrations/schedule_fill_valid_time_for_pages_domain_certificates_spec.rb b/spec/migrations/schedule_fill_valid_time_for_pages_domain_certificates_spec.rb index a0241f1d20c..43333ab9837 100644 --- a/spec/migrations/schedule_fill_valid_time_for_pages_domain_certificates_spec.rb +++ b/spec/migrations/schedule_fill_valid_time_for_pages_domain_certificates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190524073827_schedule_fill_valid_time_for_pages_domain_certificates.rb') -describe ScheduleFillValidTimeForPagesDomainCertificates, :migration, :sidekiq do +describe ScheduleFillValidTimeForPagesDomainCertificates, :migration do let(:migration_class) { described_class::MIGRATION } let(:migration_name) { migration_class.to_s.demodulize } diff --git a/spec/migrations/schedule_pages_metadata_migration_spec.rb b/spec/migrations/schedule_pages_metadata_migration_spec.rb index 100ed520a32..bf9442808bc 100644 --- a/spec/migrations/schedule_pages_metadata_migration_spec.rb +++ b/spec/migrations/schedule_pages_metadata_migration_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20191002031332_schedule_pages_metadata_migration') -describe SchedulePagesMetadataMigration, :migration, :sidekiq do +describe SchedulePagesMetadataMigration, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } diff --git a/spec/migrations/schedule_populate_merge_request_assignees_table_spec.rb b/spec/migrations/schedule_populate_merge_request_assignees_table_spec.rb index e397fbb7138..44ef72baa86 100644 --- a/spec/migrations/schedule_populate_merge_request_assignees_table_spec.rb +++ b/spec/migrations/schedule_populate_merge_request_assignees_table_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190322132835_schedule_populate_merge_request_assignees_table.rb') -describe SchedulePopulateMergeRequestAssigneesTable, :migration, :sidekiq do +describe SchedulePopulateMergeRequestAssigneesTable, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:namespace) { namespaces.create(name: 'gitlab', path: 'gitlab-org') } diff --git a/spec/migrations/schedule_runners_token_encryption_spec.rb b/spec/migrations/schedule_runners_token_encryption_spec.rb index 6b9538c4d17..60abb98f629 100644 --- a/spec/migrations/schedule_runners_token_encryption_spec.rb +++ b/spec/migrations/schedule_runners_token_encryption_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20181121111200_schedule_runners_token_encryption') -describe ScheduleRunnersTokenEncryption, :migration, :sidekiq do +describe ScheduleRunnersTokenEncryption, :migration do let(:settings) { table(:application_settings) } let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } diff --git a/spec/migrations/schedule_set_confidential_note_events_on_webhooks_spec.rb b/spec/migrations/schedule_set_confidential_note_events_on_webhooks_spec.rb index 845b0515177..c022610be08 100644 --- a/spec/migrations/schedule_set_confidential_note_events_on_webhooks_spec.rb +++ b/spec/migrations/schedule_set_confidential_note_events_on_webhooks_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180104131052_schedule_set_confidential_note_events_on_webhooks.rb') -describe ScheduleSetConfidentialNoteEventsOnWebhooks, :migration, :sidekiq do +describe ScheduleSetConfidentialNoteEventsOnWebhooks, :migration do let(:web_hooks_table) { table(:web_hooks) } let(:migration_class) { Gitlab::BackgroundMigration::SetConfidentialNoteEventsOnWebhooks } let(:migration_name) { migration_class.to_s.demodulize } diff --git a/spec/migrations/schedule_stages_index_migration_spec.rb b/spec/migrations/schedule_stages_index_migration_spec.rb index 9ebc648f9d8..f2e9abe1eb8 100644 --- a/spec/migrations/schedule_stages_index_migration_spec.rb +++ b/spec/migrations/schedule_stages_index_migration_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20180420080616_schedule_stages_index_migration') -describe ScheduleStagesIndexMigration, :sidekiq, :migration do +describe ScheduleStagesIndexMigration, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:pipelines) { table(:ci_pipelines) } diff --git a/spec/migrations/schedule_sync_issuables_state_id_spec.rb b/spec/migrations/schedule_sync_issuables_state_id_spec.rb index 4f841e8ce04..21844edeb40 100644 --- a/spec/migrations/schedule_sync_issuables_state_id_spec.rb +++ b/spec/migrations/schedule_sync_issuables_state_id_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190214112022_schedule_sync_issuables_state_id.rb') -describe ScheduleSyncIssuablesStateId, :migration, :sidekiq do +describe ScheduleSyncIssuablesStateId, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:merge_requests) { table(:merge_requests) } diff --git a/spec/migrations/schedule_sync_issuables_state_id_where_nil_spec.rb b/spec/migrations/schedule_sync_issuables_state_id_where_nil_spec.rb index 105c05bb7ca..5dbe0d973ae 100644 --- a/spec/migrations/schedule_sync_issuables_state_id_where_nil_spec.rb +++ b/spec/migrations/schedule_sync_issuables_state_id_where_nil_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190506135400_schedule_sync_issuables_state_id_where_nil') -describe ScheduleSyncIssuablesStateIdWhereNil, :migration, :sidekiq do +describe ScheduleSyncIssuablesStateIdWhereNil, :migration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:merge_requests) { table(:merge_requests) } diff --git a/spec/migrations/sync_issuables_state_id_spec.rb b/spec/migrations/sync_issuables_state_id_spec.rb index c6e4b504bbb..3138d2bec33 100644 --- a/spec/migrations/sync_issuables_state_id_spec.rb +++ b/spec/migrations/sync_issuables_state_id_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190911251732_sync_issuables_state_id') -describe SyncIssuablesStateId, :migration, :sidekiq do +describe SyncIssuablesStateId, :migration do let(:migration) { described_class.new } describe '#up' do diff --git a/spec/migrations/update_fingerprint_sha256_within_keys_spec.rb b/spec/migrations/update_fingerprint_sha256_within_keys_spec.rb index bdb661af904..20a506ea976 100644 --- a/spec/migrations/update_fingerprint_sha256_within_keys_spec.rb +++ b/spec/migrations/update_fingerprint_sha256_within_keys_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20200106071113_update_fingerprint_sha256_within_keys.rb') -describe UpdateFingerprintSha256WithinKeys, :sidekiq, :migration do +describe UpdateFingerprintSha256WithinKeys, :migration do let(:key_table) { table(:keys) } describe '#up' do diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index f0f6556deec..b99f51bb36e 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -3854,6 +3854,10 @@ describe Ci::Build do set(:build) { create(:ci_build, project: project) } let(:path) { 'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif' } + around do |example| + Timecop.freeze { example.run } + end + before do stub_artifacts_object_storage end diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb index 5b402e572c3..41630c71f21 100644 --- a/spec/models/error_tracking/project_error_tracking_setting_spec.rb +++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb @@ -267,7 +267,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do end it { expect(result[:issue].gitlab_commit).to eq(commit_id) } - it { expect(result[:issue].gitlab_commit_path).to eq("/#{project.namespace.path}/#{project.path}/commit/#{commit_id}") } + it { expect(result[:issue].gitlab_commit_path).to eq("/#{project.namespace.path}/#{project.path}/-/commit/#{commit_id}") } end end diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index 6c3da490b08..c573bf7793a 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -421,7 +421,7 @@ describe JiraService do GlobalID: 'GitLab', relationship: 'mentioned on', object: { - url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/#{commit_id}", + url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/-/commit/#{commit_id}", title: "Solved by commit #{commit_id}.", icon: { title: 'GitLab', url16x16: favicon_path }, status: { resolved: true } @@ -464,7 +464,7 @@ describe JiraService do @jira_service.close_issue(resource, ExternalIssue.new('JIRA-123', project)) expect(WebMock).to have_requested(:post, @comment_url).with( - body: %r{#{custom_base_url}/#{project.full_path}/commit/#{commit_id}} + body: %r{#{custom_base_url}/#{project.full_path}/-/commit/#{commit_id}} ).once end @@ -479,7 +479,7 @@ describe JiraService do @jira_service.close_issue(resource, ExternalIssue.new('JIRA-123', project)) expect(WebMock).to have_requested(:post, @comment_url).with( - body: %r{#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/#{commit_id}} + body: %r{#{Gitlab.config.gitlab.url}/#{project.full_path}/-/commit/#{commit_id}} ).once end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 2b9ec4319f5..97b61b44856 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -6,8 +6,6 @@ shared_examples 'languages and percentages JSON response' do let(:expected_languages) { project.repository.languages.map { |language| language.values_at(:label, :value)}.to_h } before do - allow(DetectRepositoryLanguagesWorker).to receive(:perform_async).and_call_original - allow(project.repository).to receive(:languages).and_return( [{ value: 66.69, label: "Ruby", color: "#701516", highlight: "#701516" }, { value: 22.98, label: "JavaScript", color: "#f1e05a", highlight: "#f1e05a" }, diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb index e0f88caeab6..12fd9f431e5 100644 --- a/spec/requests/api/releases_spec.rb +++ b/spec/requests/api/releases_spec.rb @@ -61,9 +61,9 @@ describe API::Releases do it 'returns rendered helper paths' do get api("/projects/#{project.id}/releases", maintainer) - expect(json_response.first['commit_path']).to eq("/#{release_2.project.full_path}/commit/#{release_2.commit.id}") + expect(json_response.first['commit_path']).to eq("/#{release_2.project.full_path}/-/commit/#{release_2.commit.id}") expect(json_response.first['tag_path']).to eq("/#{release_2.project.full_path}/-/tags/#{release_2.tag}") - expect(json_response.second['commit_path']).to eq("/#{release_1.project.full_path}/commit/#{release_1.commit.id}") + expect(json_response.second['commit_path']).to eq("/#{release_1.project.full_path}/-/commit/#{release_1.commit.id}") expect(json_response.second['tag_path']).to eq("/#{release_1.project.full_path}/-/tags/#{release_1.tag}") end @@ -164,7 +164,7 @@ describe API::Releases do expect(response).to match_response_schema('public_api/v4/releases') expect(json_response.first['assets']['count']).to eq(release.links.count + release.sources.count) - expect(json_response.first['commit_path']).to eq("/#{release.project.full_path}/commit/#{release.commit.id}") + expect(json_response.first['commit_path']).to eq("/#{release.project.full_path}/-/commit/#{release.commit.id}") expect(json_response.first['tag_path']).to eq("/#{release.project.full_path}/-/tags/#{release.tag}") end end @@ -214,7 +214,7 @@ describe API::Releases do expect(json_response['author']['name']).to eq(maintainer.name) expect(json_response['commit']['id']).to eq(commit.id) expect(json_response['assets']['count']).to eq(4) - expect(json_response['commit_path']).to eq("/#{release.project.full_path}/commit/#{release.commit.id}") + expect(json_response['commit_path']).to eq("/#{release.project.full_path}/-/commit/#{release.commit.id}") expect(json_response['tag_path']).to eq("/#{release.project.full_path}/-/tags/#{release.tag}") end diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 23ce17b14fc..eb9db7ff6b7 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -311,11 +311,33 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end describe '/api/v4/jobs' do + shared_examples 'application context metadata' do |api_route| + it 'contains correct context metadata' do + # Avoids popping the context from the thread so we can + # check its content after the request. + allow(Labkit::Context).to receive(:pop) + + send_request + + Labkit::Context.with_context do |context| + expected_context = { + 'meta.caller_id' => api_route, + 'meta.user' => job.user.username, + 'meta.project' => job.project.full_path, + 'meta.root_namespace' => job.project.full_path_components.first + } + + expect(context.to_h).to include(expected_context) + end + end + end + let(:root_namespace) { create(:namespace) } let(:namespace) { create(:namespace, parent: root_namespace) } let(:project) { create(:project, namespace: namespace, shared_runners_enabled: false) } let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master') } let(:runner) { create(:ci_runner, :project, projects: [project]) } + let(:user) { create(:user) } let(:job) do create(:ci_build, :artifacts, :extended_options, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0) @@ -984,12 +1006,18 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end describe 'PUT /api/v4/jobs/:id' do - let(:job) { create(:ci_build, :pending, :trace_live, pipeline: pipeline, runner_id: runner.id) } + let(:job) do + create(:ci_build, :pending, :trace_live, pipeline: pipeline, project: project, user: user, runner_id: runner.id) + end before do job.run! end + it_behaves_like 'application context metadata', '/api/:version/jobs/:id' do + let(:send_request) { update_job(state: 'success') } + end + context 'when status is given' do it 'mark job as succeeded' do update_job(state: 'success') @@ -1139,7 +1167,10 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end describe 'PATCH /api/v4/jobs/:id/trace' do - let(:job) { create(:ci_build, :running, :trace_live, runner_id: runner.id, pipeline: pipeline) } + let(:job) do + create(:ci_build, :running, :trace_live, + project: project, user: user, runner_id: runner.id, pipeline: pipeline) + end let(:headers) { { API::Helpers::Runner::JOB_TOKEN_HEADER => job.token, 'Content-Type' => 'text/plain' } } let(:headers_with_range) { headers.merge({ 'Content-Range' => '11-20' }) } let(:update_interval) { 10.seconds.to_i } @@ -1148,6 +1179,10 @@ describe API::Runner, :clean_gitlab_redis_shared_state do initial_patch_the_trace end + it_behaves_like 'application context metadata', '/api/:version/jobs/:id/trace' do + let(:send_request) { patch_the_trace } + end + context 'when request is valid' do it 'gets correct response' do expect(response.status).to eq 202 @@ -1399,7 +1434,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end describe 'artifacts' do - let(:job) { create(:ci_build, :pending, pipeline: pipeline, runner_id: runner.id) } + let(:job) { create(:ci_build, :pending, user: user, project: project, pipeline: pipeline, runner_id: runner.id) } let(:jwt_token) { JWT.encode({ 'iss' => 'gitlab-workhorse' }, Gitlab::Workhorse.secret, 'HS256') } let(:headers) { { 'GitLab-Workhorse' => '1.0', Gitlab::Workhorse::INTERNAL_API_REQUEST_HEADER => jwt_token } } let(:headers_with_token) { headers.merge(API::Helpers::Runner::JOB_TOKEN_HEADER => job.token) } @@ -1418,6 +1453,10 @@ describe API::Runner, :clean_gitlab_redis_shared_state do authorize_artifacts_with_token_in_params end + it_behaves_like 'application context metadata', '/api/:version/jobs/:id/artifacts/authorize' do + let(:send_request) { subject } + end + shared_examples 'authorizes local file' do it 'succeeds' do subject @@ -1571,6 +1610,12 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end describe 'POST /api/v4/jobs/:id/artifacts' do + it_behaves_like 'application context metadata', '/api/:version/jobs/:id/artifacts' do + let(:send_request) do + upload_artifacts(file_upload, headers_with_token) + end + end + context 'when artifacts are being stored inside of tmp path' do before do # by configuring this path we allow to pass temp file from any path @@ -1971,6 +2016,10 @@ describe API::Runner, :clean_gitlab_redis_shared_state do describe 'GET /api/v4/jobs/:id/artifacts' do let(:token) { job.token } + it_behaves_like 'application context metadata', '/api/:version/jobs/:id/artifacts' do + let(:send_request) { download_artifact } + end + context 'when job has artifacts' do let(:job) { create(:ci_build) } let(:store) { JobArtifactUploader::Store::LOCAL } diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index ef26676a6e4..40c9dd565ff 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -445,10 +445,14 @@ describe 'project routing' do # project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /\h{7,40}/, project_id: /[^\/]+/} describe Projects::CommitController, 'routing' do it 'to #show' do + expect(get('/gitlab/gitlabhq/-/commit/4246fbd')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd') + expect(get('/gitlab/gitlabhq/-/commit/4246fbd.diff')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd', format: 'diff') + expect(get('/gitlab/gitlabhq/-/commit/4246fbd.patch')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd', format: 'patch') + expect(get('/gitlab/gitlabhq/-/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') + end + + it 'to #show unscoped routing' do expect(get('/gitlab/gitlabhq/commit/4246fbd')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd') - expect(get('/gitlab/gitlabhq/commit/4246fbd.diff')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd', format: 'diff') - expect(get('/gitlab/gitlabhq/commit/4246fbd.patch')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd', format: 'patch') - expect(get('/gitlab/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5')).to route_to('projects/commit#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') end end diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb index 83df54bc2ff..258403db089 100644 --- a/spec/services/ci/retry_build_service_spec.rb +++ b/spec/services/ci/retry_build_service_spec.rb @@ -46,7 +46,7 @@ describe Ci::RetryBuildService do sourced_pipelines artifacts_file_store artifacts_metadata_store metadata runner_session trace_chunks upstream_pipeline_id artifacts_file artifacts_metadata artifacts_size commands - resource resource_group_id processed].freeze + resource resource_group_id processed security_scans].freeze shared_examples 'build duplication' do let(:another_pipeline) { create(:ci_empty_pipeline, project: project) } diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb index b1c64bc3c0a..8dc8c804ea5 100644 --- a/spec/services/git/branch_hooks_service_spec.rb +++ b/spec/services/git/branch_hooks_service_spec.rb @@ -69,6 +69,7 @@ describe Git::BranchHooksService do Gitlab.config.gitlab.url, project.namespace.to_param, project.to_param, + '-', 'commit', commit.id ].join('/') diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb index 4d7ec7ac1d8..c64b93a2532 100644 --- a/spec/services/git/branch_push_service_spec.rb +++ b/spec/services/git/branch_push_service_spec.rb @@ -421,7 +421,7 @@ describe Git::BranchPushService, services: true do let(:message) { "this is some work.\n\ncloses JIRA-1" } let(:comment_body) do { - body: "Issue solved with [#{closing_commit.id}|http://#{Gitlab.config.gitlab.host}/#{project.full_path}/commit/#{closing_commit.id}]." + body: "Issue solved with [#{closing_commit.id}|http://#{Gitlab.config.gitlab.host}/#{project.full_path}/-/commit/#{closing_commit.id}]." }.to_json end diff --git a/spec/services/git/tag_hooks_service_spec.rb b/spec/services/git/tag_hooks_service_spec.rb index abb5b9b130b..094ccd8c9f0 100644 --- a/spec/services/git/tag_hooks_service_spec.rb +++ b/spec/services/git/tag_hooks_service_spec.rb @@ -107,6 +107,7 @@ describe Git::TagHooksService, :service do Gitlab.config.gitlab.url, project.namespace.to_param, project.to_param, + '-', 'commit', commit.id ].join('/') diff --git a/spec/services/merge_requests/migrate_external_diffs_service_spec.rb b/spec/services/merge_requests/migrate_external_diffs_service_spec.rb index 40ac747e66f..233b944624f 100644 --- a/spec/services/merge_requests/migrate_external_diffs_service_spec.rb +++ b/spec/services/merge_requests/migrate_external_diffs_service_spec.rb @@ -6,7 +6,7 @@ describe MergeRequests::MigrateExternalDiffsService do let(:merge_request) { create(:merge_request) } let(:diff) { merge_request.merge_request_diff } - describe '.enqueue!', :sidekiq do + describe '.enqueue!' do around do |example| Sidekiq::Testing.fake! { example.run } end diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index 9ef8b390b92..3df620d1fea 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -322,7 +322,7 @@ describe SystemNoteService do links = [] if link_exists url = if type == 'commit' - "#{Settings.gitlab.base_url}/#{project.namespace.path}/#{project.path}/commit/#{commit.id}" + "#{Settings.gitlab.base_url}/#{project.namespace.path}/#{project.path}/-/commit/#{commit.id}" else "#{Settings.gitlab.base_url}/#{project.namespace.path}/#{project.path}/-/merge_requests/#{merge_request.iid}" end @@ -462,7 +462,7 @@ describe SystemNoteService do describe "existing reference" do before do allow(JIRA::Resource::Remotelink).to receive(:all).and_return([]) - message = "[#{author.name}|http://localhost/#{author.username}] mentioned this issue in [a commit of #{project.full_path}|http://localhost/#{project.full_path}/commit/#{commit.id}]:\n'#{commit.title.chomp}'" + message = "[#{author.name}|http://localhost/#{author.username}] mentioned this issue in [a commit of #{project.full_path}|http://localhost/#{project.full_path}/-/commit/#{commit.id}]:\n'#{commit.title.chomp}'" allow_next_instance_of(JIRA::Resource::Issue) do |instance| allow(instance).to receive(:comments).and_return([OpenStruct.new(body: message)]) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 32eeeb5dfb4..ad15793f23b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -121,9 +121,9 @@ RSpec.configure do |config| config.include ExpectRequestWithStatus, type: :request config.include RailsHelpers - if ENV['CI'] + if ENV['CI'] || ENV['RETRIES'] # This includes the first try, i.e. tests will be run 4 times before failing. - config.default_retry_count = 4 + config.default_retry_count = ENV.fetch('RETRIES', 3).to_i + 1 config.reporter.register_listener( RspecFlaky::Listener.new, :example_passed, @@ -139,6 +139,16 @@ RSpec.configure do |config| TestEnv.clean_test_path end + # We can't use an `around` hook here because the wrapping transaction + # is not yet opened at the time that is triggered + config.prepend_before do + Gitlab::Database.set_open_transactions_baseline + end + + config.append_after do + Gitlab::Database.reset_open_transactions_baseline + end + config.before do |example| # Enable all features by default for testing allow(Feature).to receive(:enabled?) { true } @@ -176,12 +186,12 @@ RSpec.configure do |config| # Stub these calls due to being expensive operations # It can be reenabled for specific tests via: # - # allow(DetectRepositoryLanguagesWorker).to receive(:perform_async).and_call_original - # allow(Gitlab::Git::KeepAround).to receive(:execute).and_call_original - allow(DetectRepositoryLanguagesWorker).to receive(:perform_async).and_return(true) + # expect(Gitlab::Git::KeepAround).to receive(:execute).and_call_original allow(Gitlab::Git::KeepAround).to receive(:execute) + # Clear thread cache and Sidekiq queues Gitlab::ThreadMemoryCache.cache_backend.clear + Sidekiq::Worker.clear_all # Temporary patch to force admin mode to be active by default in tests when # using the feature flag :user_mode_in_session, since this will require @@ -217,11 +227,14 @@ RSpec.configure do |config| RequestStore.clear! end - config.after do - Fog.unmock! if Fog.mock? + config.around do |example| + # Wrap each example in it's own context to make sure the contexts don't + # leak + Labkit::Context.with_context { example.run } end config.after do + Fog.unmock! if Fog.mock? Gitlab::CurrentSettings.clear_in_memory_application_settings! end @@ -236,90 +249,6 @@ RSpec.configure do |config| Gitlab::Metrics.reset_registry! end - config.around(:each, :use_clean_rails_memory_store_caching) do |example| - caching_store = Rails.cache - Rails.cache = ActiveSupport::Cache::MemoryStore.new - - example.run - - Rails.cache = caching_store - end - - config.around do |example| - # Wrap each example in it's own context to make sure the contexts don't - # leak - Labkit::Context.with_context { example.run } - end - - config.around(:each, :clean_gitlab_redis_cache) do |example| - redis_cache_cleanup! - - example.run - - redis_cache_cleanup! - end - - config.around(:each, :clean_gitlab_redis_shared_state) do |example| - redis_shared_state_cleanup! - - example.run - - redis_shared_state_cleanup! - end - - config.around(:each, :clean_gitlab_redis_queues) do |example| - redis_queues_cleanup! - - example.run - - redis_queues_cleanup! - end - - config.around(:each, :use_clean_rails_memory_store_fragment_caching) do |example| - caching_store = ActionController::Base.cache_store - ActionController::Base.cache_store = ActiveSupport::Cache::MemoryStore.new - ActionController::Base.perform_caching = true - - example.run - - ActionController::Base.perform_caching = false - ActionController::Base.cache_store = caching_store - end - - config.around(:each, :use_sql_query_cache) do |example| - ActiveRecord::Base.cache do - example.run - end - end - - # The :each scope runs "inside" the example, so this hook ensures the DB is in the - # correct state before any examples' before hooks are called. This prevents a - # problem where `ScheduleIssuesClosedAtTypeChange` (or any migration that depends - # on background migrations being run inline during test setup) can be broken by - # altering Sidekiq behavior in an unrelated spec like so: - # - # around do |example| - # Sidekiq::Testing.fake! do - # example.run - # end - # end - config.before(:context, :migration) do - schema_migrate_down! - end - - # Each example may call `migrate!`, so we must ensure we are migrated down every time - config.before(:each, :migration) do - use_fake_application_settings - - schema_migrate_down! - end - - config.after(:context, :migration) do - schema_migrate_up! - - Gitlab::CurrentSettings.clear_in_memory_application_settings! - end - # This makes sure the `ApplicationController#can?` method is stubbed with the # original implementation for all view specs. config.before(:each, type: :view) do @@ -327,60 +256,8 @@ RSpec.configure do |config| Ability.allowed?(*args) end end - - config.before(:each, :http_pages_enabled) do |_| - allow(Gitlab.config.pages).to receive(:external_http).and_return(['1.1.1.1:80']) - end - - config.before(:each, :https_pages_enabled) do |_| - allow(Gitlab.config.pages).to receive(:external_https).and_return(['1.1.1.1:443']) - end - - config.before(:each, :http_pages_disabled) do |_| - allow(Gitlab.config.pages).to receive(:external_http).and_return(false) - end - - config.before(:each, :https_pages_disabled) do |_| - allow(Gitlab.config.pages).to receive(:external_https).and_return(false) - end - - # We can't use an `around` hook here because the wrapping transaction - # is not yet opened at the time that is triggered - config.prepend_before do - Gitlab::Database.set_open_transactions_baseline - end - - config.append_after do - Gitlab::Database.reset_open_transactions_baseline - end end -# add simpler way to match asset paths containing digest strings -RSpec::Matchers.define :match_asset_path do |expected| - match do |actual| - path = Regexp.escape(expected) - extname = Regexp.escape(File.extname(expected)) - digest_regex = Regexp.new(path.sub(extname, "(?:-\\h+)?#{extname}") << '$') - digest_regex =~ actual - end - - failure_message do |actual| - "expected that #{actual} would include an asset path for #{expected}" - end - - failure_message_when_negated do |actual| - "expected that #{actual} would not include an asset path for #{expected}" - end -end - -FactoryBot::SyntaxRunner.class_eval do - include RSpec::Mocks::ExampleMethods -end - -# Use FactoryBot 4.x behavior: -# https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations -FactoryBot.use_parent_strategy = false - ActiveRecord::Migration.maintain_test_schema! Shoulda::Matchers.configure do |config| diff --git a/spec/support/caching.rb b/spec/support/caching.rb new file mode 100644 index 00000000000..ecbe65f7e97 --- /dev/null +++ b/spec/support/caching.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +RSpec.configure do |config| + config.around(:each, :use_clean_rails_memory_store_caching) do |example| + caching_store = Rails.cache + Rails.cache = ActiveSupport::Cache::MemoryStore.new + + example.run + + Rails.cache = caching_store + end + + config.around(:each, :use_clean_rails_memory_store_fragment_caching) do |example| + caching_store = ActionController::Base.cache_store + ActionController::Base.cache_store = ActiveSupport::Cache::MemoryStore.new + ActionController::Base.perform_caching = true + + example.run + + ActionController::Base.perform_caching = false + ActionController::Base.cache_store = caching_store + end + + config.around(:each, :use_sql_query_cache) do |example| + ActiveRecord::Base.cache do + example.run + end + end +end diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb new file mode 100644 index 00000000000..a86161bfded --- /dev/null +++ b/spec/support/factory_bot.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +FactoryBot::SyntaxRunner.class_eval do + include RSpec::Mocks::ExampleMethods +end + +# Use FactoryBot 4.x behavior: +# https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations +FactoryBot.use_parent_strategy = false diff --git a/spec/support/matchers/match_asset_path.rb b/spec/support/matchers/match_asset_path.rb new file mode 100644 index 00000000000..130b1ab02a3 --- /dev/null +++ b/spec/support/matchers/match_asset_path.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# add simpler way to match asset paths containing digest strings +RSpec::Matchers.define :match_asset_path do |expected| + match do |actual| + path = Regexp.escape(expected) + extname = Regexp.escape(File.extname(expected)) + digest_regex = Regexp.new(path.sub(extname, "(?:-\\h+)?#{extname}") << '$') + digest_regex =~ actual + end + + failure_message do |actual| + "expected that #{actual} would include an asset path for #{expected}" + end + + failure_message_when_negated do |actual| + "expected that #{actual} would not include an asset path for #{expected}" + end +end diff --git a/spec/support/migration.rb b/spec/support/migration.rb new file mode 100644 index 00000000000..3c359af886d --- /dev/null +++ b/spec/support/migration.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +RSpec.configure do |config| + # The :each scope runs "inside" the example, so this hook ensures the DB is in the + # correct state before any examples' before hooks are called. This prevents a + # problem where `ScheduleIssuesClosedAtTypeChange` (or any migration that depends + # on background migrations being run inline during test setup) can be broken by + # altering Sidekiq behavior in an unrelated spec like so: + # + # around do |example| + # Sidekiq::Testing.fake! do + # example.run + # end + # end + config.before(:context, :migration) do + schema_migrate_down! + end + + # Each example may call `migrate!`, so we must ensure we are migrated down every time + config.before(:each, :migration) do + use_fake_application_settings + + schema_migrate_down! + end + + config.after(:context, :migration) do + schema_migrate_up! + + Gitlab::CurrentSettings.clear_in_memory_application_settings! + end +end diff --git a/spec/support/pages.rb b/spec/support/pages.rb new file mode 100644 index 00000000000..ad73d5b9ef5 --- /dev/null +++ b/spec/support/pages.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +RSpec.configure do |config| + config.before(:each, :http_pages_enabled) do |_| + allow(Gitlab.config.pages).to receive(:external_http).and_return(['1.1.1.1:80']) + end + + config.before(:each, :https_pages_enabled) do |_| + allow(Gitlab.config.pages).to receive(:external_https).and_return(['1.1.1.1:443']) + end + + config.before(:each, :http_pages_disabled) do |_| + allow(Gitlab.config.pages).to receive(:external_http).and_return(false) + end + + config.before(:each, :https_pages_disabled) do |_| + allow(Gitlab.config.pages).to receive(:external_https).and_return(false) + end +end diff --git a/spec/support/redis.rb b/spec/support/redis.rb new file mode 100644 index 00000000000..8539f202602 --- /dev/null +++ b/spec/support/redis.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +RSpec.configure do |config| + config.after(:each, :redis) do + Sidekiq.redis do |connection| + connection.redis.flushdb + end + end + + config.around(:each, :clean_gitlab_redis_cache) do |example| + redis_cache_cleanup! + + example.run + + redis_cache_cleanup! + end + + config.around(:each, :clean_gitlab_redis_shared_state) do |example| + redis_shared_state_cleanup! + + example.run + + redis_shared_state_cleanup! + end + + config.around(:each, :clean_gitlab_redis_queues) do |example| + redis_queues_cleanup! + + example.run + + redis_queues_cleanup! + end +end diff --git a/spec/support/sidekiq.rb b/spec/support/sidekiq.rb index a6d6d5fc6e1..9fa8df39019 100644 --- a/spec/support/sidekiq.rb +++ b/spec/support/sidekiq.rb @@ -1,30 +1,14 @@ # frozen_string_literal: true RSpec.configure do |config| - config.around(:each, :sidekiq) do |example| - Sidekiq::Worker.clear_all - example.run - Sidekiq::Worker.clear_all - end - - config.after(:each, :sidekiq, :redis) do - Sidekiq.redis do |connection| - connection.redis.flushdb - end - end - # As we'll review the examples with this tag, we should either: # - fix the example to not require Sidekiq inline mode (and remove this tag) # - explicitly keep the inline mode and change the tag for `:sidekiq_inline` instead config.around(:example, :sidekiq_might_not_need_inline) do |example| - Sidekiq::Worker.clear_all Sidekiq::Testing.inline! { example.run } - Sidekiq::Worker.clear_all end config.around(:example, :sidekiq_inline) do |example| - Sidekiq::Worker.clear_all Sidekiq::Testing.inline! { example.run } - Sidekiq::Worker.clear_all end end diff --git a/spec/tasks/gitlab/import_export/import_rake_spec.rb b/spec/tasks/gitlab/import_export/import_rake_spec.rb index b824ede03b2..14e53273a5b 100644 --- a/spec/tasks/gitlab/import_export/import_rake_spec.rb +++ b/spec/tasks/gitlab/import_export/import_rake_spec.rb @@ -2,7 +2,7 @@ require 'rake_helper' -describe 'gitlab:import_export:import rake task', :sidekiq do +describe 'gitlab:import_export:import rake task' do let(:username) { 'root' } let(:namespace_path) { username } let!(:user) { create(:user, username: username) } diff --git a/spec/tasks/gitlab/storage_rake_spec.rb b/spec/tasks/gitlab/storage_rake_spec.rb index ae11e091000..54a84c73a57 100644 --- a/spec/tasks/gitlab/storage_rake_spec.rb +++ b/spec/tasks/gitlab/storage_rake_spec.rb @@ -2,7 +2,7 @@ require 'rake_helper' -describe 'rake gitlab:storage:*', :sidekiq do +describe 'rake gitlab:storage:*' do before do Rake.application.rake_require 'tasks/gitlab/storage' diff --git a/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb index c7a4680e18d..89a1fa80943 100644 --- a/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb +++ b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ObjectStorage::MigrateUploadsWorker, :sidekiq do +describe ObjectStorage::MigrateUploadsWorker do shared_context 'sanity_check! fails' do before do expect(described_class).to receive(:sanity_check!).and_raise(described_class::SanityCheckError) diff --git a/spec/workers/background_migration_worker_spec.rb b/spec/workers/background_migration_worker_spec.rb index e5be8ce0423..aae6fa02a0c 100644 --- a/spec/workers/background_migration_worker_spec.rb +++ b/spec/workers/background_migration_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe BackgroundMigrationWorker, :sidekiq, :clean_gitlab_redis_shared_state do +describe BackgroundMigrationWorker, :clean_gitlab_redis_shared_state do let(:worker) { described_class.new } describe '.minimum_interval' do diff --git a/spec/workers/mail_scheduler/notification_service_worker_spec.rb b/spec/workers/mail_scheduler/notification_service_worker_spec.rb index 14a9f0ed8b7..3c023e713ed 100644 --- a/spec/workers/mail_scheduler/notification_service_worker_spec.rb +++ b/spec/workers/mail_scheduler/notification_service_worker_spec.rb @@ -49,7 +49,7 @@ describe MailScheduler::NotificationServiceWorker do end end - describe '.perform_async', :sidekiq do + describe '.perform_async' do around do |example| Sidekiq::Testing.fake! { example.run } end |