diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-23 09:06:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-23 09:06:03 +0000 |
commit | b3e4ec8e8adf4fe96c982124e91b6a05021a9cda (patch) | |
tree | 5fda0011a7cc7de000186e465e61f893d478a1c8 /spec | |
parent | 90cdc9391171e1be29b2b57a2e2aad0c02c2a7a9 (diff) | |
download | gitlab-ce-b3e4ec8e8adf4fe96c982124e91b6a05021a9cda.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
155 files changed, 767 insertions, 607 deletions
diff --git a/spec/controllers/admin/spam_logs_controller_spec.rb b/spec/controllers/admin/spam_logs_controller_spec.rb index 3bc49023357..d8c96501f5c 100644 --- a/spec/controllers/admin/spam_logs_controller_spec.rb +++ b/spec/controllers/admin/spam_logs_controller_spec.rb @@ -27,7 +27,7 @@ describe Admin::SpamLogsController do expect(response).to have_gitlab_http_status(200) end - it 'removes user and his spam logs when removing the user' do + it 'removes user and his spam logs when removing the user', :sidekiq_might_not_need_inline do delete :destroy, params: { id: first_spam.id, remove_user: true } expect(flash[:notice]).to eq "User #{user.username} was successfully removed." diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index afe21c8b34a..50ba7418d2c 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -35,7 +35,7 @@ describe Admin::UsersController do end end - describe 'DELETE #user with projects' do + describe 'DELETE #user with projects', :sidekiq_might_not_need_inline do let(:project) { create(:project, namespace: user.namespace) } let!(:issue) { create(:issue, author: user) } diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 3c39a6468e5..2ed2b319298 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -45,7 +45,7 @@ describe GroupsController do it { is_expected.to render_template('groups/show') } - it 'assigns events for all the projects in the group' do + it 'assigns events for all the projects in the group', :sidekiq_might_not_need_inline do subject expect(assigns(:events)).to contain_exactly(event) end @@ -125,7 +125,7 @@ describe GroupsController do end context 'as json' do - it 'includes events from all projects in group and subgroups' do + it 'includes events from all projects in group and subgroups', :sidekiq_might_not_need_inline do 2.times do project = create(:project, group: group) create(:event, project: project) @@ -255,7 +255,7 @@ describe GroupsController do end end - describe 'GET #issues' do + describe 'GET #issues', :sidekiq_might_not_need_inline do let(:issue_1) { create(:issue, project: project, title: 'foo') } let(:issue_2) { create(:issue, project: project, title: 'bar') } @@ -304,7 +304,7 @@ describe GroupsController do end end - describe 'GET #merge_requests' do + describe 'GET #merge_requests', :sidekiq_might_not_need_inline do let(:merge_request_1) { create(:merge_request, source_project: project) } let(:merge_request_2) { create(:merge_request, :simple, source_project: project) } diff --git a/spec/controllers/import/phabricator_controller_spec.rb b/spec/controllers/import/phabricator_controller_spec.rb index 85085a8e996..a127e3cda3a 100644 --- a/spec/controllers/import/phabricator_controller_spec.rb +++ b/spec/controllers/import/phabricator_controller_spec.rb @@ -52,7 +52,7 @@ describe Import::PhabricatorController do namespace_id: current_user.namespace_id } end - it 'creates a project to import' do + it 'creates a project to import', :sidekiq_might_not_need_inline do expect_next_instance_of(Gitlab::PhabricatorImport::Importer) do |importer| expect(importer).to receive(:execute) end diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index 086ec9dfbcf..78599935910 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -320,7 +320,7 @@ describe Projects::BlobController do default_params[:project_id] = forked_project end - it 'redirects to blob' do + it 'redirects to blob', :sidekiq_might_not_need_inline do put :update, params: default_params expect(response).to redirect_to(project_blob_path(forked_project, 'master/CHANGELOG')) @@ -328,7 +328,7 @@ describe Projects::BlobController do end context 'when editing on the original repository' do - it "redirects to forked project new merge request" do + it "redirects to forked project new merge request", :sidekiq_might_not_need_inline do default_params[:branch_name] = "fork-test-1" default_params[:create_merge_request] = 1 diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index c9558abab33..4c2b58551bf 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -1252,7 +1252,7 @@ describe Projects::IssuesController do stub_feature_flags(create_confidential_merge_request: true) end - it 'creates a new merge request' do + it 'creates a new merge request', :sidekiq_might_not_need_inline do expect { create_merge_request }.to change(target_project.merge_requests, :count).by(1) end end diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index 90ccb884927..349d73f13ca 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -154,7 +154,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do .and_return(merge_request) end - it 'does not serialize builds in exposed stages' do + it 'does not serialize builds in exposed stages', :sidekiq_might_not_need_inline do get_show_json json_response.dig('pipeline', 'details', 'stages').tap do |stages| @@ -183,7 +183,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do context 'job is cancelable' do let(:job) { create(:ci_build, :running, pipeline: pipeline) } - it 'cancel_path is present with correct redirect' do + it 'cancel_path is present with correct redirect', :sidekiq_might_not_need_inline do expect(response).to have_gitlab_http_status(:ok) expect(response).to match_response_schema('job/job_details') expect(json_response['cancel_path']).to include(CGI.escape(json_response['build_path'])) @@ -193,7 +193,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do context 'with web terminal' do let(:job) { create(:ci_build, :running, :with_runner_session, pipeline: pipeline) } - it 'exposes the terminal path' do + it 'exposes the terminal path', :sidekiq_might_not_need_inline do expect(response).to have_gitlab_http_status(:ok) expect(response).to match_response_schema('job/job_details') expect(json_response['terminal_path']).to match(%r{/terminal}) @@ -268,7 +268,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do project.add_maintainer(user) # Need to be a maintianer to view cluster.path end - it 'exposes the deployment information' do + it 'exposes the deployment information', :sidekiq_might_not_need_inline do get_show_json expect(response).to have_gitlab_http_status(:ok) @@ -292,7 +292,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do sign_in(user) end - it 'user can edit runner' do + it 'user can edit runner', :sidekiq_might_not_need_inline do get_show_json expect(response).to have_gitlab_http_status(:ok) @@ -312,7 +312,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do sign_in(user) end - it 'user can not edit runner' do + it 'user can not edit runner', :sidekiq_might_not_need_inline do get_show_json expect(response).to have_gitlab_http_status(:ok) @@ -331,7 +331,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do sign_in(user) end - it 'user can not edit runner' do + it 'user can not edit runner', :sidekiq_might_not_need_inline do get_show_json expect(response).to have_gitlab_http_status(:ok) @@ -412,7 +412,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do context 'when job has trace' do let(:job) { create(:ci_build, :running, :trace_live, pipeline: pipeline) } - it "has_trace is true" do + it "has_trace is true", :sidekiq_might_not_need_inline do get_show_json expect(response).to match_response_schema('job/job_details') @@ -458,7 +458,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do create(:ci_pipeline_variable, pipeline: pipeline, key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1') end - context 'user is a maintainer' do + context 'user is a maintainer', :sidekiq_might_not_need_inline do before do project.add_maintainer(user) diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 74834e86467..9c9c12d22f1 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -431,7 +431,7 @@ describe Projects::MergeRequestsController do context 'when a squash commit message is passed' do let(:message) { 'My custom squash commit message' } - it 'passes the same message to SquashService' do + it 'passes the same message to SquashService', :sidekiq_might_not_need_inline do params = { squash: '1', squash_commit_message: message } expect_next_instance_of(MergeRequests::SquashService, project, user, params.merge(merge_request: merge_request)) do |squash_service| @@ -724,7 +724,7 @@ describe Projects::MergeRequestsController do context 'with private builds' do context 'for the target project member' do - it 'does not respond with serialized pipelines' do + it 'does not respond with serialized pipelines', :sidekiq_might_not_need_inline do expect(json_response['pipelines']).to be_empty expect(json_response['count']['all']).to eq(0) expect(response).to include_pagination_headers @@ -734,7 +734,7 @@ describe Projects::MergeRequestsController do context 'for the source project member' do let(:user) { fork_user } - it 'responds with serialized pipelines' do + it 'responds with serialized pipelines', :sidekiq_might_not_need_inline do expect(json_response['pipelines']).to be_present expect(json_response['count']['all']).to eq(1) expect(response).to include_pagination_headers @@ -750,7 +750,7 @@ describe Projects::MergeRequestsController do end context 'for the target project member' do - it 'does not respond with serialized pipelines' do + it 'does not respond with serialized pipelines', :sidekiq_might_not_need_inline do expect(json_response['pipelines']).to be_present expect(json_response['count']['all']).to eq(1) expect(response).to include_pagination_headers @@ -760,7 +760,7 @@ describe Projects::MergeRequestsController do context 'for the source project member' do let(:user) { fork_user } - it 'responds with serialized pipelines' do + it 'responds with serialized pipelines', :sidekiq_might_not_need_inline do expect(json_response['pipelines']).to be_present expect(json_response['count']['all']).to eq(1) expect(response).to include_pagination_headers @@ -1203,13 +1203,13 @@ describe Projects::MergeRequestsController do create(:merge_request, source_project: forked, target_project: project, target_branch: 'master', head_pipeline: pipeline) end - it 'links to the environment on that project' do + it 'links to the environment on that project', :sidekiq_might_not_need_inline do get_ci_environments_status expect(json_response.first['url']).to match /#{forked.full_path}/ end - context "when environment_target is 'merge_commit'" do + context "when environment_target is 'merge_commit'", :sidekiq_might_not_need_inline do it 'returns nothing' do get_ci_environments_status(environment_target: 'merge_commit') @@ -1240,13 +1240,13 @@ describe Projects::MergeRequestsController do # we're trying to reduce the overall number of queries for this method. # set a hard limit for now. https://gitlab.com/gitlab-org/gitlab-foss/issues/52287 - it 'keeps queries in check' do + it 'keeps queries in check', :sidekiq_might_not_need_inline do control_count = ActiveRecord::QueryRecorder.new { get_ci_environments_status }.count expect(control_count).to be <= 137 end - it 'has no N+1 SQL issues for environments', :request_store, retry: 0 do + it 'has no N+1 SQL issues for environments', :request_store, :sidekiq_might_not_need_inline, retry: 0 do # First run to insert test data from lets, which does take up some 30 queries get_ci_environments_status @@ -1464,7 +1464,7 @@ describe Projects::MergeRequestsController do sign_in(fork_owner) end - it 'returns 200' do + it 'returns 200', :sidekiq_might_not_need_inline do expect_rebase_worker_for(fork_owner) post_rebase diff --git a/spec/controllers/projects/mirrors_controller_spec.rb b/spec/controllers/projects/mirrors_controller_spec.rb index fb3dd75460a..e14686970a1 100644 --- a/spec/controllers/projects/mirrors_controller_spec.rb +++ b/spec/controllers/projects/mirrors_controller_spec.rb @@ -51,10 +51,6 @@ describe Projects::MirrorsController do sign_in(project.owner) end - around do |example| - Sidekiq::Testing.fake! { example.run } - end - context 'With valid URL for a push' do let(:remote_mirror_attributes) do { "0" => { "enabled" => "0", url: 'https://updated.example.com' } } diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb index 3ab191c0032..e9d285aa0b0 100644 --- a/spec/controllers/projects/notes_controller_spec.rb +++ b/spec/controllers/projects/notes_controller_spec.rb @@ -518,7 +518,7 @@ describe Projects::NotesController do project.id && Project.maximum(:id).succ end - it 'returns a 404' do + it 'returns a 404', :sidekiq_might_not_need_inline do create! expect(response).to have_gitlab_http_status(404) end @@ -527,13 +527,13 @@ describe Projects::NotesController do context 'when the user has no access to the fork' do let(:fork_visibility) { Gitlab::VisibilityLevel::PRIVATE } - it 'returns a 404' do + it 'returns a 404', :sidekiq_might_not_need_inline do create! expect(response).to have_gitlab_http_status(404) end end - context 'when the user has access to the fork' do + context 'when the user has access to the fork', :sidekiq_might_not_need_inline do let!(:discussion) { forked_project.notes.find_discussion(existing_comment.discussion_id) } let(:fork_visibility) { Gitlab::VisibilityLevel::PUBLIC } diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index e3ad36f8d24..9d3753ef2ab 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -93,7 +93,7 @@ describe Projects::PipelinesController do end context 'when performing gitaly calls', :request_store do - it 'limits the Gitaly requests' do + it 'limits the Gitaly requests', :sidekiq_might_not_need_inline do # Isolate from test preparation (Repository#exists? is also cached in RequestStore) RequestStore.end! RequestStore.clear! @@ -571,7 +571,7 @@ describe Projects::PipelinesController do format: :json end - it 'cancels a pipeline without returning any content' do + it 'cancels a pipeline without returning any content', :sidekiq_might_not_need_inline do expect(response).to have_gitlab_http_status(:no_content) expect(pipeline.reload).to be_canceled end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index ea7dd78329a..321f5ecdbc9 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -653,7 +653,7 @@ describe ProjectsController do describe "#destroy" do let(:admin) { create(:admin) } - it "redirects to the dashboard" do + it "redirects to the dashboard", :sidekiq_might_not_need_inline do controller.instance_variable_set(:@project, project) sign_in(admin) @@ -674,7 +674,7 @@ describe ProjectsController do target_project: project) end - it "closes all related merge requests" do + it "closes all related merge requests", :sidekiq_might_not_need_inline do project.merge_requests << merge_request sign_in(admin) diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 9477eeb18d4..2608f717f1c 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -234,10 +234,7 @@ FactoryBot.define do trait :broken_repo do after(:create) do |project| - raise "Failed to create repository!" unless project.create_repository - - project.gitlab_shell.rm_directory(project.repository_storage, - File.join("#{project.disk_path}.git", 'refs')) + TestEnv.rm_storage_dir(project.repository_storage, "#{project.disk_path}.git/refs") end end diff --git a/spec/features/calendar_spec.rb b/spec/features/calendar_spec.rb index 235b6d0fd40..bac5c9f568e 100644 --- a/spec/features/calendar_spec.rb +++ b/spec/features/calendar_spec.rb @@ -134,11 +134,9 @@ describe 'Contributions Calendar', :js do shared_examples 'a day with activity' do |contribution_count:| include_context 'visit user page' - it 'displays calendar activity square color for 1 contribution' do + it 'displays calendar activity square for 1 contribution', :sidekiq_might_not_need_inline do expect(find('#js-overview')).to have_selector(get_cell_color_selector(contribution_count), count: 1) - end - it 'displays calendar activity square on the correct date' do today = Date.today.strftime(date_format) expect(find('#js-overview')).to have_selector(get_cell_date_selector(contribution_count, today), count: 1) end @@ -154,7 +152,7 @@ describe 'Contributions Calendar', :js do describe 'issue title is shown on activity page' do include_context 'visit user page' - it 'displays calendar activity log' do + it 'displays calendar activity log', :sidekiq_might_not_need_inline do expect(find('#js-overview .overview-content-list .event-target-title')).to have_content issue_title end end @@ -186,11 +184,11 @@ describe 'Contributions Calendar', :js do end include_context 'visit user page' - it 'displays calendar activity squares for both days' do + it 'displays calendar activity squares for both days', :sidekiq_might_not_need_inline do expect(find('#js-overview')).to have_selector(get_cell_color_selector(1), count: 2) end - it 'displays calendar activity square for yesterday' do + it 'displays calendar activity square for yesterday', :sidekiq_might_not_need_inline do yesterday = Date.yesterday.strftime(date_format) expect(find('#js-overview')).to have_selector(get_cell_date_selector(1, yesterday), count: 1) end diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 96d8da845cb..94bcabd3ca4 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -102,7 +102,7 @@ describe 'Commits' do end describe 'Cancel all builds' do - it 'cancels commit', :js do + it 'cancels commit', :js, :sidekiq_might_not_need_inline do visit pipeline_path(pipeline) click_on 'Cancel running' expect(page).to have_content 'canceled' @@ -110,7 +110,7 @@ describe 'Commits' do end describe 'Cancel build' do - it 'cancels build', :js do + it 'cancels build', :js, :sidekiq_might_not_need_inline do visit pipeline_path(pipeline) find('.js-btn-cancel-pipeline').click expect(page).to have_content 'canceled' diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb index 03a2402a2d6..28b68e699e8 100644 --- a/spec/features/container_registry_spec.rb +++ b/spec/features/container_registry_spec.rb @@ -42,7 +42,7 @@ describe 'Container Registry', :js do expect(page).to have_content('my/image') end - it 'user removes entire container repository' do + it 'user removes entire container repository', :sidekiq_might_not_need_inline do visit_container_registry expect_any_instance_of(ContainerRepository).to receive(:delete_tags!).and_return(true) diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb index 07f0864fb3b..3f46772c4b0 100644 --- a/spec/features/cycle_analytics_spec.rb +++ b/spec/features/cycle_analytics_spec.rb @@ -56,7 +56,7 @@ describe 'Cycle Analytics', :js do expect(deploys_counter).to have_content('1') end - it 'shows data on each stage' do + it 'shows data on each stage', :sidekiq_might_not_need_inline do expect_issue_to_be_present click_stage('Plan') diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index ca994c95df8..4fd241dedd1 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -189,7 +189,7 @@ describe 'Group' do expect(page).to have_selector '#confirm_name_input:focus' end - it 'removes group' do + it 'removes group', :sidekiq_might_not_need_inline do expect { remove_with_confirm('Remove group', group.path) }.to change {Group.count}.by(-1) expect(group.members.all.count).to be_zero expect(page).to have_content "scheduled for deletion" diff --git a/spec/features/import/manifest_import_spec.rb b/spec/features/import/manifest_import_spec.rb index e9471257544..89bf69dea7d 100644 --- a/spec/features/import/manifest_import_spec.rb +++ b/spec/features/import/manifest_import_spec.rb @@ -24,7 +24,7 @@ describe 'Import multiple repositories by uploading a manifest file', :js do expect(page).to have_content('https://android-review.googlesource.com/platform/build/blueprint') end - it 'imports successfully imports a project' do + it 'imports successfully imports a project', :sidekiq_might_not_need_inline do visit new_import_manifest_path attach_file('manifest', Rails.root.join('spec/fixtures/aosp_manifest.xml')) diff --git a/spec/features/issuables/markdown_references/internal_references_spec.rb b/spec/features/issuables/markdown_references/internal_references_spec.rb index f3b534bca49..efd84cf67b0 100644 --- a/spec/features/issuables/markdown_references/internal_references_spec.rb +++ b/spec/features/issuables/markdown_references/internal_references_spec.rb @@ -64,7 +64,7 @@ describe "Internal references", :js do visit(project_issue_path(public_project, public_project_issue)) end - it "shows references" do + it "shows references", :sidekiq_might_not_need_inline do page.within("#merge-requests .merge-requests-title") do expect(page).to have_content("Related merge requests") expect(page).to have_css(".mr-count-badge") @@ -133,7 +133,7 @@ describe "Internal references", :js do visit(project_merge_request_path(public_project, public_project_merge_request)) end - it "shows references" do + it "shows references", :sidekiq_might_not_need_inline do expect(page).to have_content("mentioned in merge request #{private_project_merge_request.to_reference(public_project)}") .and have_content(private_project_user.name) end diff --git a/spec/features/issuables/markdown_references/jira_spec.rb b/spec/features/issuables/markdown_references/jira_spec.rb index 8085918f533..596a374ec6d 100644 --- a/spec/features/issuables/markdown_references/jira_spec.rb +++ b/spec/features/issuables/markdown_references/jira_spec.rb @@ -46,7 +46,7 @@ describe "Jira", :js do end end - it "creates a note on the referenced issues" do + it "creates a note on the referenced issues", :sidekiq_might_not_need_inline do click_button("Comment") wait_for_requests diff --git a/spec/features/issues/notes_on_issues_spec.rb b/spec/features/issues/notes_on_issues_spec.rb index 5247baa58a1..74eb699c7ef 100644 --- a/spec/features/issues/notes_on_issues_spec.rb +++ b/spec/features/issues/notes_on_issues_spec.rb @@ -23,7 +23,7 @@ describe 'Create notes on issues', :js do submit_comment(note_text) end - it 'creates a note with reference and cross references the issue' do + it 'creates a note with reference and cross references the issue', :sidekiq_might_not_need_inline do page.within('div#notes li.note div.note-text') do expect(page).to have_content(note_text) expect(page.find('a')).to have_content(mention.to_reference) diff --git a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb index be31c45b373..8322a6afa04 100644 --- a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb +++ b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb @@ -67,7 +67,7 @@ describe 'User creates branch and merge request on issue page', :js do end context 'when branch name is auto-generated' do - it 'creates a merge request' do + it 'creates a merge request', :sidekiq_might_not_need_inline do perform_enqueued_jobs do select_dropdown_option('create-mr') @@ -96,7 +96,7 @@ describe 'User creates branch and merge request on issue page', :js do context 'when branch name is custom' do let(:branch_name) { 'custom-branch-name' } - it 'creates a merge request' do + it 'creates a merge request', :sidekiq_might_not_need_inline do perform_enqueued_jobs do select_dropdown_option('create-mr', branch_name) diff --git a/spec/features/issues/user_creates_confidential_merge_request_spec.rb b/spec/features/issues/user_creates_confidential_merge_request_spec.rb index 24089bdeb81..838c0a6349c 100644 --- a/spec/features/issues/user_creates_confidential_merge_request_spec.rb +++ b/spec/features/issues/user_creates_confidential_merge_request_spec.rb @@ -42,7 +42,7 @@ describe 'User creates confidential merge request on issue page', :js do visit_confidential_issue end - it 'create merge request in fork' do + it 'create merge request in fork', :sidekiq_might_not_need_inline do click_button 'Create confidential merge request' page.within '.create-confidential-merge-request-dropdown-menu' do diff --git a/spec/features/markdown/metrics_spec.rb b/spec/features/markdown/metrics_spec.rb index 4de67cfcdbe..580826f4a29 100644 --- a/spec/features/markdown/metrics_spec.rb +++ b/spec/features/markdown/metrics_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching do +describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidekiq_might_not_need_inline do include PrometheusHelpers let(:user) { create(:user) } diff --git a/spec/features/merge_request/maintainer_edits_fork_spec.rb b/spec/features/merge_request/maintainer_edits_fork_spec.rb index 030638cba71..fa53682b024 100644 --- a/spec/features/merge_request/maintainer_edits_fork_spec.rb +++ b/spec/features/merge_request/maintainer_edits_fork_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'a maintainer edits files on a source-branch of an MR from a fork', :js do +describe 'a maintainer edits files on a source-branch of an MR from a fork', :js, :sidekiq_might_not_need_inline do include ProjectForksHelper let(:user) { create(:user, username: 'the-maintainer') } let(:target_project) { create(:project, :public, :repository) } diff --git a/spec/features/merge_request/user_accepts_merge_request_spec.rb b/spec/features/merge_request/user_accepts_merge_request_spec.rb index 4d305d43351..5e1ff232b80 100644 --- a/spec/features/merge_request/user_accepts_merge_request_spec.rb +++ b/spec/features/merge_request/user_accepts_merge_request_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'User accepts a merge request', :js do +describe 'User accepts a merge request', :js, :sidekiq_might_not_need_inline do let(:merge_request) { create(:merge_request, :with_diffs, :simple, source_project: project) } let(:project) { create(:project, :public, :repository) } let(:user) { create(:user) } diff --git a/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb b/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb index be403abcc4d..0ecd32565d0 100644 --- a/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb +++ b/spec/features/merge_request/user_allows_commits_from_memebers_who_can_merge_spec.rb @@ -23,7 +23,7 @@ describe 'create a merge request, allowing commits from members who can merge to sign_in(user) end - it 'allows setting possible' do + it 'allows setting possible', :sidekiq_might_not_need_inline do visit_new_merge_request check 'Allow commits from members who can merge to the target branch' @@ -35,7 +35,7 @@ describe 'create a merge request, allowing commits from members who can merge to expect(page).to have_content('Allows commits from members who can merge to the target branch') end - it 'shows a message when one of the projects is private' do + it 'shows a message when one of the projects is private', :sidekiq_might_not_need_inline do source_project.update!(visibility_level: Gitlab::VisibilityLevel::PRIVATE) visit_new_merge_request @@ -43,7 +43,7 @@ describe 'create a merge request, allowing commits from members who can merge to expect(page).to have_content('Not available for private projects') end - it 'shows a message when the source branch is protected' do + it 'shows a message when the source branch is protected', :sidekiq_might_not_need_inline do create(:protected_branch, project: source_project, name: 'fix') visit_new_merge_request diff --git a/spec/features/merge_request/user_creates_merge_request_spec.rb b/spec/features/merge_request/user_creates_merge_request_spec.rb index f92791cc810..afb792c2ab9 100644 --- a/spec/features/merge_request/user_creates_merge_request_spec.rb +++ b/spec/features/merge_request/user_creates_merge_request_spec.rb @@ -36,7 +36,7 @@ describe "User creates a merge request", :js do context "to a forked project" do let(:forked_project) { fork_project(project, user, namespace: user.namespace, repository: true) } - it "creates a merge request" do + it "creates a merge request", :sidekiq_might_not_need_inline do visit(project_new_merge_request_path(forked_project)) expect(page).to have_content("Source branch").and have_content("Target branch") diff --git a/spec/features/merge_request/user_merges_merge_request_spec.rb b/spec/features/merge_request/user_merges_merge_request_spec.rb index da15a4bda4b..32e40740a61 100644 --- a/spec/features/merge_request/user_merges_merge_request_spec.rb +++ b/spec/features/merge_request/user_merges_merge_request_spec.rb @@ -10,7 +10,7 @@ describe "User merges a merge request", :js do end shared_examples "fast forward merge a merge request" do - it "merges a merge request" do + it "merges a merge request", :sidekiq_might_not_need_inline do expect(page).to have_content("Fast-forward merge without a merge commit").and have_button("Merge") page.within(".mr-state-widget") do diff --git a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb index ffc12ffdbaf..e40276f74e4 100644 --- a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb @@ -142,7 +142,7 @@ describe 'Merge request > User merges when pipeline succeeds', :js do refresh end - it 'merges merge request' do + it 'merges merge request', :sidekiq_might_not_need_inline do expect(page).to have_content 'The changes were merged' expect(merge_request.reload).to be_merged end diff --git a/spec/features/merge_request/user_reverts_merge_request_spec.rb b/spec/features/merge_request/user_reverts_merge_request_spec.rb index 71270b13c14..906ff1d61b2 100644 --- a/spec/features/merge_request/user_reverts_merge_request_spec.rb +++ b/spec/features/merge_request/user_reverts_merge_request_spec.rb @@ -20,7 +20,7 @@ describe 'User reverts a merge request', :js do visit(merge_request_path(merge_request)) end - it 'reverts a merge request' do + it 'reverts a merge request', :sidekiq_might_not_need_inline do find("a[href='#modal-revert-commit']").click page.within('#modal-revert-commit') do @@ -33,7 +33,7 @@ describe 'User reverts a merge request', :js do wait_for_requests end - it 'does not revert a merge request that was previously reverted' do + it 'does not revert a merge request that was previously reverted', :sidekiq_might_not_need_inline do find("a[href='#modal-revert-commit']").click page.within('#modal-revert-commit') do @@ -51,7 +51,7 @@ describe 'User reverts a merge request', :js do expect(page).to have_content('Sorry, we cannot revert this merge request automatically.') end - it 'reverts a merge request in a new merge request' do + it 'reverts a merge request in a new merge request', :sidekiq_might_not_need_inline do find("a[href='#modal-revert-commit']").click page.within('#modal-revert-commit') do diff --git a/spec/features/merge_request/user_sees_diff_spec.rb b/spec/features/merge_request/user_sees_diff_spec.rb index 8eeed7b0843..d9783f3388c 100644 --- a/spec/features/merge_request/user_sees_diff_spec.rb +++ b/spec/features/merge_request/user_sees_diff_spec.rb @@ -62,7 +62,7 @@ describe 'Merge request > User sees diff', :js do end context 'as author' do - it 'shows direct edit link' do + it 'shows direct edit link', :sidekiq_might_not_need_inline do sign_in(author_user) visit diffs_project_merge_request_path(project, merge_request) @@ -72,7 +72,7 @@ describe 'Merge request > User sees diff', :js do end context 'as user who needs to fork' do - it 'shows fork/cancel confirmation' do + it 'shows fork/cancel confirmation', :sidekiq_might_not_need_inline do sign_in(user) visit diffs_project_merge_request_path(project, merge_request) diff --git a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb index dd5662d83f2..abf159949db 100644 --- a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb @@ -67,13 +67,13 @@ describe 'Merge request > User sees pipelines triggered by merge request', :js d end end - it 'sees the latest detached merge request pipeline as the head pipeline' do + it 'sees the latest detached merge request pipeline as the head pipeline', :sidekiq_might_not_need_inline do page.within('.ci-widget-content') do expect(page).to have_content("##{detached_merge_request_pipeline.id}") end end - context 'when a user updated a merge request in the parent project' do + context 'when a user updated a merge request in the parent project', :sidekiq_might_not_need_inline do let!(:push_pipeline_2) do Ci::CreatePipelineService.new(project, user, ref: 'feature') .execute(:push) @@ -133,7 +133,7 @@ describe 'Merge request > User sees pipelines triggered by merge request', :js d end end - context 'when a user merges a merge request in the parent project' do + context 'when a user merges a merge request in the parent project', :sidekiq_might_not_need_inline do before do click_button 'Merge when pipeline succeeds' @@ -196,7 +196,7 @@ describe 'Merge request > User sees pipelines triggered by merge request', :js d end end - it 'sees the latest branch pipeline as the head pipeline' do + it 'sees the latest branch pipeline as the head pipeline', :sidekiq_might_not_need_inline do page.within('.ci-widget-content') do expect(page).to have_content("##{push_pipeline.id}") end @@ -204,7 +204,7 @@ describe 'Merge request > User sees pipelines triggered by merge request', :js d end end - context 'when a user created a merge request from a forked project to the parent project' do + context 'when a user created a merge request from a forked project to the parent project', :sidekiq_might_not_need_inline do let(:merge_request) do create(:merge_request, source_project: forked_project, diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index 9fadd46ed44..7c2c7ae4386 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -76,7 +76,7 @@ describe 'Merge request > User sees merge widget', :js do expect(find('.accept-merge-request')['disabled']).not_to be(true) end - it 'allows me to merge, see cherry-pick modal and load branches list' do + it 'allows me to merge, see cherry-pick modal and load branches list', :sidekiq_might_not_need_inline do wait_for_requests click_button 'Merge' @@ -191,7 +191,7 @@ describe 'Merge request > User sees merge widget', :js do end shared_examples 'pipeline widget' do - it 'shows head pipeline information' do + it 'shows head pipeline information', :sidekiq_might_not_need_inline do within '.ci-widget-content' do expect(page).to have_content("Detached merge request pipeline ##{pipeline.id} pending for #{pipeline.short_sha}") end @@ -230,7 +230,7 @@ describe 'Merge request > User sees merge widget', :js do end shared_examples 'pipeline widget' do - it 'shows head pipeline information' do + it 'shows head pipeline information', :sidekiq_might_not_need_inline do within '.ci-widget-content' do expect(page).to have_content("Merged result pipeline ##{pipeline.id} pending for #{pipeline.short_sha}") end @@ -371,7 +371,7 @@ describe 'Merge request > User sees merge widget', :js do visit project_merge_request_path(project, merge_request) end - it 'updates the MR widget' do + it 'updates the MR widget', :sidekiq_might_not_need_inline do click_button 'Merge' page.within('.mr-widget-body') do @@ -417,7 +417,7 @@ describe 'Merge request > User sees merge widget', :js do visit project_merge_request_path(project, merge_request) end - it 'user cannot remove source branch' do + it 'user cannot remove source branch', :sidekiq_might_not_need_inline do expect(page).not_to have_field('remove-source-branch-input') expect(page).to have_content('Deletes source branch') end diff --git a/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb b/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb index 0391794649c..9c9e0dacb87 100644 --- a/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb +++ b/spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb @@ -21,7 +21,7 @@ describe 'Merge request > User sees notes from forked project', :js do sign_in(user) end - it 'user can reply to the comment' do + it 'user can reply to the comment', :sidekiq_might_not_need_inline do visit project_merge_request_path(project, merge_request) expect(page).to have_content('A commit comment') diff --git a/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb b/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb index 3e15a9c136b..d258b98f4a9 100644 --- a/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb @@ -28,7 +28,7 @@ describe 'Merge request > User sees pipelines from forked project', :js do visit project_merge_request_path(target_project, merge_request) end - it 'user visits a pipelines page' do + it 'user visits a pipelines page', :sidekiq_might_not_need_inline do page.within('.merge-request-tabs') { click_link 'Pipelines' } page.within('.ci-table') do diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb index 7a8b938486a..f3d8f2b42f8 100644 --- a/spec/features/merge_request/user_sees_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_spec.rb @@ -124,7 +124,7 @@ describe 'Merge request > User sees pipelines', :js do threads.each { |thr| thr.join } end - it 'user sees pipeline in merge request widget' do + it 'user sees pipeline in merge request widget', :sidekiq_might_not_need_inline do visit project_merge_request_path(project, @merge_request) expect(page.find(".ci-widget")).to have_content(TestEnv::BRANCH_SHA['feature']) diff --git a/spec/features/merge_requests/user_squashes_merge_request_spec.rb b/spec/features/merge_requests/user_squashes_merge_request_spec.rb index 4fc8c71e47e..a018c86fa9a 100644 --- a/spec/features/merge_requests/user_squashes_merge_request_spec.rb +++ b/spec/features/merge_requests/user_squashes_merge_request_spec.rb @@ -10,7 +10,7 @@ describe 'User squashes a merge request', :js do let!(:original_head) { project.repository.commit('master') } shared_examples 'squash' do - it 'squashes the commits into a single commit, and adds a merge commit' do + it 'squashes the commits into a single commit, and adds a merge commit', :sidekiq_might_not_need_inline do expect(page).to have_content('Merged') latest_master_commits = project.repository.commits_between(original_head.sha, 'master').map(&:raw) @@ -31,7 +31,7 @@ describe 'User squashes a merge request', :js do end shared_examples 'no squash' do - it 'accepts the merge request without squashing' do + it 'accepts the merge request without squashing', :sidekiq_might_not_need_inline do expect(page).to have_content('Merged') expect(project.repository).to be_merged_to_root_ref(source_branch) end diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index e80a3cd32cc..0147963c0a3 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -22,7 +22,7 @@ describe 'Profile account page', :js do expect(User.exists?(user.id)).to be_truthy end - it 'deletes user', :js do + it 'deletes user', :js, :sidekiq_might_not_need_inline do click_button 'Delete account' fill_in 'password', with: '12345678' diff --git a/spec/features/projects/badges/pipeline_badge_spec.rb b/spec/features/projects/badges/pipeline_badge_spec.rb index f2c57d702a5..af936c80886 100644 --- a/spec/features/projects/badges/pipeline_badge_spec.rb +++ b/spec/features/projects/badges/pipeline_badge_spec.rb @@ -22,7 +22,7 @@ describe 'Pipeline Badge' do let!(:job) { create(:ci_build, pipeline: pipeline) } context 'when the pipeline was successful' do - it 'displays so on the badge' do + it 'displays so on the badge', :sidekiq_might_not_need_inline do job.success visit pipeline_project_badges_path(project, ref: ref, format: :svg) @@ -33,7 +33,7 @@ describe 'Pipeline Badge' do end context 'when the pipeline failed' do - it 'shows displays so on the badge' do + it 'shows displays so on the badge', :sidekiq_might_not_need_inline do job.drop visit pipeline_project_badges_path(project, ref: ref, format: :svg) @@ -52,7 +52,7 @@ describe 'Pipeline Badge' do allow(job).to receive(:prerequisites).and_return([double]) end - it 'displays the preparing badge' do + it 'displays the preparing badge', :sidekiq_might_not_need_inline do job.enqueue visit pipeline_project_badges_path(project, ref: ref, format: :svg) @@ -63,7 +63,7 @@ describe 'Pipeline Badge' do end context 'when the pipeline is running' do - it 'shows displays so on the badge' do + it 'shows displays so on the badge', :sidekiq_might_not_need_inline do create(:ci_build, pipeline: pipeline, name: 'second build', status_event: 'run') visit pipeline_project_badges_path(project, ref: ref, format: :svg) diff --git a/spec/features/projects/files/user_creates_directory_spec.rb b/spec/features/projects/files/user_creates_directory_spec.rb index 19d95c87c6c..f828ee63cd7 100644 --- a/spec/features/projects/files/user_creates_directory_spec.rb +++ b/spec/features/projects/files/user_creates_directory_spec.rb @@ -71,7 +71,7 @@ describe 'Projects > Files > User creates a directory', :js do visit(project2_tree_path_root_ref) end - it 'creates a directory in a forked project' do + it 'creates a directory in a forked project', :sidekiq_might_not_need_inline do find('.add-to-tree').click click_link('New directory') diff --git a/spec/features/projects/files/user_creates_files_spec.rb b/spec/features/projects/files/user_creates_files_spec.rb index 74c037641cd..23663aeaef0 100644 --- a/spec/features/projects/files/user_creates_files_spec.rb +++ b/spec/features/projects/files/user_creates_files_spec.rb @@ -42,7 +42,7 @@ describe 'Projects > Files > User creates files' do visit(project2_tree_path_root_ref) end - it 'opens new file page on a forked project' do + it 'opens new file page on a forked project', :sidekiq_might_not_need_inline do find('.add-to-tree').click click_link('New file') @@ -159,7 +159,7 @@ describe 'Projects > Files > User creates files' do end end - context 'when an user does not have write access' do + context 'when an user does not have write access', :sidekiq_might_not_need_inline do before do project2.add_reporter(user) visit(project2_tree_path_root_ref) diff --git a/spec/features/projects/files/user_deletes_files_spec.rb b/spec/features/projects/files/user_deletes_files_spec.rb index fd4783cfb6b..570813ce085 100644 --- a/spec/features/projects/files/user_deletes_files_spec.rb +++ b/spec/features/projects/files/user_deletes_files_spec.rb @@ -47,7 +47,7 @@ describe 'Projects > Files > User deletes files', :js do wait_for_requests end - it 'deletes the file in a forked project', :js do + it 'deletes the file in a forked project', :js, :sidekiq_might_not_need_inline do click_link('.gitignore') expect(page).to have_content('.gitignore') diff --git a/spec/features/projects/files/user_edits_files_spec.rb b/spec/features/projects/files/user_edits_files_spec.rb index 56430721ed6..c0312f5bb62 100644 --- a/spec/features/projects/files/user_edits_files_spec.rb +++ b/spec/features/projects/files/user_edits_files_spec.rb @@ -136,7 +136,7 @@ describe 'Projects > Files > User edits files', :js do ) end - it 'inserts a content of a file in a forked project' do + it 'inserts a content of a file in a forked project', :sidekiq_might_not_need_inline do click_link('.gitignore') click_button('Edit') @@ -154,7 +154,7 @@ describe 'Projects > Files > User edits files', :js do expect(evaluate_script('ace.edit("editor").getValue()')).to eq('*.rbca') end - it 'opens the Web IDE in a forked project' do + it 'opens the Web IDE in a forked project', :sidekiq_might_not_need_inline do click_link('.gitignore') click_button('Web IDE') @@ -168,7 +168,7 @@ describe 'Projects > Files > User edits files', :js do expect(page).to have_css('.ide .multi-file-tab', text: '.gitignore') end - it 'commits an edited file in a forked project' do + it 'commits an edited file in a forked project', :sidekiq_might_not_need_inline do click_link('.gitignore') find('.js-edit-blob').click @@ -199,7 +199,7 @@ describe 'Projects > Files > User edits files', :js do wait_for_requests end - it 'links to the forked project for editing' do + it 'links to the forked project for editing', :sidekiq_might_not_need_inline do click_link('.gitignore') find('.js-edit-blob').click diff --git a/spec/features/projects/files/user_replaces_files_spec.rb b/spec/features/projects/files/user_replaces_files_spec.rb index d50bc0a7d18..bdef40690a2 100644 --- a/spec/features/projects/files/user_replaces_files_spec.rb +++ b/spec/features/projects/files/user_replaces_files_spec.rb @@ -55,7 +55,7 @@ describe 'Projects > Files > User replaces files', :js do wait_for_requests end - it 'replaces an existed file with a new one in a forked project' do + it 'replaces an existed file with a new one in a forked project', :sidekiq_might_not_need_inline do click_link('.gitignore') expect(page).to have_content('.gitignore') diff --git a/spec/features/projects/files/user_uploads_files_spec.rb b/spec/features/projects/files/user_uploads_files_spec.rb index 74b5d7c5041..284f891731c 100644 --- a/spec/features/projects/files/user_uploads_files_spec.rb +++ b/spec/features/projects/files/user_uploads_files_spec.rb @@ -76,7 +76,7 @@ describe 'Projects > Files > User uploads files' do visit(project2_tree_path_root_ref) end - it 'uploads and commit a new file to a forked project', :js do + it 'uploads and commit a new file to a forked project', :js, :sidekiq_might_not_need_inline do find('.add-to-tree').click click_link('Upload file') diff --git a/spec/features/projects/fork_spec.rb b/spec/features/projects/fork_spec.rb index 6792a6e2af0..0f97032eefa 100644 --- a/spec/features/projects/fork_spec.rb +++ b/spec/features/projects/fork_spec.rb @@ -27,7 +27,7 @@ describe 'Project fork' do expect(page).to have_css('a.disabled', text: 'Fork') end - it 'forks the project' do + it 'forks the project', :sidekiq_might_not_need_inline do visit project_path(project) click_link 'Fork' @@ -174,7 +174,7 @@ describe 'Project fork' do expect(page).to have_css('.fork-thumbnail.disabled') end - it 'links to the fork if the project was already forked within that namespace' do + it 'links to the fork if the project was already forked within that namespace', :sidekiq_might_not_need_inline do forked_project = fork_project(project, user, namespace: group, repository: true) visit new_project_fork_path(project) diff --git a/spec/features/projects/forks/fork_list_spec.rb b/spec/features/projects/forks/fork_list_spec.rb index 2dbe3d90bad..3b63d9a4c2d 100644 --- a/spec/features/projects/forks/fork_list_spec.rb +++ b/spec/features/projects/forks/fork_list_spec.rb @@ -15,7 +15,7 @@ describe 'listing forks of a project' do sign_in(user) end - it 'shows the forked project in the list with commit as description' do + it 'shows the forked project in the list with commit as description', :sidekiq_might_not_need_inline do visit project_forks_path(source) page.within('li.project-row') do diff --git a/spec/features/projects/import_export/export_file_spec.rb b/spec/features/projects/import_export/export_file_spec.rb index 7618a2bdea3..b3ed550f45e 100644 --- a/spec/features/projects/import_export/export_file_spec.rb +++ b/spec/features/projects/import_export/export_file_spec.rb @@ -38,7 +38,7 @@ describe 'Import/Export - project export integration test', :js do sign_in(user) end - it 'exports a project successfully' do + it 'exports a project successfully', :sidekiq_might_not_need_inline do visit edit_project_path(project) expect(page).to have_content('Export project') diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 6f96da60a31..904c5390415 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -27,7 +27,7 @@ describe 'Import/Export - project import integration test', :js do let(:project_path) { 'test-project-name' + randomHex } context 'prefilled the path' do - it 'user imports an exported project successfully' do + it 'user imports an exported project successfully', :sidekiq_might_not_need_inline do visit new_project_path fill_in :project_name, with: project_name, visible: true @@ -53,7 +53,7 @@ describe 'Import/Export - project import integration test', :js do end context 'path is not prefilled' do - it 'user imports an exported project successfully' do + it 'user imports an exported project successfully', :sidekiq_might_not_need_inline do visit new_project_path click_import_project_tab click_link 'GitLab export' diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index f5d5bc7f5b9..c9568dbb7ce 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -166,7 +166,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do let(:source_project) { fork_project(project, user, repository: true) } let(:target_project) { project } - it 'shows merge request iid and source branch' do + it 'shows merge request iid and source branch', :sidekiq_might_not_need_inline do visit project_job_path(source_project, job) within '.js-pipeline-info' do @@ -214,7 +214,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do let(:source_project) { fork_project(project, user, repository: true) } let(:target_project) { project } - it 'shows merge request iid and source branch' do + it 'shows merge request iid and source branch', :sidekiq_might_not_need_inline do visit project_job_path(source_project, job) within '.js-pipeline-info' do diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 66807eb1c17..94fac9a2eb5 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -128,7 +128,7 @@ describe 'Pipeline', :js do end end - it 'cancels the running build and shows retry button' do + it 'cancels the running build and shows retry button', :sidekiq_might_not_need_inline do find('#ci-badge-deploy .ci-action-icon-container').click page.within('#ci-badge-deploy') do @@ -146,7 +146,7 @@ describe 'Pipeline', :js do end end - it 'cancels the preparing build and shows retry button' do + it 'cancels the preparing build and shows retry button', :sidekiq_might_not_need_inline do find('#ci-badge-deploy .ci-action-icon-container').click page.within('#ci-badge-deploy') do @@ -186,7 +186,7 @@ describe 'Pipeline', :js do end end - it 'unschedules the delayed job and shows play button as a manual job' do + it 'unschedules the delayed job and shows play button as a manual job', :sidekiq_might_not_need_inline do find('#ci-badge-delayed-job .ci-action-icon-container').click page.within('#ci-badge-delayed-job') do @@ -305,7 +305,9 @@ describe 'Pipeline', :js do find('.js-retry-button').click end - it { expect(page).not_to have_content('Retry') } + it 'does not show a "Retry" button', :sidekiq_might_not_need_inline do + expect(page).not_to have_content('Retry') + end end end @@ -321,7 +323,9 @@ describe 'Pipeline', :js do click_on 'Cancel running' end - it { expect(page).not_to have_content('Cancel running') } + it 'does not show a "Cancel running" button', :sidekiq_might_not_need_inline do + expect(page).not_to have_content('Cancel running') + end end end @@ -400,7 +404,7 @@ describe 'Pipeline', :js do visit project_pipeline_path(source_project, pipeline) end - it 'shows the pipeline information' do + it 'shows the pipeline information', :sidekiq_might_not_need_inline do within '.pipeline-info' do expect(page).to have_content("#{pipeline.statuses.count} jobs " \ "for !#{merge_request.iid} " \ @@ -473,7 +477,7 @@ describe 'Pipeline', :js do visit project_pipeline_path(source_project, pipeline) end - it 'shows the pipeline information' do + it 'shows the pipeline information', :sidekiq_might_not_need_inline do within '.pipeline-info' do expect(page).to have_content("#{pipeline.statuses.count} jobs " \ "for !#{merge_request.iid} " \ @@ -651,7 +655,9 @@ describe 'Pipeline', :js do find('.js-retry-button').click end - it { expect(page).not_to have_content('Retry') } + it 'does not show a "Retry" button', :sidekiq_might_not_need_inline do + expect(page).not_to have_content('Retry') + end end end @@ -663,7 +669,9 @@ describe 'Pipeline', :js do click_on 'Cancel running' end - it { expect(page).not_to have_content('Cancel running') } + it 'does not show a "Cancel running" button', :sidekiq_might_not_need_inline do + expect(page).not_to have_content('Cancel running') + end end end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 4fb72eb8737..a9a127da56f 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -133,14 +133,14 @@ describe 'Pipelines', :js do wait_for_requests end - it 'indicated that pipelines was canceled' do + it 'indicated that pipelines was canceled', :sidekiq_might_not_need_inline do expect(page).not_to have_selector('.js-pipelines-cancel-button') expect(page).to have_selector('.ci-canceled') end end end - context 'when pipeline is retryable' do + context 'when pipeline is retryable', :sidekiq_might_not_need_inline do let!(:build) do create(:ci_build, pipeline: pipeline, stage: 'test') @@ -185,33 +185,29 @@ describe 'Pipelines', :js do visit project_pipelines_path(source_project) end - shared_examples_for 'showing detached merge request pipeline information' do - it 'shows detached tag for the pipeline' do + shared_examples_for 'detached merge request pipeline' do + it 'shows pipeline information without pipeline ref', :sidekiq_might_not_need_inline do within '.pipeline-tags' do expect(page).to have_content('detached') end - end - it 'shows the link of the merge request' do within '.branch-commit' do expect(page).to have_link(merge_request.iid, href: project_merge_request_path(project, merge_request)) end - end - it 'does not show the ref of the pipeline' do within '.branch-commit' do expect(page).not_to have_link(pipeline.ref) end end end - it_behaves_like 'showing detached merge request pipeline information' + it_behaves_like 'detached merge request pipeline' context 'when source project is a forked project' do let(:source_project) { fork_project(project, user, repository: true) } - it_behaves_like 'showing detached merge request pipeline information' + it_behaves_like 'detached merge request pipeline' end end @@ -233,20 +229,16 @@ describe 'Pipelines', :js do end shared_examples_for 'Correct merge request pipeline information' do - it 'does not show detached tag for the pipeline' do + it 'does not show detached tag for the pipeline, and shows the link of the merge request, and does not show the ref of the pipeline', :sidekiq_might_not_need_inline do within '.pipeline-tags' do expect(page).not_to have_content('detached') end - end - it 'shows the link of the merge request' do within '.branch-commit' do expect(page).to have_link(merge_request.iid, href: project_merge_request_path(project, merge_request)) end - end - it 'does not show the ref of the pipeline' do within '.branch-commit' do expect(page).not_to have_link(pipeline.ref) end @@ -429,7 +421,7 @@ describe 'Pipelines', :js do find('.js-modal-primary-action').click end - it 'indicates that pipeline was canceled' do + it 'indicates that pipeline was canceled', :sidekiq_might_not_need_inline do expect(page).not_to have_selector('.js-pipelines-cancel-button') expect(page).to have_selector('.ci-canceled') end @@ -452,7 +444,7 @@ describe 'Pipelines', :js do expect(page).not_to have_selector('.js-pipelines-retry-button') end - it 'has failed pipeline' do + it 'has failed pipeline', :sidekiq_might_not_need_inline do expect(page).to have_selector('.ci-failed') end end diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 67ae26d8d1e..df71a4f3f70 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -190,7 +190,7 @@ describe 'Project' do sign_in user end - it 'shows a link to the source project when it is available' do + it 'shows a link to the source project when it is available', :sidekiq_might_not_need_inline do visit project_path(forked_project) expect(page).to have_content('Forked from') @@ -206,7 +206,7 @@ describe 'Project' do expect(page).not_to have_content('Forked from') end - it 'shows the name of the deleted project when the source was deleted' do + it 'shows the name of the deleted project when the source was deleted', :sidekiq_might_not_need_inline do forked_project Projects::DestroyService.new(base_project, base_project.owner).execute @@ -218,7 +218,7 @@ describe 'Project' do context 'a fork of a fork' do let(:fork_of_fork) { fork_project(forked_project, user, repository: true) } - it 'links to the base project if the source project is removed' do + it 'links to the base project if the source project is removed', :sidekiq_might_not_need_inline do fork_of_fork Projects::DestroyService.new(forked_project, user).execute @@ -263,7 +263,7 @@ describe 'Project' do expect(page).to have_selector '#confirm_name_input:focus' end - it 'removes a project' do + it 'removes a project', :sidekiq_might_not_need_inline do expect { remove_with_confirm('Remove project', project.path) }.to change { Project.count }.by(-1) expect(page).to have_content "Project '#{project.full_name}' is in the process of being deleted." expect(Project.all.count).to be_zero diff --git a/spec/features/signed_commits_spec.rb b/spec/features/signed_commits_spec.rb index 2615e8400a4..9e2634657a0 100644 --- a/spec/features/signed_commits_spec.rb +++ b/spec/features/signed_commits_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' describe 'GPG signed commits' do let(:project) { create(:project, :public, :repository) } - it 'changes from unverified to verified when the user changes his email to match the gpg key' do + it 'changes from unverified to verified when the user changes his email to match the gpg key', :sidekiq_might_not_need_inline do ref = GpgHelpers::SIGNED_AND_AUTHORED_SHA user = create(:user, email: 'unrelated.user@example.org') @@ -30,7 +30,7 @@ describe 'GPG signed commits' do expect(page).to have_button 'Verified' end - it 'changes from unverified to verified when the user adds the missing gpg key' do + it 'changes from unverified to verified when the user adds the missing gpg key', :sidekiq_might_not_need_inline do ref = GpgHelpers::SIGNED_AND_AUTHORED_SHA user = create(:user, email: GpgHelpers::User1.emails.first) diff --git a/spec/features/unsubscribe_links_spec.rb b/spec/features/unsubscribe_links_spec.rb index 2f8b715289c..cf30776786b 100644 --- a/spec/features/unsubscribe_links_spec.rb +++ b/spec/features/unsubscribe_links_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Unsubscribe links' do +describe 'Unsubscribe links', :sidekiq_might_not_need_inline do include Warden::Test::Helpers let(:recipient) { create(:user) } diff --git a/spec/features/user_sees_revert_modal_spec.rb b/spec/features/user_sees_revert_modal_spec.rb index 24b4f8dd4aa..c0cffe885de 100644 --- a/spec/features/user_sees_revert_modal_spec.rb +++ b/spec/features/user_sees_revert_modal_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Merge request > User sees revert modal', :js do +describe 'Merge request > User sees revert modal', :js, :sidekiq_might_not_need_inline do let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } let(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index c27ce263bf0..6c10a617279 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -163,6 +163,20 @@ describe IssuesFinder do end end + context 'filtering by nonexistent author ID and issue term using CTE for search' do + let(:params) do + { + author_id: 'does-not-exist', + search: 'git', + attempt_group_search_optimizations: true + } + end + + it 'returns no results' do + expect(issues).to be_empty + end + end + context 'filtering by milestone' do let(:params) { { milestone_title: milestone.title } } diff --git a/spec/finders/merge_requests_finder_spec.rb b/spec/finders/merge_requests_finder_spec.rb index a396284f1e9..bc85a622119 100644 --- a/spec/finders/merge_requests_finder_spec.rb +++ b/spec/finders/merge_requests_finder_spec.rb @@ -23,6 +23,18 @@ describe MergeRequestsFinder do expect(merge_requests).to contain_exactly(merge_request1) end + it 'filters by nonexistent author ID and MR term using CTE for search' do + params = { + author_id: 'does-not-exist', + search: 'git', + attempt_group_search_optimizations: true + } + + merge_requests = described_class.new(user, params).execute + + expect(merge_requests).to be_empty + end + it 'filters by projects' do params = { projects: [project2.id, project3.id] } diff --git a/spec/frontend/fixtures/static/environments_logs.html b/spec/frontend/fixtures/static/environments_logs.html index ccf9c364154..4e242b77d1f 100644 --- a/spec/frontend/fixtures/static/environments_logs.html +++ b/spec/frontend/fixtures/static/environments_logs.html @@ -2,8 +2,7 @@ class="js-kubernetes-logs" data-current-environment-name="production" data-environments-path="/root/my-project/environments.json" - data-logs-page="/root/my-project/environments/1/logs" - data-logs-path="/root/my-project/environments/1/logs.json" + data-logs-endpoint="/root/my-project/environments/1/logs.json" > <div class="build-page-pod-logs"> <div class="build-trace-container prepend-top-default"> diff --git a/spec/frontend/tracking_spec.js b/spec/frontend/tracking_spec.js index 964f8b8787e..d9cc7104139 100644 --- a/spec/frontend/tracking_spec.js +++ b/spec/frontend/tracking_spec.js @@ -11,6 +11,7 @@ describe('Tracking', () => { namespace: '_namespace_', hostname: 'app.gitfoo.com', cookieDomain: '.gitfoo.com', + userId: null, }; snowplowSpy = jest.spyOn(window, 'snowplow'); }); @@ -34,6 +35,7 @@ describe('Tracking', () => { contexts: { webPage: true }, formTracking: false, linkClickTracking: false, + userId: null, }); }); @@ -41,15 +43,18 @@ describe('Tracking', () => { initUserTracking(); expect(snowplowSpy).toHaveBeenCalledWith('enableActivityTracking', 30, 30); expect(snowplowSpy).toHaveBeenCalledWith('trackPageView'); + expect(snowplowSpy).not.toHaveBeenCalledWith('setUserId'); expect(snowplowSpy).not.toHaveBeenCalledWith('enableFormTracking'); expect(snowplowSpy).not.toHaveBeenCalledWith('enableLinkClickTracking'); window.snowplowOptions = Object.assign({}, window.snowplowOptions, { formTracking: true, linkClickTracking: true, + userId: '1', }); initUserTracking(); + expect(snowplowSpy).toHaveBeenCalledWith('setUserId', '1'); expect(snowplowSpy).toHaveBeenCalledWith('enableFormTracking'); expect(snowplowSpy).toHaveBeenCalledWith('enableLinkClickTracking'); }); diff --git a/spec/lib/backup/repository_spec.rb b/spec/lib/backup/repository_spec.rb index bf827fb3914..5f120f258cd 100644 --- a/spec/lib/backup/repository_spec.rb +++ b/spec/lib/backup/repository_spec.rb @@ -70,7 +70,7 @@ describe Backup::Repository do end context 'restoring object pools' do - it 'schedules restoring of the pool' do + it 'schedules restoring of the pool', :sidekiq_might_not_need_inline do pool_repository = create(:pool_repository, :failed) pool_repository.delete_object_pool 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 f877e8cc1b8..399db4ac259 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 @@ -33,7 +33,7 @@ describe ScheduleCalculateWikiSizes, :migration, :sidekiq do end end - it 'calculates missing wiki sizes' do + it 'calculates missing wiki sizes', :sidekiq_might_not_need_inline do expect(project_statistics.find_by(id: 2).wiki_size).to be_nil expect(project_statistics.find_by(id: 3).wiki_size).to be_nil diff --git a/spec/lib/gitlab/badge/pipeline/status_spec.rb b/spec/lib/gitlab/badge/pipeline/status_spec.rb index 684c6829879..ab8d1f0ec5b 100644 --- a/spec/lib/gitlab/badge/pipeline/status_spec.rb +++ b/spec/lib/gitlab/badge/pipeline/status_spec.rb @@ -26,7 +26,7 @@ describe Gitlab::Badge::Pipeline::Status do end end - context 'pipeline exists' do + context 'pipeline exists', :sidekiq_might_not_need_inline do let!(:pipeline) { create_pipeline(project, sha, branch) } context 'pipeline success' do diff --git a/spec/lib/gitlab/bare_repository_import/importer_spec.rb b/spec/lib/gitlab/bare_repository_import/importer_spec.rb index 2fb9f1a0a08..ddb1d3cea21 100644 --- a/spec/lib/gitlab/bare_repository_import/importer_spec.rb +++ b/spec/lib/gitlab/bare_repository_import/importer_spec.rb @@ -90,7 +90,7 @@ describe Gitlab::BareRepositoryImport::Importer, :seed_helper do hook_path = File.join(repo_path, 'hooks') expect(gitlab_shell.repository_exists?(project.repository_storage, repo_path)).to be(true) - expect(gitlab_shell.exists?(project.repository_storage, hook_path)).to be(true) + expect(TestEnv.storage_dir_exists?(project.repository_storage, hook_path)).to be(true) end context 'hashed storage enabled' do diff --git a/spec/lib/gitlab/checks/lfs_integrity_spec.rb b/spec/lib/gitlab/checks/lfs_integrity_spec.rb index 88e8f5d74d1..505f117034e 100644 --- a/spec/lib/gitlab/checks/lfs_integrity_spec.rb +++ b/spec/lib/gitlab/checks/lfs_integrity_spec.rb @@ -58,7 +58,7 @@ describe Gitlab::Checks::LfsIntegrity do end end - context 'for forked project' do + context 'for forked project', :sidekiq_might_not_need_inline do let(:parent_project) { create(:project, :repository) } let(:project) { fork_project(parent_project, nil, repository: true) } diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb index a163de07967..9eee7e89062 100644 --- a/spec/lib/gitlab/cycle_analytics/events_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb @@ -129,7 +129,7 @@ describe 'cycle analytics events' do end end - describe '#test_events' do + describe '#test_events', :sidekiq_might_not_need_inline do let(:stage) { :test } let(:merge_request) { MergeRequest.first } @@ -234,7 +234,7 @@ describe 'cycle analytics events' do end end - describe '#staging_events' do + describe '#staging_events', :sidekiq_might_not_need_inline do let(:stage) { :staging } let(:merge_request) { MergeRequest.first } @@ -306,7 +306,7 @@ describe 'cycle analytics events' do end end - describe '#production_events' do + describe '#production_events', :sidekiq_might_not_need_inline do let(:stage) { :production } let!(:context) { create(:issue, project: project, created_at: 2.days.ago) } diff --git a/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb b/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb index e568ea633db..d4ab9bc225b 100644 --- a/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/usage_data_spec.rb @@ -71,7 +71,7 @@ describe Gitlab::CycleAnalytics::UsageData do } end - it 'returns the aggregated usage data of every selected project' do + it 'returns the aggregated usage data of every selected project', :sidekiq_might_not_need_inline do result = subject.to_json expect(result).to have_key(:avg_cycle_analytics) diff --git a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb index 1dfca0b056c..da307754243 100644 --- a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb +++ b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb @@ -43,7 +43,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do verification_status: 'verified' end - it 'assigns the gpg key to the signature when the missing gpg key is added' do + it 'assigns the gpg key to the signature when the missing gpg key is added', :sidekiq_might_not_need_inline do # InvalidGpgSignatureUpdater is called by the after_create hook gpg_key = create :gpg_key, key: GpgHelpers::User1.public_key, @@ -86,7 +86,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do verification_status: 'unknown_key' end - it 'updates the signature to being valid when the missing gpg key is added' do + it 'updates the signature to being valid when the missing gpg key is added', :sidekiq_might_not_need_inline do # InvalidGpgSignatureUpdater is called by the after_create hook gpg_key = create :gpg_key, key: GpgHelpers::User1.public_key, @@ -133,7 +133,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do verification_status: 'unknown_key' end - it 'updates the signature to being valid when the user updates the email address' do + it 'updates the signature to being valid when the user updates the email address', :sidekiq_might_not_need_inline do gpg_key = create :gpg_key, key: GpgHelpers::User1.public_key, user: user @@ -152,7 +152,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do ) end - it 'keeps the signature at being invalid when the changed email address is still unrelated' do + it 'keeps the signature at being invalid when the changed email address is still unrelated', :sidekiq_might_not_need_inline do gpg_key = create :gpg_key, key: GpgHelpers::User1.public_key, user: user @@ -192,7 +192,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do verification_status: 'unknown_key' end - it 'updates the signature to being valid when the missing gpg key is added' do + it 'updates the signature to being valid when the missing gpg key is added', :sidekiq_might_not_need_inline do # InvalidGpgSignatureUpdater is called by the after_create hook gpg_key = create(:gpg_key, key: GpgHelpers::User3.public_key, user: user) subkey = gpg_key.subkeys.last diff --git a/spec/lib/gitlab/hashed_storage/migrator_spec.rb b/spec/lib/gitlab/hashed_storage/migrator_spec.rb index 8e253b51597..ce7f2c4530d 100644 --- a/spec/lib/gitlab/hashed_storage/migrator_spec.rb +++ b/spec/lib/gitlab/hashed_storage/migrator_spec.rb @@ -42,7 +42,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do subject.bulk_migrate(start: ids.min, finish: ids.max) end - it 'has all projects migrated and set as writable' do + it 'has all projects migrated and set as writable', :sidekiq_might_not_need_inline do perform_enqueued_jobs do subject.bulk_migrate(start: ids.min, finish: ids.max) end @@ -79,7 +79,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do subject.bulk_rollback(start: ids.min, finish: ids.max) end - it 'has all projects rolledback and set as writable' do + it 'has all projects rolledback and set as writable', :sidekiq_might_not_need_inline do perform_enqueued_jobs do subject.bulk_rollback(start: ids.min, finish: ids.max) end @@ -108,7 +108,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do expect { subject.migrate(project) }.not_to raise_error end - it 'migrates project storage' do + it 'migrates project storage', :sidekiq_might_not_need_inline do perform_enqueued_jobs do subject.migrate(project) end @@ -154,7 +154,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do expect { subject.rollback(project) }.not_to raise_error end - it 'rolls-back project storage' do + it 'rolls-back project storage', :sidekiq_might_not_need_inline do perform_enqueued_jobs do subject.rollback(project) end diff --git a/spec/lib/gitlab/import_export/fork_spec.rb b/spec/lib/gitlab/import_export/fork_spec.rb index 71fd5a51c3b..5752fd8fa0d 100644 --- a/spec/lib/gitlab/import_export/fork_spec.rb +++ b/spec/lib/gitlab/import_export/fork_spec.rb @@ -47,7 +47,7 @@ describe 'forked project import' do end end - it 'can access the MR' do + it 'can access the MR', :sidekiq_might_not_need_inline do project.merge_requests.first.fetch_ref! expect(project.repository.ref_exists?('refs/merge-requests/1/head')).to be_truthy diff --git a/spec/lib/gitlab/phabricator_import/project_creator_spec.rb b/spec/lib/gitlab/phabricator_import/project_creator_spec.rb index e9455b866ac..fd17284eea2 100644 --- a/spec/lib/gitlab/phabricator_import/project_creator_spec.rb +++ b/spec/lib/gitlab/phabricator_import/project_creator_spec.rb @@ -11,7 +11,7 @@ describe Gitlab::PhabricatorImport::ProjectCreator do subject(:creator) { described_class.new(user, params) } describe '#execute' do - it 'creates a project correctly and schedule an import' do + it 'creates a project correctly and schedule an import', :sidekiq_might_not_need_inline do expect_next_instance_of(Gitlab::PhabricatorImport::Importer) do |importer| expect(importer).to receive(:execute) end diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index a17e9a31212..79ad1c0b43f 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -310,18 +310,18 @@ describe Gitlab::Shell do let(:disk_path) { "#{project.disk_path}.git" } it 'returns true when the command succeeds' do - expect(gitlab_shell.exists?(project.repository_storage, disk_path)).to be(true) + expect(TestEnv.storage_dir_exists?(project.repository_storage, disk_path)).to be(true) expect(gitlab_shell.remove_repository(project.repository_storage, project.disk_path)).to be(true) - expect(gitlab_shell.exists?(project.repository_storage, disk_path)).to be(false) + expect(TestEnv.storage_dir_exists?(project.repository_storage, disk_path)).to be(false) end it 'keeps the namespace directory' do gitlab_shell.remove_repository(project.repository_storage, project.disk_path) - expect(gitlab_shell.exists?(project.repository_storage, disk_path)).to be(false) - expect(gitlab_shell.exists?(project.repository_storage, project.disk_path.gsub(project.name, ''))).to be(true) + expect(TestEnv.storage_dir_exists?(project.repository_storage, disk_path)).to be(false) + expect(TestEnv.storage_dir_exists?(project.repository_storage, project.disk_path.gsub(project.name, ''))).to be(true) end end @@ -332,18 +332,18 @@ describe Gitlab::Shell do old_path = project2.disk_path new_path = "project/new_path" - expect(gitlab_shell.exists?(project2.repository_storage, "#{old_path}.git")).to be(true) - expect(gitlab_shell.exists?(project2.repository_storage, "#{new_path}.git")).to be(false) + expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{old_path}.git")).to be(true) + expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{new_path}.git")).to be(false) expect(gitlab_shell.mv_repository(project2.repository_storage, old_path, new_path)).to be_truthy - expect(gitlab_shell.exists?(project2.repository_storage, "#{old_path}.git")).to be(false) - expect(gitlab_shell.exists?(project2.repository_storage, "#{new_path}.git")).to be(true) + expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{old_path}.git")).to be(false) + expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{new_path}.git")).to be(true) end it 'returns false when the command fails' do expect(gitlab_shell.mv_repository(project2.repository_storage, project2.disk_path, '')).to be_falsy - expect(gitlab_shell.exists?(project2.repository_storage, "#{project2.disk_path}.git")).to be(true) + expect(TestEnv.storage_dir_exists?(project2.repository_storage, "#{project2.disk_path}.git")).to be(true) end end @@ -403,56 +403,32 @@ describe Gitlab::Shell do it 'creates a namespace' do subject.add_namespace(storage, "mepmep") - expect(subject.exists?(storage, "mepmep")).to be(true) + expect(TestEnv.storage_dir_exists?(storage, "mepmep")).to be(true) end end - describe '#exists?' do - context 'when the namespace does not exist' do + describe '#repository_exists?' do + context 'when the repository does not exist' do it 'returns false' do - expect(subject.exists?(storage, "non-existing")).to be(false) + expect(subject.repository_exists?(storage, "non-existing.git")).to be(false) end end - context 'when the namespace exists' do + context 'when the repository exists' do it 'returns true' do - subject.add_namespace(storage, "mepmep") + project = create(:project, :repository, :legacy_storage) - expect(subject.exists?(storage, "mepmep")).to be(true) + expect(subject.repository_exists?(storage, project.repository.disk_path + ".git")).to be(true) end end end - describe '#repository_exists?' do - context 'when the storage path does not exist' do - subject { described_class.new.repository_exists?(storage, "non-existing.git") } - - it { is_expected.to be_falsey } - end - - context 'when the repository does not exist' do - let(:project) { create(:project, :repository, :legacy_storage) } - - subject { described_class.new.repository_exists?(storage, "#{project.repository.disk_path}-some-other-repo.git") } - - it { is_expected.to be_falsey } - end - - context 'when the repository exists' do - let(:project) { create(:project, :repository, :legacy_storage) } - - subject { described_class.new.repository_exists?(storage, "#{project.repository.disk_path}.git") } - - it { is_expected.to be_truthy } - end - end - describe '#remove' do it 'removes the namespace' do subject.add_namespace(storage, "mepmep") subject.rm_namespace(storage, "mepmep") - expect(subject.exists?(storage, "mepmep")).to be(false) + expect(TestEnv.storage_dir_exists?(storage, "mepmep")).to be(false) end end @@ -461,8 +437,8 @@ describe Gitlab::Shell do subject.add_namespace(storage, "mepmep") subject.mv_namespace(storage, "mepmep", "2mep") - expect(subject.exists?(storage, "mepmep")).to be(false) - expect(subject.exists?(storage, "2mep")).to be(true) + expect(TestEnv.storage_dir_exists?(storage, "mepmep")).to be(false) + expect(TestEnv.storage_dir_exists?(storage, "2mep")).to be(true) end end end diff --git a/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb b/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb index 8410467ef1f..27eea963402 100644 --- a/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware/correlation_logger_spec.rb @@ -19,7 +19,7 @@ describe Gitlab::SidekiqMiddleware::CorrelationLogger do end end - it 'injects into payload the correlation id' do + it 'injects into payload the correlation id', :sidekiq_might_not_need_inline do expect_any_instance_of(described_class).to receive(:call).and_call_original expect_any_instance_of(TestWorker).to receive(:perform).with(1234) do diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index 50488dba48c..4615599be7e 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -13,14 +13,17 @@ describe Gitlab::Tracking do describe '.snowplow_options' do it 'returns useful client options' do - expect(described_class.snowplow_options(nil)).to eq( + expected_fields = { namespace: 'gl', hostname: 'gitfoo.com', cookieDomain: '.gitfoo.com', appId: '_abc123_', formTracking: true, - linkClickTracking: true - ) + linkClickTracking: true, + userId: nil + } + + expect(subject.snowplow_options(nil, nil)).to match(expected_fields) end it 'enables features using feature flags' do @@ -29,11 +32,12 @@ describe Gitlab::Tracking do :additional_snowplow_tracking, '_group_' ).and_return(false) - - expect(described_class.snowplow_options('_group_')).to include( + addition_feature_fields = { formTracking: false, linkClickTracking: false - ) + } + + expect(subject.snowplow_options('_group_', nil)).to include(addition_feature_fields) end end diff --git a/spec/lib/gitlab/user_access_spec.rb b/spec/lib/gitlab/user_access_spec.rb index c25bd14fcba..4e7c43a6856 100644 --- a/spec/lib/gitlab/user_access_spec.rb +++ b/spec/lib/gitlab/user_access_spec.rb @@ -148,7 +148,7 @@ describe Gitlab::UserAccess do ) end - it 'allows users that have push access to the canonical project to push to the MR branch' do + it 'allows users that have push access to the canonical project to push to the MR branch', :sidekiq_might_not_need_inline do canonical_project.add_developer(user) expect(access.can_push_to_branch?('awesome-feature')).to be_truthy 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 826c5a2324b..f4155eab1bf 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 @@ -32,7 +32,7 @@ describe ScheduleSetConfidentialNoteEventsOnServices, :migration, :sidekiq do end end - it 'correctly processes services' do + it 'correctly processes services', :sidekiq_might_not_need_inline do perform_enqueued_jobs do expect(services_table.where(confidential_note_events: nil).count).to eq 4 expect(services_table.where(confidential_note_events: true).count).to eq 1 diff --git a/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb b/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb index 65a918d5440..913b4d3f114 100644 --- a/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb +++ b/spec/migrations/backfill_store_project_full_path_in_repo_spec.rb @@ -20,7 +20,7 @@ describe BackfillStoreProjectFullPathInRepo, :migration do describe '#up' do shared_examples_for 'writes the full path to git config' do - it 'writes the git config' do + it 'writes the git config', :sidekiq_might_not_need_inline do expect_next_instance_of(Gitlab::GitalyClient::RepositoryService) do |repository_service| allow(repository_service).to receive(:cleanup) expect(repository_service).to receive(:set_config).with('gitlab.fullpath' => expected_path) @@ -29,7 +29,7 @@ describe BackfillStoreProjectFullPathInRepo, :migration do migration.up end - it 'retries in case of failure' do + it 'retries in case of failure', :sidekiq_might_not_need_inline do repository_service = spy(:repository_service) allow(Gitlab::GitalyClient::RepositoryService).to receive(:new).and_return(repository_service) @@ -40,7 +40,7 @@ describe BackfillStoreProjectFullPathInRepo, :migration do migration.up end - it 'cleans up repository before writing the config' do + it 'cleans up repository before writing the config', :sidekiq_might_not_need_inline do expect_next_instance_of(Gitlab::GitalyClient::RepositoryService) do |repository_service| expect(repository_service).to receive(:cleanup).ordered expect(repository_service).to receive(:set_config).ordered @@ -87,7 +87,7 @@ describe BackfillStoreProjectFullPathInRepo, :migration do context 'project in group' do let!(:project) { projects.create!(namespace_id: group.id, name: 'baz', path: 'baz') } - it 'deletes the gitlab full config value' do + it 'deletes the gitlab full config value', :sidekiq_might_not_need_inline do expect_any_instance_of(Gitlab::GitalyClient::RepositoryService) .to receive(:delete_config).with(['gitlab.fullpath']) diff --git a/spec/migrations/fill_file_store_spec.rb b/spec/migrations/fill_file_store_spec.rb index a87d910c73b..806c9283634 100644 --- a/spec/migrations/fill_file_store_spec.rb +++ b/spec/migrations/fill_file_store_spec.rb @@ -23,7 +23,7 @@ describe FillFileStore, :migration do uploads.create!(size: 10, path: 'path', uploader: 'uploader', mount_point: 'file_name', store: nil) end - it 'correctly migrates nullified file_store/store column' do + it 'correctly migrates nullified file_store/store column', :sidekiq_might_not_need_inline do expect(job_artifacts.where(file_store: nil).count).to eq(1) expect(lfs_objects.where(file_store: nil).count).to eq(1) expect(uploads.where(store: nil).count).to eq(1) diff --git a/spec/migrations/fix_wrong_pages_access_level_spec.rb b/spec/migrations/fix_wrong_pages_access_level_spec.rb index 73df6e3b16d..73d8218b95c 100644 --- a/spec/migrations/fix_wrong_pages_access_level_spec.rb +++ b/spec/migrations/fix_wrong_pages_access_level_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20190703185326_fix_wrong_pages_access_level.rb') -describe FixWrongPagesAccessLevel, :migration, :sidekiq, schema: 20190628185004 do +describe FixWrongPagesAccessLevel, :migration, :sidekiq_might_not_need_inline, schema: 20190628185004 do using RSpec::Parameterized::TableSyntax let(:migration_class) { described_class::MIGRATION } 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 be39d9cd75a..98bbe0ed5a2 100644 --- a/spec/migrations/migrate_legacy_artifacts_to_job_artifacts_spec.rb +++ b/spec/migrations/migrate_legacy_artifacts_to_job_artifacts_spec.rb @@ -42,7 +42,7 @@ describe MigrateLegacyArtifactsToJobArtifacts, :migration, :sidekiq do end end - it 'migrates legacy artifacts to ci_job_artifacts table' do + it 'migrates legacy artifacts to ci_job_artifacts table', :sidekiq_might_not_need_inline do migrate! expect(job_artifacts.order(:job_id, :file_type).pluck('project_id, job_id, file_type, file_store, size, expire_at, file, file_sha256, file_location')) diff --git a/spec/migrations/schedule_digest_personal_access_tokens_spec.rb b/spec/migrations/schedule_digest_personal_access_tokens_spec.rb index aca95ffee08..ff859d07ff2 100644 --- a/spec/migrations/schedule_digest_personal_access_tokens_spec.rb +++ b/spec/migrations/schedule_digest_personal_access_tokens_spec.rb @@ -34,7 +34,7 @@ describe ScheduleDigestPersonalAccessTokens, :migration, :sidekiq do end end - it 'schedules background migrations' do + it 'schedules background migrations', :sidekiq_might_not_need_inline do perform_enqueued_jobs do plain_text_token = 'token IS NOT NULL' 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 cd431d23fa3..a0241f1d20c 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 @@ -34,7 +34,7 @@ describe ScheduleFillValidTimeForPagesDomainCertificates, :migration, :sidekiq d end end - it 'sets certificate valid_not_before/not_after' do + it 'sets certificate valid_not_before/not_after', :sidekiq_might_not_need_inline do perform_enqueued_jobs do migrate! 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 cb3cdb44271..845b0515177 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 @@ -32,7 +32,7 @@ describe ScheduleSetConfidentialNoteEventsOnWebhooks, :migration, :sidekiq do end end - it 'correctly processes web hooks' do + it 'correctly processes web hooks', :sidekiq_might_not_need_inline do perform_enqueued_jobs do expect(web_hooks_table.where(confidential_note_events: nil).count).to eq 4 expect(web_hooks_table.where(confidential_note_events: true).count).to eq 1 diff --git a/spec/migrations/schedule_sync_issuables_state_id_spec.rb b/spec/migrations/schedule_sync_issuables_state_id_spec.rb index bc94f8820bd..4f841e8ce04 100644 --- a/spec/migrations/schedule_sync_issuables_state_id_spec.rb +++ b/spec/migrations/schedule_sync_issuables_state_id_spec.rb @@ -33,7 +33,7 @@ describe ScheduleSyncIssuablesStateId, :migration, :sidekiq do describe '#up' do context 'issues' do - it 'migrates state column to integer' do + it 'migrates state column to integer', :sidekiq_might_not_need_inline do opened_issue = issues.create!(description: 'first', state: 'opened') closed_issue = issues.create!(description: 'second', state: 'closed') invalid_state_issue = issues.create!(description: 'fourth', state: 'not valid') @@ -55,7 +55,7 @@ describe ScheduleSyncIssuablesStateId, :migration, :sidekiq do end context 'merge requests' do - it 'migrates state column to integer' do + it 'migrates state column to integer', :sidekiq_might_not_need_inline do opened_merge_request = merge_requests.create!(state: 'opened', target_project_id: project.id, target_branch: 'feature1', source_branch: 'master') closed_merge_request = merge_requests.create!(state: 'closed', target_project_id: project.id, target_branch: 'feature2', source_branch: 'master') merged_merge_request = merge_requests.create!(state: 'merged', target_project_id: project.id, target_branch: 'feature3', source_branch: 'master') diff --git a/spec/migrations/schedule_to_archive_legacy_traces_spec.rb b/spec/migrations/schedule_to_archive_legacy_traces_spec.rb index 3f05c4aefd3..a81fb1494c7 100644 --- a/spec/migrations/schedule_to_archive_legacy_traces_spec.rb +++ b/spec/migrations/schedule_to_archive_legacy_traces_spec.rb @@ -25,7 +25,7 @@ describe ScheduleToArchiveLegacyTraces, :migration do create_legacy_trace(@build_running, 'This job is not done yet') end - it 'correctly archive legacy traces' do + it 'correctly archive legacy traces', :sidekiq_might_not_need_inline do expect(job_artifacts.count).to eq(0) expect(File.exist?(legacy_trace_path(@build_success))).to be_truthy expect(File.exist?(legacy_trace_path(@build_failed))).to be_truthy diff --git a/spec/models/ci/build_trace_chunk_spec.rb b/spec/models/ci/build_trace_chunk_spec.rb index 59db347582b..66b65d8b6d8 100644 --- a/spec/models/ci/build_trace_chunk_spec.rb +++ b/spec/models/ci/build_trace_chunk_spec.rb @@ -180,7 +180,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do subject end - it 'migrates data to object storage' do + it 'migrates data to object storage', :sidekiq_might_not_need_inline do perform_enqueued_jobs do subject @@ -582,7 +582,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do end shared_examples_for 'deletes all build_trace_chunk and data in redis' do - it do + it 'deletes all build_trace_chunk and data in redis', :sidekiq_might_not_need_inline do Gitlab::Redis::SharedState.with do |redis| expect(redis.scan_each(match: "gitlab:ci:trace:*:chunks:*").to_a.size).to eq(3) end diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index de0ce9932e8..5e5a94f8cda 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -1346,7 +1346,7 @@ describe Ci::Pipeline, :mailer do end end - describe '#duration' do + describe '#duration', :sidekiq_might_not_need_inline do context 'when multiple builds are finished' do before do travel_to(current + 30) do @@ -1422,7 +1422,7 @@ describe Ci::Pipeline, :mailer do end describe '#finished_at' do - it 'updates on transitioning to success' do + it 'updates on transitioning to success', :sidekiq_might_not_need_inline do build.success expect(pipeline.reload.finished_at).not_to be_nil @@ -2102,7 +2102,7 @@ describe Ci::Pipeline, :mailer do it { is_expected.not_to include('created', 'preparing', 'pending') } end - describe '#status' do + describe '#status', :sidekiq_might_not_need_inline do let(:build) do create(:ci_build, :created, pipeline: pipeline, name: 'test') end @@ -2675,7 +2675,7 @@ describe Ci::Pipeline, :mailer do stub_full_request(hook.url, method: :post) end - context 'with multiple builds' do + context 'with multiple builds', :sidekiq_might_not_need_inline do context 'when build is queued' do before do build_a.enqueue @@ -2930,7 +2930,7 @@ describe Ci::Pipeline, :mailer do end shared_examples 'sending a notification' do - it 'sends an email' do + it 'sends an email', :sidekiq_might_not_need_inline do should_only_email(pipeline.user, kind: :bcc) end end diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 95e9b0d0f92..1e1b679a32c 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -522,7 +522,7 @@ describe CommitStatus do let(:stage) { Ci::Stage.first } - it 'creates a new stage' do + it 'creates a new stage', :sidekiq_might_not_need_inline do expect { commit_status }.to change { Ci::Stage.count }.by(1) expect(stage.name).to eq 'test' @@ -548,7 +548,7 @@ describe CommitStatus do status: :success) end - it 'uses existing stage' do + it 'uses existing stage', :sidekiq_might_not_need_inline do expect { commit_status }.not_to change { Ci::Stage.count } expect(commit_status.stage_id).to eq stage.id diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 85a8f35393b..c1f6302ee50 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -259,7 +259,7 @@ describe Environment, :use_clean_rails_memory_store_caching do let(:head_commit) { project.commit } let(:commit) { project.commit.parent } - it 'returns deployment id for the environment' do + it 'returns deployment id for the environment', :sidekiq_might_not_need_inline do expect(environment.first_deployment_for(commit.id)).to eq deployment1 end @@ -267,7 +267,7 @@ describe Environment, :use_clean_rails_memory_store_caching do expect(environment.first_deployment_for(head_commit.id)).to eq nil end - it 'returns a UTF-8 ref' do + it 'returns a UTF-8 ref', :sidekiq_might_not_need_inline do expect(environment.first_deployment_for(commit.id).ref).to be_utf8 end end diff --git a/spec/models/environment_status_spec.rb b/spec/models/environment_status_spec.rb index 01d331f518b..eea81d7c128 100644 --- a/spec/models/environment_status_spec.rb +++ b/spec/models/environment_status_spec.rb @@ -113,7 +113,7 @@ describe EnvironmentStatus do head_pipeline: pipeline) end - it 'returns environment status' do + it 'returns environment status', :sidekiq_might_not_need_inline do expect(subject.count).to eq(1) expect(subject[0].environment).to eq(environment) expect(subject[0].merge_request).to eq(merge_request) diff --git a/spec/models/hooks/system_hook_spec.rb b/spec/models/hooks/system_hook_spec.rb index a4d202dc4f8..94f1b0cba2e 100644 --- a/spec/models/hooks/system_hook_spec.rb +++ b/spec/models/hooks/system_hook_spec.rb @@ -16,7 +16,7 @@ describe SystemHook do end end - describe "execute" do + describe "execute", :sidekiq_might_not_need_inline do let(:system_hook) { create(:system_hook) } let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace) } diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 5a421cad0f8..91a743c4377 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -1190,7 +1190,7 @@ describe MergeRequest do context 'diverged on fork' do subject(:merge_request_fork_with_divergence) { create(:merge_request, :diverged, source_project: forked_project, target_project: project) } - it 'counts commits that are on target branch but not on source branch' do + it 'counts commits that are on target branch but not on source branch', :sidekiq_might_not_need_inline do expect(subject.diverged_commits_count).to eq(29) end end @@ -2391,7 +2391,7 @@ describe MergeRequest do create(:deployment, :success, environment: source_environment, ref: 'feature', sha: merge_request.diff_head_sha) end - it 'selects deployed environments' do + it 'selects deployed environments', :sidekiq_might_not_need_inline do expect(merge_request.environments_for(user)).to contain_exactly(source_environment) end @@ -2402,7 +2402,7 @@ describe MergeRequest do create(:deployment, :success, environment: target_environment, tag: true, sha: merge_request.diff_head_sha) end - it 'selects deployed environments' do + it 'selects deployed environments', :sidekiq_might_not_need_inline do expect(merge_request.environments_for(user)).to contain_exactly(source_environment, target_environment) end end @@ -2996,7 +2996,7 @@ describe MergeRequest do describe '#unlock_mr' do subject { create(:merge_request, state: 'locked', merge_jid: 123) } - it 'updates merge request head pipeline and sets merge_jid to nil' do + it 'updates merge request head pipeline and sets merge_jid to nil', :sidekiq_might_not_need_inline do pipeline = create(:ci_empty_pipeline, project: subject.project, ref: subject.source_branch, sha: subject.source_branch_sha) subject.unlock_mr diff --git a/spec/models/project_import_state_spec.rb b/spec/models/project_import_state_spec.rb index 8a847bbe24e..0b4dcc62ff6 100644 --- a/spec/models/project_import_state_spec.rb +++ b/spec/models/project_import_state_spec.rb @@ -27,7 +27,7 @@ describe ProjectImportState, type: :model do expect(project.wiki.repository).to receive(:after_import).and_call_original end - it 'imports a project' do + it 'imports a project', :sidekiq_might_not_need_inline do expect(RepositoryImportWorker).to receive(:perform_async).and_call_original expect { import_state.schedule }.to change { import_state.jid } diff --git a/spec/models/project_services/irker_service_spec.rb b/spec/models/project_services/irker_service_spec.rb index 2e1f6964692..309dc51191b 100644 --- a/spec/models/project_services/irker_service_spec.rb +++ b/spec/models/project_services/irker_service_spec.rb @@ -60,7 +60,7 @@ describe IrkerService do @irker_server.close end - it 'sends valid JSON messages to an Irker listener' do + it 'sends valid JSON messages to an Irker listener', :sidekiq_might_not_need_inline do irker.execute(sample_data) conn = @irker_server.accept diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 9f3313e67b5..5922a6f36f5 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -4284,22 +4284,25 @@ describe Project do describe '#check_repository_path_availability' do let(:project) { build(:project, :repository, :legacy_storage) } - subject { project.check_repository_path_availability } context 'when the repository already exists' do let(:project) { create(:project, :repository, :legacy_storage) } - it { is_expected.to be_falsey } + it 'returns false when repository already exists' do + expect(project.check_repository_path_availability).to be_falsey + end end context 'when the repository does not exist' do - it { is_expected.to be_truthy } + it 'returns false when repository already exists' do + expect(project.check_repository_path_availability).to be_truthy + end it 'skips gitlab-shell exists?' do project.skip_disk_validation = true expect(project.gitlab_shell).not_to receive(:repository_exists?) - is_expected.to be_truthy + expect(project.check_repository_path_availability).to be_truthy end end end @@ -4623,7 +4626,7 @@ describe Project do end describe '#any_branch_allows_collaboration?' do - it 'allows access when there are merge requests open allowing collaboration' do + it 'allows access when there are merge requests open allowing collaboration', :sidekiq_might_not_need_inline do expect(project.any_branch_allows_collaboration?(user)) .to be_truthy end @@ -4637,7 +4640,7 @@ describe Project do end describe '#branch_allows_collaboration?' do - it 'allows access if the user can merge the merge request' do + it 'allows access if the user can merge the merge request', :sidekiq_might_not_need_inline do expect(project.branch_allows_collaboration?(user, 'awesome-feature-1')) .to be_truthy end diff --git a/spec/models/release_spec.rb b/spec/models/release_spec.rb index 0aac325c2b2..297367853f0 100644 --- a/spec/models/release_spec.rb +++ b/spec/models/release_spec.rb @@ -92,7 +92,7 @@ RSpec.describe Release do end end - describe 'evidence' do + describe 'evidence', :sidekiq_might_not_need_inline do describe '#create_evidence!' do context 'when a release is created' do it 'creates one Evidence object too' do diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb index 63d0bf3f314..79d45da8a1e 100644 --- a/spec/models/remote_mirror_spec.rb +++ b/spec/models/remote_mirror_spec.rb @@ -189,7 +189,7 @@ describe RemoteMirror, :mailer do remote_mirror.project.add_maintainer(user) end - it 'notifies the project maintainers' do + it 'notifies the project maintainers', :sidekiq_might_not_need_inline do perform_enqueued_jobs { subject } should_email(user) diff --git a/spec/models/spam_log_spec.rb b/spec/models/spam_log_spec.rb index e9ea234f75d..f4e073dc38f 100644 --- a/spec/models/spam_log_spec.rb +++ b/spec/models/spam_log_spec.rb @@ -20,7 +20,7 @@ describe SpamLog do expect { spam_log.remove_user(deleted_by: admin) }.to change { spam_log.user.blocked? }.to(true) end - it 'removes the user' do + it 'removes the user', :sidekiq_might_not_need_inline do spam_log = build(:spam_log) user = spam_log.user diff --git a/spec/requests/api/commit_statuses_spec.rb b/spec/requests/api/commit_statuses_spec.rb index 6cb02ba2f6b..2b5e8226403 100644 --- a/spec/requests/api/commit_statuses_spec.rb +++ b/spec/requests/api/commit_statuses_spec.rb @@ -278,7 +278,7 @@ describe API::CommitStatuses do } end - it 'update the correct pipeline' do + it 'update the correct pipeline', :sidekiq_might_not_need_inline do subject expect(first_pipeline.reload.status).to eq('created') @@ -302,7 +302,7 @@ describe API::CommitStatuses do expect(json_response['status']).to eq('success') end - it 'retries a commit status' do + it 'retries a commit status', :sidekiq_might_not_need_inline do expect(CommitStatus.count).to eq 2 expect(CommitStatus.first).to be_retried expect(CommitStatus.last.pipeline).to be_success diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index 90ff1d12bf1..1648e3afa4b 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -369,7 +369,7 @@ describe API::Commits do valid_c_params[:start_project] = public_project.id end - it 'adds a new commit to forked_project and returns a 201' do + it 'adds a new commit to forked_project and returns a 201', :sidekiq_might_not_need_inline do expect_request_with_status(201) { post api(url, guest), params: valid_c_params } .to change { last_commit_id(forked_project, valid_c_params[:branch]) } .and not_change { last_commit_id(public_project, valid_c_params[:start_branch]) } @@ -381,14 +381,14 @@ describe API::Commits do valid_c_params[:start_project] = public_project.full_path end - it 'adds a new commit to forked_project and returns a 201' do + it 'adds a new commit to forked_project and returns a 201', :sidekiq_might_not_need_inline do expect_request_with_status(201) { post api(url, guest), params: valid_c_params } .to change { last_commit_id(forked_project, valid_c_params[:branch]) } .and not_change { last_commit_id(public_project, valid_c_params[:start_branch]) } end end - context 'when branch already exists' do + context 'when branch already exists', :sidekiq_might_not_need_inline do before do valid_c_params.delete(:start_branch) valid_c_params[:branch] = 'master' @@ -835,7 +835,7 @@ describe API::Commits do } end - it 'allows pushing to the source branch of the merge request' do + it 'allows pushing to the source branch of the merge request', :sidekiq_might_not_need_inline do post api(url, user), params: push_params('feature') expect(response).to have_gitlab_http_status(:created) @@ -1417,7 +1417,7 @@ describe API::Commits do let(:project_id) { forked_project.id } - it 'allows access from a maintainer that to the source branch' do + it 'allows access from a maintainer that to the source branch', :sidekiq_might_not_need_inline do post api(route, user), params: { branch: 'feature' } expect(response).to have_gitlab_http_status(:created) diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index 89ee6f896f9..760bacff75e 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -595,7 +595,7 @@ describe API::Jobs do context 'find proper job' do shared_examples 'a valid file' do - context 'when artifacts are stored locally' do + context 'when artifacts are stored locally', :sidekiq_might_not_need_inline do let(:download_headers) do { 'Content-Transfer-Encoding' => 'binary', 'Content-Disposition' => @@ -674,7 +674,7 @@ describe API::Jobs do let(:visibility_level) { Gitlab::VisibilityLevel::PUBLIC } let(:public_builds) { true } - it 'allows to access artifacts' do + it 'allows to access artifacts', :sidekiq_might_not_need_inline do expect(response).to have_gitlab_http_status(200) expect(response.headers.to_h) .to include('Content-Type' => 'application/json', @@ -711,7 +711,7 @@ describe API::Jobs do let(:visibility_level) { Gitlab::VisibilityLevel::PRIVATE } let(:public_builds) { true } - it 'returns a specific artifact file for a valid path' do + it 'returns a specific artifact file for a valid path', :sidekiq_might_not_need_inline do expect(Gitlab::Workhorse) .to receive(:send_artifacts_entry) .and_call_original @@ -732,7 +732,7 @@ describe API::Jobs do sha: project.commit('improve/awesome').sha) end - it 'returns a specific artifact file for a valid path' do + it 'returns a specific artifact file for a valid path', :sidekiq_might_not_need_inline do get_artifact_file(artifact, 'improve/awesome') expect(response).to have_gitlab_http_status(200) diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index e9bf8e7adc7..721998ede6a 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -921,7 +921,7 @@ describe API::MergeRequests do allow_collaboration: true) end - it 'includes the `allow_collaboration` field' do + it 'includes the `allow_collaboration` field', :sidekiq_might_not_need_inline do get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user) expect(json_response['allow_collaboration']).to be_truthy @@ -1406,7 +1406,7 @@ describe API::MergeRequests do expect(response).to have_gitlab_http_status(400) end - it 'allows setting `allow_collaboration`' do + it 'allows setting `allow_collaboration`', :sidekiq_might_not_need_inline do post api("/projects/#{forked_project.id}/merge_requests", user2), params: { title: 'Test merge_request', source_branch: "feature_conflict", target_branch: "master", author: user2, target_project_id: project.id, allow_collaboration: true } expect(response).to have_gitlab_http_status(201) @@ -1438,7 +1438,7 @@ describe API::MergeRequests do end end - it "returns 201 when target_branch is specified and for the same project" do + it "returns 201 when target_branch is specified and for the same project", :sidekiq_might_not_need_inline do post api("/projects/#{forked_project.id}/merge_requests", user2), params: { title: 'Test merge_request', target_branch: 'master', source_branch: 'markdown', author: user2, target_project_id: forked_project.id } expect(response).to have_gitlab_http_status(201) diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index 3ac63dc381b..cce52cfc1ca 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -673,7 +673,7 @@ describe API::Pipelines do let!(:build) { create(:ci_build, :running, pipeline: pipeline) } context 'authorized user' do - it 'retries failed builds' do + it 'retries failed builds', :sidekiq_might_not_need_inline do post api("/projects/#{project.id}/pipelines/#{pipeline.id}/cancel", user) expect(response).to have_gitlab_http_status(200) diff --git a/spec/requests/api/project_export_spec.rb b/spec/requests/api/project_export_spec.rb index 7de8935097a..4f1003efafe 100644 --- a/spec/requests/api/project_export_spec.rb +++ b/spec/requests/api/project_export_spec.rb @@ -370,7 +370,7 @@ describe API::ProjectExport do end context 'when overriding description' do - it 'starts' do + it 'starts', :sidekiq_might_not_need_inline do params = { description: "Foo" } expect_any_instance_of(Projects::ImportExport::ExportService).to receive(:execute) diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb index d2b1fb063b8..579d1a36c22 100644 --- a/spec/requests/api/project_import_spec.rb +++ b/spec/requests/api/project_import_spec.rb @@ -153,7 +153,7 @@ describe API::ProjectImport do expect(import_project.import_data.data['override_params']).to be_empty end - it 'correctly overrides params during the import' do + it 'correctly overrides params during the import', :sidekiq_might_not_need_inline do override_params = { 'description' => 'Hello world' } perform_enqueued_jobs do diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 2d8ef9c06dc..a4ef050a698 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -15,7 +15,7 @@ shared_examples 'languages and percentages JSON response' do end context "when the languages haven't been detected yet" do - it 'returns expected language values' do + it 'returns expected language values', :sidekiq_might_not_need_inline do get api("/projects/#{project.id}/languages", user) expect(response).to have_gitlab_http_status(:ok) diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index ee4e783e9ac..a006ac4571c 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -1277,7 +1277,7 @@ describe API::Users do admin end - it "deletes user" do + it "deletes user", :sidekiq_might_not_need_inline do perform_enqueued_jobs { delete api("/users/#{user.id}", admin) } expect(response).to have_gitlab_http_status(204) @@ -1312,7 +1312,7 @@ describe API::Users do end context "hard delete disabled" do - it "moves contributions to the ghost user" do + it "moves contributions to the ghost user", :sidekiq_might_not_need_inline do perform_enqueued_jobs { delete api("/users/#{user.id}", admin) } expect(response).to have_gitlab_http_status(204) @@ -1322,7 +1322,7 @@ describe API::Users do end context "hard delete enabled" do - it "removes contributions" do + it "removes contributions", :sidekiq_might_not_need_inline do perform_enqueued_jobs { delete api("/users/#{user.id}?hard_delete=true", admin) } expect(response).to have_gitlab_http_status(204) diff --git a/spec/requests/git_http_spec.rb b/spec/requests/git_http_spec.rb index 07e56619f40..1cabfb55803 100644 --- a/spec/requests/git_http_spec.rb +++ b/spec/requests/git_http_spec.rb @@ -87,7 +87,7 @@ describe 'Git HTTP requests' do end shared_examples_for 'pulls are allowed' do - it do + it 'allows pulls' do download(path, env) do |response| expect(response).to have_gitlab_http_status(:ok) expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) @@ -96,7 +96,7 @@ describe 'Git HTTP requests' do end shared_examples_for 'pushes are allowed' do - it do + it 'allows pushes', :sidekiq_might_not_need_inline do upload(path, env) do |response| expect(response).to have_gitlab_http_status(:ok) expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) diff --git a/spec/requests/projects/cycle_analytics_events_spec.rb b/spec/requests/projects/cycle_analytics_events_spec.rb index 25390f8a23e..afbc5835f02 100644 --- a/spec/requests/projects/cycle_analytics_events_spec.rb +++ b/spec/requests/projects/cycle_analytics_events_spec.rb @@ -48,7 +48,7 @@ describe 'cycle analytics events' do expect(json_response['events'].first['iid']).to eq(first_mr_iid) end - it 'lists the test events' do + it 'lists the test events', :sidekiq_might_not_need_inline do get project_cycle_analytics_test_path(project, format: :json) expect(json_response['events']).not_to be_empty @@ -64,14 +64,14 @@ describe 'cycle analytics events' do expect(json_response['events'].first['iid']).to eq(first_mr_iid) end - it 'lists the staging events' do + it 'lists the staging events', :sidekiq_might_not_need_inline do get project_cycle_analytics_staging_path(project, format: :json) expect(json_response['events']).not_to be_empty expect(json_response['events'].first['date']).not_to be_empty end - it 'lists the production events' do + it 'lists the production events', :sidekiq_might_not_need_inline do get project_cycle_analytics_production_path(project, format: :json) first_issue_iid = project.issues.sort_by_attribute(:created_desc).pluck(:iid).first.to_s @@ -81,7 +81,7 @@ describe 'cycle analytics events' do end context 'specific branch' do - it 'lists the test events' do + it 'lists the test events', :sidekiq_might_not_need_inline do branch = project.merge_requests.first.source_branch get project_cycle_analytics_test_path(project, format: :json, branch: branch) diff --git a/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb b/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb index 931b52470c4..c396539cf56 100644 --- a/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb +++ b/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb @@ -225,7 +225,7 @@ describe AutoMerge::MergeWhenPipelineSucceedsService do test.drop end - it 'merges when all stages succeeded' do + it 'merges when all stages succeeded', :sidekiq_might_not_need_inline do expect(MergeWorker).to receive(:perform_async) build.success diff --git a/spec/services/ci/cancel_user_pipelines_service_spec.rb b/spec/services/ci/cancel_user_pipelines_service_spec.rb index 251f21feaef..b18bf48a50a 100644 --- a/spec/services/ci/cancel_user_pipelines_service_spec.rb +++ b/spec/services/ci/cancel_user_pipelines_service_spec.rb @@ -12,7 +12,7 @@ describe Ci::CancelUserPipelinesService do let(:pipeline) { create(:ci_pipeline, :running, user: user) } let!(:build) { create(:ci_build, :running, pipeline: pipeline) } - it 'cancels all running pipelines and related jobs' do + it 'cancels all running pipelines and related jobs', :sidekiq_might_not_need_inline do subject expect(pipeline.reload).to be_canceled diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index fd5f72c4c46..2c63e621074 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -97,7 +97,7 @@ describe Ci::CreatePipelineService do end context 'when the head pipeline sha equals merge request sha' do - it 'updates head pipeline of each merge request' do + it 'updates head pipeline of each merge request', :sidekiq_might_not_need_inline do merge_request_1 merge_request_2 @@ -140,7 +140,7 @@ describe Ci::CreatePipelineService do let!(:project) { fork_project(target_project, nil, repository: true) } let!(:target_project) { create(:project, :repository) } - it 'updates head pipeline for merge request' do + it 'updates head pipeline for merge request', :sidekiq_might_not_need_inline do merge_request = create(:merge_request, source_branch: 'feature', target_branch: "master", source_project: project, @@ -172,7 +172,7 @@ describe Ci::CreatePipelineService do stub_ci_pipeline_yaml_file('some invalid syntax') end - it 'updates merge request head pipeline reference' do + it 'updates merge request head pipeline reference', :sidekiq_might_not_need_inline do merge_request = create(:merge_request, source_branch: 'master', target_branch: 'feature', source_project: project) @@ -192,7 +192,7 @@ describe Ci::CreatePipelineService do .and_return('some commit [ci skip]') end - it 'updates merge request head pipeline' do + it 'updates merge request head pipeline', :sidekiq_might_not_need_inline do merge_request = create(:merge_request, source_branch: 'master', target_branch: 'feature', source_project: project) @@ -218,21 +218,21 @@ describe Ci::CreatePipelineService do expect(pipeline.reload).to have_attributes(status: 'pending', auto_canceled_by_id: nil) end - it 'auto cancel pending non-HEAD pipelines' do + it 'auto cancel pending non-HEAD pipelines', :sidekiq_might_not_need_inline do pipeline_on_previous_commit pipeline expect(pipeline_on_previous_commit.reload).to have_attributes(status: 'canceled', auto_canceled_by_id: pipeline.id) end - it 'cancels running outdated pipelines' do + it 'cancels running outdated pipelines', :sidekiq_might_not_need_inline do pipeline_on_previous_commit.run head_pipeline = execute_service expect(pipeline_on_previous_commit.reload).to have_attributes(status: 'canceled', auto_canceled_by_id: head_pipeline.id) end - it 'cancel created outdated pipelines' do + it 'cancel created outdated pipelines', :sidekiq_might_not_need_inline do pipeline_on_previous_commit.update(status: 'created') pipeline @@ -346,7 +346,7 @@ describe Ci::CreatePipelineService do context 'when only interruptible builds are running' do context 'when build marked explicitly by interruptible is running' do - it 'cancels running outdated pipelines' do + it 'cancels running outdated pipelines', :sidekiq_might_not_need_inline do pipeline_on_previous_commit .builds .find_by_name('build_1_2') @@ -360,7 +360,7 @@ describe Ci::CreatePipelineService do end context 'when build that is not marked as interruptible is running' do - it 'cancels running outdated pipelines' do + it 'cancels running outdated pipelines', :sidekiq_might_not_need_inline do pipeline_on_previous_commit .builds .find_by_name('build_2_1') @@ -376,7 +376,7 @@ describe Ci::CreatePipelineService do end context 'when an uninterruptible build is running' do - it 'does not cancel running outdated pipelines' do + it 'does not cancel running outdated pipelines', :sidekiq_might_not_need_inline do pipeline_on_previous_commit .builds .find_by_name('build_3_1') @@ -391,7 +391,7 @@ describe Ci::CreatePipelineService do end context 'when an build is waiting on an interruptible scheduled task' do - it 'cancels running outdated pipelines' do + it 'cancels running outdated pipelines', :sidekiq_might_not_need_inline do allow(Ci::BuildScheduleWorker).to receive(:perform_at) pipeline_on_previous_commit @@ -407,7 +407,7 @@ describe Ci::CreatePipelineService do end context 'when a uninterruptible build has finished' do - it 'does not cancel running outdated pipelines' do + it 'does not cancel running outdated pipelines', :sidekiq_might_not_need_inline do pipeline_on_previous_commit .builds .find_by_name('build_3_1') @@ -1236,7 +1236,7 @@ describe Ci::CreatePipelineService do let!(:project) { fork_project(target_project, nil, repository: true) } let!(:target_project) { create(:project, :repository) } - it 'creates a legacy detached merge request pipeline in the forked project' do + it 'creates a legacy detached merge request pipeline in the forked project', :sidekiq_might_not_need_inline do expect(pipeline).to be_persisted expect(project.ci_pipelines).to eq([pipeline]) expect(target_project.ci_pipelines).to be_empty diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index 05adec8b745..991f8cdfac5 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -27,7 +27,7 @@ describe Ci::ProcessPipelineService, '#execute' do create_build('deploy', stage_idx: 2) end - it 'processes a pipeline' do + it 'processes a pipeline', :sidekiq_might_not_need_inline do expect(process_pipeline).to be_truthy succeed_pending @@ -58,7 +58,7 @@ describe Ci::ProcessPipelineService, '#execute' do create_build('test_job', stage_idx: 1, allow_failure: true) end - it 'automatically triggers a next stage when build finishes' do + it 'automatically triggers a next stage when build finishes', :sidekiq_might_not_need_inline do expect(process_pipeline).to be_truthy expect(builds_statuses).to eq ['pending'] @@ -72,7 +72,7 @@ describe Ci::ProcessPipelineService, '#execute' do end end - context 'when optional manual actions are defined' do + context 'when optional manual actions are defined', :sidekiq_might_not_need_inline do before do create_build('build', stage_idx: 0) create_build('test', stage_idx: 1) @@ -241,7 +241,7 @@ describe Ci::ProcessPipelineService, '#execute' do end end - context 'when delayed jobs are defined' do + context 'when delayed jobs are defined', :sidekiq_might_not_need_inline do context 'when the scene is timed incremental rollout' do before do create_build('build', stage_idx: 0) @@ -458,7 +458,7 @@ describe Ci::ProcessPipelineService, '#execute' do process_pipeline end - it 'skips second stage and continues on third stage' do + it 'skips second stage and continues on third stage', :sidekiq_might_not_need_inline do expect(all_builds_statuses).to eq(%w[pending created created]) builds.first.success @@ -502,7 +502,7 @@ describe Ci::ProcessPipelineService, '#execute' do play_manual_action('deploy') end - it 'queues the action and pipeline' do + it 'queues the action and pipeline', :sidekiq_might_not_need_inline do expect(all_builds_statuses).to eq(%w[pending]) expect(pipeline.reload).to be_pending @@ -510,7 +510,7 @@ describe Ci::ProcessPipelineService, '#execute' do end end - context 'when blocking manual actions are defined' do + context 'when blocking manual actions are defined', :sidekiq_might_not_need_inline do before do create_build('code:test', stage_idx: 0) create_build('staging:deploy', stage_idx: 1, when: 'manual') @@ -618,7 +618,7 @@ describe Ci::ProcessPipelineService, '#execute' do end end - context 'when second stage has only on_failure jobs' do + context 'when second stage has only on_failure jobs', :sidekiq_might_not_need_inline do before do create_build('check', stage_idx: 0) create_build('build', stage_idx: 1, when: 'on_failure') @@ -636,7 +636,7 @@ describe Ci::ProcessPipelineService, '#execute' do end end - context 'when failed build in the middle stage is retried' do + context 'when failed build in the middle stage is retried', :sidekiq_might_not_need_inline do context 'when failed build is the only unsuccessful build in the stage' do before do create_build('build:1', stage_idx: 0) @@ -683,7 +683,7 @@ describe Ci::ProcessPipelineService, '#execute' do end end - context 'when builds with auto-retries are configured' do + context 'when builds with auto-retries are configured', :sidekiq_might_not_need_inline do before do create_build('build:1', stage_idx: 0, user: user, options: { script: 'aa', retry: 2 }) create_build('test:1', stage_idx: 1, user: user, when: :on_failure) @@ -712,7 +712,7 @@ describe Ci::ProcessPipelineService, '#execute' do end end - context 'when pipeline with needs is created' do + context 'when pipeline with needs is created', :sidekiq_might_not_need_inline do let!(:linux_build) { create_build('linux:build', stage: 'build', stage_idx: 0) } let!(:mac_build) { create_build('mac:build', stage: 'build', stage_idx: 0) } let!(:linux_rspec) { create_build('linux:rspec', stage: 'test', stage_idx: 1) } diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb index 085b49f31ab..b1c64bc3c0a 100644 --- a/spec/services/git/branch_hooks_service_spec.rb +++ b/spec/services/git/branch_hooks_service_spec.rb @@ -345,7 +345,7 @@ describe Git::BranchHooksService do end end - context 'when the project is forked' do + context 'when the project is forked', :sidekiq_might_not_need_inline do let(:upstream_project) { project } let(:forked_project) { fork_project(upstream_project, user, repository: true) } diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb index bf68eb0af20..febd4992682 100644 --- a/spec/services/git/branch_push_service_spec.rb +++ b/spec/services/git/branch_push_service_spec.rb @@ -246,7 +246,7 @@ describe Git::BranchPushService, services: true do allow(project.repository).to receive(:commits_between).and_return([commit]) end - it "creates a note if a pushed commit mentions an issue" do + it "creates a note if a pushed commit mentions an issue", :sidekiq_might_not_need_inline do expect(SystemNoteService).to receive(:cross_reference).with(issue, commit, commit_author) execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) @@ -260,7 +260,7 @@ describe Git::BranchPushService, services: true do execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) end - it "defaults to the pushing user if the commit's author is not known" do + it "defaults to the pushing user if the commit's author is not known", :sidekiq_might_not_need_inline do allow(commit).to receive_messages( author_name: 'unknown name', author_email: 'unknown@email.com' @@ -270,7 +270,7 @@ describe Git::BranchPushService, services: true do execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) end - it "finds references in the first push to a non-default branch" do + it "finds references in the first push to a non-default branch", :sidekiq_might_not_need_inline do allow(project.repository).to receive(:commits_between).with(blankrev, newrev).and_return([]) allow(project.repository).to receive(:commits_between).with("master", newrev).and_return([commit]) @@ -305,7 +305,7 @@ describe Git::BranchPushService, services: true do end context "while saving the 'first_mentioned_in_commit_at' metric for an issue" do - it 'sets the metric for referenced issues' do + it 'sets the metric for referenced issues', :sidekiq_might_not_need_inline do execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) expect(issue.reload.metrics.first_mentioned_in_commit_at).to be_like_time(commit_time) @@ -344,12 +344,12 @@ describe Git::BranchPushService, services: true do end context "to default branches" do - it "closes issues" do + it "closes issues", :sidekiq_might_not_need_inline do execute_service(project, commit_author, oldrev: oldrev, newrev: newrev, ref: ref) expect(Issue.find(issue.id)).to be_closed end - it "adds a note indicating that the issue is now closed" do + it "adds a note indicating that the issue is now closed", :sidekiq_might_not_need_inline do expect(SystemNoteService).to receive(:change_status).with(issue, project, commit_author, "closed", closing_commit) execute_service(project, commit_author, oldrev: oldrev, newrev: newrev, ref: ref) end @@ -366,7 +366,7 @@ describe Git::BranchPushService, services: true do allow(project).to receive(:default_branch).and_return('not-master') end - it "creates cross-reference notes" do + it "creates cross-reference notes", :sidekiq_might_not_need_inline do expect(SystemNoteService).to receive(:cross_reference).with(issue, closing_commit, commit_author) execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) end @@ -407,7 +407,7 @@ describe Git::BranchPushService, services: true do context "mentioning an issue" do let(:message) { "this is some work.\n\nrelated to JIRA-1" } - it "initiates one api call to jira server to mention the issue" do + it "initiates one api call to jira server to mention the issue", :sidekiq_might_not_need_inline do execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) expect(WebMock).to have_requested(:post, jira_api_comment_url('JIRA-1')).with( @@ -434,7 +434,7 @@ describe Git::BranchPushService, services: true do allow_any_instance_of(JIRA::Resource::Issue).to receive(:key).and_return("JIRA-1") end - context "using right markdown" do + context "using right markdown", :sidekiq_might_not_need_inline do it "initiates one api call to jira server to close the issue" do execute_service(project, commit_author, oldrev: oldrev, newrev: newrev, ref: ref) @@ -473,7 +473,7 @@ describe Git::BranchPushService, services: true do end end - context 'when internal issues are enabled' do + context 'when internal issues are enabled', :sidekiq_might_not_need_inline do let(:issue) { create(:issue, project: project) } let(:message) { "this is some work.\n\ncloses JIRA-1 \n\n closes #{issue.to_reference}" } diff --git a/spec/services/groups/destroy_service_spec.rb b/spec/services/groups/destroy_service_spec.rb index d13739cefd9..055d0243d4b 100644 --- a/spec/services/groups/destroy_service_spec.rb +++ b/spec/services/groups/destroy_service_spec.rb @@ -26,7 +26,7 @@ describe Groups::DestroyService do end shared_examples 'group destruction' do |async| - context 'database records' do + context 'database records', :sidekiq_might_not_need_inline do before do destroy_group(group, user, async) end @@ -37,7 +37,7 @@ describe Groups::DestroyService do it { expect(NotificationSetting.unscoped.all).not_to include(notification_setting) } end - context 'mattermost team' do + context 'mattermost team', :sidekiq_might_not_need_inline do let!(:chat_team) { create(:chat_team, namespace: group) } it 'destroys the team too' do @@ -47,7 +47,7 @@ describe Groups::DestroyService do end end - context 'file system' do + context 'file system', :sidekiq_might_not_need_inline do context 'Sidekiq inline' do before do # Run sidekiq immediately to check that renamed dir will be removed @@ -55,8 +55,8 @@ describe Groups::DestroyService do end it 'verifies that paths have been deleted' do - expect(gitlab_shell.exists?(project.repository_storage, group.path)).to be_falsey - expect(gitlab_shell.exists?(project.repository_storage, remove_path)).to be_falsey + expect(TestEnv.storage_dir_exists?(project.repository_storage, group.path)).to be_falsey + expect(TestEnv.storage_dir_exists?(project.repository_storage, remove_path)).to be_falsey end end end @@ -73,13 +73,13 @@ describe Groups::DestroyService do after do # Clean up stale directories - gitlab_shell.rm_namespace(project.repository_storage, group.path) - gitlab_shell.rm_namespace(project.repository_storage, remove_path) + TestEnv.rm_storage_dir(project.repository_storage, group.path) + TestEnv.rm_storage_dir(project.repository_storage, remove_path) end it 'verifies original paths and projects still exist' do - expect(gitlab_shell.exists?(project.repository_storage, group.path)).to be_truthy - expect(gitlab_shell.exists?(project.repository_storage, remove_path)).to be_falsey + expect(TestEnv.storage_dir_exists?(project.repository_storage, group.path)).to be_truthy + expect(TestEnv.storage_dir_exists?(project.repository_storage, remove_path)).to be_falsey expect(Project.unscoped.count).to eq(1) expect(Group.unscoped.count).to eq(2) end diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb index 1f7d564b6ec..dce62d1d20e 100644 --- a/spec/services/issues/close_service_spec.rb +++ b/spec/services/issues/close_service_spec.rb @@ -70,7 +70,7 @@ describe Issues::CloseService do end describe '#close_issue' do - context "closed by a merge request" do + context "closed by a merge request", :sidekiq_might_not_need_inline do it 'mentions closure via a merge request' do perform_enqueued_jobs do described_class.new(project, user).close_issue(issue, closed_via: closing_merge_request) @@ -100,7 +100,7 @@ describe Issues::CloseService do end end - context "closed by a commit" do + context "closed by a commit", :sidekiq_might_not_need_inline do it 'mentions closure via a commit' do perform_enqueued_jobs do described_class.new(project, user).close_issue(issue, closed_via: closing_commit) @@ -146,7 +146,7 @@ describe Issues::CloseService do expect(issue.closed_by_id).to be(user.id) end - it 'sends email to user2 about assign of new issue' do + it 'sends email to user2 about assign of new issue', :sidekiq_might_not_need_inline do email = ActionMailer::Base.deliveries.last expect(email.to.first).to eq(user2.email) expect(email.subject).to include(issue.title) diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 154bfec0da2..1eec3b97ea1 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -169,7 +169,7 @@ describe Issues::UpdateService, :mailer do end end - context 'with background jobs processed' do + context 'with background jobs processed', :sidekiq_might_not_need_inline do before do perform_enqueued_jobs do update_issue(opts) @@ -366,7 +366,7 @@ describe Issues::UpdateService, :mailer do it_behaves_like 'system notes for milestones' - it 'sends notifications for subscribers of changed milestone' do + it 'sends notifications for subscribers of changed milestone', :sidekiq_might_not_need_inline do issue.milestone = create(:milestone, project: project) issue.save @@ -398,7 +398,7 @@ describe Issues::UpdateService, :mailer do it_behaves_like 'system notes for milestones' - it 'sends notifications for subscribers of changed milestone' do + it 'sends notifications for subscribers of changed milestone', :sidekiq_might_not_need_inline do perform_enqueued_jobs do update_issue(milestone: create(:milestone, project: project)) end @@ -435,7 +435,7 @@ describe Issues::UpdateService, :mailer do end end - it 'sends notifications for subscribers of newly added labels' do + it 'sends notifications for subscribers of newly added labels', :sidekiq_might_not_need_inline do opts = { label_ids: [label.id] } perform_enqueued_jobs do diff --git a/spec/services/members/destroy_service_spec.rb b/spec/services/members/destroy_service_spec.rb index effcaf53535..73ac0bd7716 100644 --- a/spec/services/members/destroy_service_spec.rb +++ b/spec/services/members/destroy_service_spec.rb @@ -45,7 +45,7 @@ describe Members::DestroyService do shared_examples 'a service destroying a member with access' do it_behaves_like 'a service destroying a member' - it 'invalidates cached counts for assigned issues and merge requests', :aggregate_failures do + it 'invalidates cached counts for assigned issues and merge requests', :aggregate_failures, :sidekiq_might_not_need_inline do create(:issue, project: group_project, assignees: [member_user]) create(:merge_request, source_project: group_project, assignees: [member_user]) create(:todo, :pending, project: group_project, user: member_user) diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb index d546a092680..61cb60e1536 100644 --- a/spec/services/merge_requests/build_service_spec.rb +++ b/spec/services/merge_requests/build_service_spec.rb @@ -130,7 +130,7 @@ describe MergeRequests::BuildService do let!(:project) { fork_project(target_project, user, namespace: user.namespace, repository: true) } let(:source_project) { project } - it 'creates compare object with target branch as default branch' do + it 'creates compare object with target branch as default branch', :sidekiq_might_not_need_inline do expect(merge_request.compare).to be_present expect(merge_request.target_branch).to eq(project.default_branch) end diff --git a/spec/services/merge_requests/close_service_spec.rb b/spec/services/merge_requests/close_service_spec.rb index 29b7e0f17e2..b037b73752e 100644 --- a/spec/services/merge_requests/close_service_spec.rb +++ b/spec/services/merge_requests/close_service_spec.rb @@ -38,7 +38,7 @@ describe MergeRequests::CloseService do .with(@merge_request, 'close') end - it 'sends email to user2 about assign of new merge_request' do + it 'sends email to user2 about assign of new merge_request', :sidekiq_might_not_need_inline do email = ActionMailer::Base.deliveries.last expect(email.to.first).to eq(user2.email) expect(email.subject).to include(merge_request.title) diff --git a/spec/services/merge_requests/create_from_issue_service_spec.rb b/spec/services/merge_requests/create_from_issue_service_spec.rb index 51a5c51f6c3..7145cfe7897 100644 --- a/spec/services/merge_requests/create_from_issue_service_spec.rb +++ b/spec/services/merge_requests/create_from_issue_service_spec.rb @@ -36,25 +36,25 @@ describe MergeRequests::CreateFromIssueService do expect(result[:message]).to eq('Invalid issue iid') end - it 'creates a branch based on issue title' do + it 'creates a branch based on issue title', :sidekiq_might_not_need_inline do service.execute expect(target_project.repository.branch_exists?(issue.to_branch_name)).to be_truthy end - it 'creates a branch using passed name' do + it 'creates a branch using passed name', :sidekiq_might_not_need_inline do service_with_custom_source_branch.execute expect(target_project.repository.branch_exists?(custom_source_branch)).to be_truthy end - it 'creates the new_merge_request system note' do + it 'creates the new_merge_request system note', :sidekiq_might_not_need_inline do expect(SystemNoteService).to receive(:new_merge_request).with(issue, project, user, instance_of(MergeRequest)) service.execute end - it 'creates the new_issue_branch system note when the branch could be created but the merge_request cannot be created' do + it 'creates the new_issue_branch system note when the branch could be created but the merge_request cannot be created', :sidekiq_might_not_need_inline do expect_any_instance_of(MergeRequest).to receive(:valid?).at_least(:once).and_return(false) expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, issue.to_branch_name, branch_project: target_project) @@ -62,35 +62,35 @@ describe MergeRequests::CreateFromIssueService do service.execute end - it 'creates a merge request' do + it 'creates a merge request', :sidekiq_might_not_need_inline do expect { service.execute }.to change(target_project.merge_requests, :count).by(1) end - it 'sets the merge request author to current user' do + it 'sets the merge request author to current user', :sidekiq_might_not_need_inline do result = service.execute expect(result[:merge_request].author).to eq(user) end - it 'sets the merge request source branch to the new issue branch' do + it 'sets the merge request source branch to the new issue branch', :sidekiq_might_not_need_inline do result = service.execute expect(result[:merge_request].source_branch).to eq(issue.to_branch_name) end - it 'sets the merge request source branch to the passed branch name' do + it 'sets the merge request source branch to the passed branch name', :sidekiq_might_not_need_inline do result = service_with_custom_source_branch.execute expect(result[:merge_request].source_branch).to eq(custom_source_branch) end - it 'sets the merge request target branch to the project default branch' do + it 'sets the merge request target branch to the project default branch', :sidekiq_might_not_need_inline do result = service.execute expect(result[:merge_request].target_branch).to eq(target_project.default_branch) end - it 'executes quick actions if the build service sets them in the description' do + it 'executes quick actions if the build service sets them in the description', :sidekiq_might_not_need_inline do allow(service).to receive(:merge_request).and_wrap_original do |m, *args| m.call(*args).tap do |merge_request| merge_request.description = "/assign #{user.to_reference}" @@ -102,7 +102,7 @@ describe MergeRequests::CreateFromIssueService do expect(result[:merge_request].assignees).to eq([user]) end - context 'when ref branch is set' do + context 'when ref branch is set', :sidekiq_might_not_need_inline do subject { described_class.new(project, user, ref: 'feature', **service_params).execute } it 'sets the merge request source branch to the new issue branch' do @@ -193,7 +193,7 @@ describe MergeRequests::CreateFromIssueService do it_behaves_like 'a service that creates a merge request from an issue' - it 'sets the merge request title to: "WIP: $issue-branch-name' do + it 'sets the merge request title to: "WIP: $issue-branch-name', :sidekiq_might_not_need_inline do result = service.execute expect(result[:merge_request].title).to eq("WIP: #{issue.to_branch_name.titleize.humanize}") diff --git a/spec/services/merge_requests/create_service_spec.rb b/spec/services/merge_requests/create_service_spec.rb index 699f2a98088..3db1471bf3c 100644 --- a/spec/services/merge_requests/create_service_spec.rb +++ b/spec/services/merge_requests/create_service_spec.rb @@ -57,7 +57,7 @@ describe MergeRequests::CreateService, :clean_gitlab_redis_shared_state do expect(Todo.where(attributes).count).to be_zero end - it 'creates exactly 1 create MR event' do + it 'creates exactly 1 create MR event', :sidekiq_might_not_need_inline do attributes = { action: Event::CREATED, target_id: merge_request.id, @@ -216,7 +216,7 @@ describe MergeRequests::CreateService, :clean_gitlab_redis_shared_state do target_project.add_maintainer(user) end - it 'create legacy detached merge request pipeline for fork merge request' do + it 'create legacy detached merge request pipeline for fork merge request', :sidekiq_might_not_need_inline do expect(merge_request.actual_head_pipeline) .to be_legacy_detached_merge_request_pipeline end @@ -477,7 +477,7 @@ describe MergeRequests::CreateService, :clean_gitlab_redis_shared_state do project.add_developer(user) end - it 'creates the merge request' do + it 'creates the merge request', :sidekiq_might_not_need_inline do merge_request = described_class.new(project, user, opts).execute expect(merge_request).to be_persisted diff --git a/spec/services/merge_requests/push_options_handler_service_spec.rb b/spec/services/merge_requests/push_options_handler_service_spec.rb index ff4cdd3e7e2..75b9c2304a6 100644 --- a/spec/services/merge_requests/push_options_handler_service_spec.rb +++ b/spec/services/merge_requests/push_options_handler_service_spec.rb @@ -46,7 +46,7 @@ describe MergeRequests::PushOptionsHandlerService do expect(last_mr.assignees).to contain_exactly(user) end - context 'when project has been forked' do + context 'when project has been forked', :sidekiq_might_not_need_inline do let(:forked_project) { fork_project(project, user, repository: true) } let(:service) { described_class.new(forked_project, user, changes, push_options) } diff --git a/spec/services/merge_requests/rebase_service_spec.rb b/spec/services/merge_requests/rebase_service_spec.rb index 7b8c94c86fe..9c535664c26 100644 --- a/spec/services/merge_requests/rebase_service_spec.rb +++ b/spec/services/merge_requests/rebase_service_spec.rb @@ -174,7 +174,7 @@ describe MergeRequests::RebaseService do target_branch: 'master', target_project: project) end - it 'rebases source branch' do + it 'rebases source branch', :sidekiq_might_not_need_inline do parent_sha = forked_project.repository.commit(merge_request_from_fork.source_branch).parents.first.sha target_branch_sha = project.repository.commit(merge_request_from_fork.target_branch).sha expect(parent_sha).to eq(target_branch_sha) diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb index 2dc932c9f2c..58302ce14ba 100644 --- a/spec/services/merge_requests/refresh_service_spec.rb +++ b/spec/services/merge_requests/refresh_service_spec.rb @@ -137,7 +137,7 @@ describe MergeRequests::RefreshService do subject { service.new(@project, @user).execute(@oldrev, @newrev, 'refs/heads/master') } - it 'updates the head_pipeline_id for @merge_request' do + it 'updates the head_pipeline_id for @merge_request', :sidekiq_might_not_need_inline do expect { subject }.to change { @merge_request.reload.head_pipeline_id }.from(nil).to(pipeline.id) end @@ -200,7 +200,7 @@ describe MergeRequests::RefreshService do context 'when service runs on forked project' do let(:project) { @fork_project } - it 'creates legacy detached merge request pipeline for fork merge request' do + it 'creates legacy detached merge request pipeline for fork merge request', :sidekiq_might_not_need_inline do expect { subject } .to change { @fork_merge_request.pipelines_for_merge_request.count }.by(1) @@ -232,7 +232,7 @@ describe MergeRequests::RefreshService do subject end - it 'sets the latest detached merge request pipeline as a head pipeline' do + it 'sets the latest detached merge request pipeline as a head pipeline', :sidekiq_might_not_need_inline do @merge_request.reload expect(@merge_request.actual_head_pipeline).to be_merge_request_event end @@ -304,7 +304,7 @@ describe MergeRequests::RefreshService do end end - context 'push to origin repo target branch' do + context 'push to origin repo target branch', :sidekiq_might_not_need_inline do context 'when all MRs to the target branch had diffs' do before do service.new(@project, @user).execute(@oldrev, @newrev, 'refs/heads/feature') @@ -354,7 +354,7 @@ describe MergeRequests::RefreshService do end end - context 'manual merge of source branch' do + context 'manual merge of source branch', :sidekiq_might_not_need_inline do before do # Merge master -> feature branch @project.repository.merge(@user, @merge_request.diff_head_sha, @merge_request, 'Test message') @@ -374,7 +374,7 @@ describe MergeRequests::RefreshService do end end - context 'push to fork repo source branch' do + context 'push to fork repo source branch', :sidekiq_might_not_need_inline do let(:refresh_service) { service.new(@fork_project, @user) } def refresh @@ -431,7 +431,7 @@ describe MergeRequests::RefreshService do end end - context 'push to fork repo target branch' do + context 'push to fork repo target branch', :sidekiq_might_not_need_inline do describe 'changes to merge requests' do before do service.new(@fork_project, @user).execute(@oldrev, @newrev, 'refs/heads/feature') @@ -457,7 +457,7 @@ describe MergeRequests::RefreshService do end end - context 'forked projects with the same source branch name as target branch' do + context 'forked projects with the same source branch name as target branch', :sidekiq_might_not_need_inline do let!(:first_commit) do @fork_project.repository.create_file(@user, 'test1.txt', 'Test data', message: 'Test commit', @@ -537,7 +537,7 @@ describe MergeRequests::RefreshService do context 'push new branch that exists in a merge request' do let(:refresh_service) { service.new(@fork_project, @user) } - it 'refreshes the merge request' do + it 'refreshes the merge request', :sidekiq_might_not_need_inline do expect(refresh_service).to receive(:execute_hooks) .with(@fork_merge_request, 'update', old_rev: Gitlab::Git::BLANK_SHA) allow_any_instance_of(Repository).to receive(:merge_base).and_return(@oldrev) diff --git a/spec/services/merge_requests/reopen_service_spec.rb b/spec/services/merge_requests/reopen_service_spec.rb index 7a98437f724..25ab79d70c3 100644 --- a/spec/services/merge_requests/reopen_service_spec.rb +++ b/spec/services/merge_requests/reopen_service_spec.rb @@ -37,7 +37,7 @@ describe MergeRequests::ReopenService do .with(merge_request, 'reopen') end - it 'sends email to user2 about reopen of merge_request' do + it 'sends email to user2 about reopen of merge_request', :sidekiq_might_not_need_inline do email = ActionMailer::Base.deliveries.last expect(email.to.first).to eq(user2.email) expect(email.subject).to include(merge_request.title) diff --git a/spec/services/merge_requests/resolved_discussion_notification_service_spec.rb b/spec/services/merge_requests/resolved_discussion_notification_service_spec.rb index 0a10a9ee13b..dc2bd5bf3d0 100644 --- a/spec/services/merge_requests/resolved_discussion_notification_service_spec.rb +++ b/spec/services/merge_requests/resolved_discussion_notification_service_spec.rb @@ -38,7 +38,7 @@ describe MergeRequests::ResolvedDiscussionNotificationService do subject.execute(merge_request) end - it "sends a notification email" do + it "sends a notification email", :sidekiq_might_not_need_inline do expect_any_instance_of(NotificationService).to receive(:resolve_all_discussions).with(merge_request, user) subject.execute(merge_request) diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index d3c4c436901..8c796475de0 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -98,7 +98,7 @@ describe MergeRequests::UpdateService, :mailer do ) end - it 'sends email to user2 about assign of new merge request and email to user3 about merge request unassignment' do + it 'sends email to user2 about assign of new merge request and email to user3 about merge request unassignment', :sidekiq_might_not_need_inline do deliveries = ActionMailer::Base.deliveries email = deliveries.last recipients = deliveries.last(2).flat_map(&:to) @@ -181,7 +181,7 @@ describe MergeRequests::UpdateService, :mailer do end end - it 'merges the MR' do + it 'merges the MR', :sidekiq_might_not_need_inline do expect(@merge_request).to be_valid expect(@merge_request.state).to eq('merged') expect(@merge_request.merge_error).to be_nil @@ -202,7 +202,7 @@ describe MergeRequests::UpdateService, :mailer do end end - it 'merges the MR' do + it 'merges the MR', :sidekiq_might_not_need_inline do expect(@merge_request).to be_valid expect(@merge_request.state).to eq('merged') end @@ -332,7 +332,7 @@ describe MergeRequests::UpdateService, :mailer do it_behaves_like 'system notes for milestones' - it 'sends notifications for subscribers of changed milestone' do + it 'sends notifications for subscribers of changed milestone', :sidekiq_might_not_need_inline do merge_request.milestone = create(:milestone, project: project) merge_request.save @@ -364,7 +364,7 @@ describe MergeRequests::UpdateService, :mailer do it_behaves_like 'system notes for milestones' - it 'sends notifications for subscribers of changed milestone' do + it 'sends notifications for subscribers of changed milestone', :sidekiq_might_not_need_inline do perform_enqueued_jobs do update_merge_request(milestone: create(:milestone, project: project)) end @@ -431,7 +431,7 @@ describe MergeRequests::UpdateService, :mailer do project.add_developer(subscriber) end - it 'sends notifications for subscribers of newly added labels' do + it 'sends notifications for subscribers of newly added labels', :sidekiq_might_not_need_inline do opts = { label_ids: [label.id] } perform_enqueued_jobs do diff --git a/spec/services/namespaces/statistics_refresher_service_spec.rb b/spec/services/namespaces/statistics_refresher_service_spec.rb index f4d9c96f7f4..9d42e917efe 100644 --- a/spec/services/namespaces/statistics_refresher_service_spec.rb +++ b/spec/services/namespaces/statistics_refresher_service_spec.rb @@ -23,7 +23,7 @@ describe Namespaces::StatisticsRefresherService, '#execute' do end end - context 'with a root storage statistics relation' do + context 'with a root storage statistics relation', :sidekiq_might_not_need_inline do before do Namespace::AggregationSchedule.safe_find_or_create_by!(namespace_id: group.id) end diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index aa67b87a645..2481cd5c006 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -682,7 +682,7 @@ describe NotificationService, :mailer do context 'when recipients for a new release exist' do let(:release) { create(:release) } - it 'calls new_release_email for each relevant recipient' do + it 'calls new_release_email for each relevant recipient', :sidekiq_might_not_need_inline do user_1 = create(:user) user_2 = create(:user) user_3 = create(:user) diff --git a/spec/services/projects/after_rename_service_spec.rb b/spec/services/projects/after_rename_service_spec.rb index 8585d495ffb..bf637b70aaf 100644 --- a/spec/services/projects/after_rename_service_spec.rb +++ b/spec/services/projects/after_rename_service_spec.rb @@ -222,7 +222,7 @@ describe Projects::AfterRenameService do def expect_repository_exist(full_path_with_extension) expect( - gitlab_shell.exists?( + TestEnv.storage_dir_exists?( project.repository_storage, full_path_with_extension ) diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb index 2331281bd8e..642986bb176 100644 --- a/spec/services/projects/destroy_service_spec.rb +++ b/spec/services/projects/destroy_service_spec.rb @@ -81,7 +81,7 @@ describe Projects::DestroyService do end let!(:async) { true } - it 'destroys them' do + it 'destroys them', :sidekiq_might_not_need_inline do expect(RemoteMirror.count).to eq(0) end end @@ -102,7 +102,7 @@ describe Projects::DestroyService do end let!(:async) { true } - it 'destroys project and export' do + it 'destroys project and export', :sidekiq_might_not_need_inline do expect { destroy_project(project_with_export, user) }.to change(ImportExportUpload, :count).by(-1) expect(Project.all).not_to include(project_with_export) @@ -153,7 +153,7 @@ describe Projects::DestroyService do end end - context 'with async_execute' do + context 'with async_execute', :sidekiq_might_not_need_inline do let(:async) { true } context 'async delete of project with private issue visibility' do @@ -346,21 +346,21 @@ describe Projects::DestroyService do let(:path) { project.disk_path + '.git' } before do - expect(project.gitlab_shell.exists?(project.repository_storage, path)).to be_truthy - expect(project.gitlab_shell.exists?(project.repository_storage, remove_path)).to be_falsey + expect(TestEnv.storage_dir_exists?(project.repository_storage, path)).to be_truthy + expect(TestEnv.storage_dir_exists?(project.repository_storage, remove_path)).to be_falsey # Dont run sidekiq to check if renamed repository exists Sidekiq::Testing.fake! { destroy_project(project, user, {}) } - expect(project.gitlab_shell.exists?(project.repository_storage, path)).to be_falsey - expect(project.gitlab_shell.exists?(project.repository_storage, remove_path)).to be_truthy + expect(TestEnv.storage_dir_exists?(project.repository_storage, path)).to be_falsey + expect(TestEnv.storage_dir_exists?(project.repository_storage, remove_path)).to be_truthy end it 'restores the repositories' do Sidekiq::Testing.fake! { described_class.new(project, user).attempt_repositories_rollback } - expect(project.gitlab_shell.exists?(project.repository_storage, path)).to be_truthy - expect(project.gitlab_shell.exists?(project.repository_storage, remove_path)).to be_falsey + expect(TestEnv.storage_dir_exists?(project.repository_storage, path)).to be_truthy + expect(TestEnv.storage_dir_exists?(project.repository_storage, remove_path)).to be_falsey end end diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 7e7e80ca240..5a3796fec3d 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -79,7 +79,7 @@ describe Projects::ForkService do expect(fork_network.projects).to contain_exactly(@from_project, to_project) end - it 'imports the repository of the forked project' do + it 'imports the repository of the forked project', :sidekiq_might_not_need_inline do to_project = fork_project(@from_project, @to_user, repository: true) expect(to_project.empty_repo?).to be_falsy diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index 31bd0f0f836..c848a5397e1 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -151,7 +151,7 @@ describe Projects::UpdateService do context 'when we update project but not enabling a wiki' do it 'does not try to create an empty wiki' do - Gitlab::Shell.new.rm_directory(project.repository_storage, project.wiki.path) + TestEnv.rm_storage_dir(project.repository_storage, project.wiki.path) result = update_project(project, user, { name: 'test1' }) @@ -172,7 +172,7 @@ describe Projects::UpdateService do context 'when enabling a wiki' do it 'creates a wiki' do project.project_feature.update(wiki_access_level: ProjectFeature::DISABLED) - Gitlab::Shell.new.rm_directory(project.repository_storage, project.wiki.path) + TestEnv.rm_storage_dir(project.repository_storage, project.wiki.path) result = update_project(project, user, project_feature_attributes: { wiki_access_level: ProjectFeature::ENABLED }) diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index 83101add724..e2ed7581ad4 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -115,51 +115,36 @@ describe SystemNoteService do end describe '.merge_when_pipeline_succeeds' do - let(:pipeline) { build(:ci_pipeline_without_jobs )} - let(:noteable) do - create(:merge_request, source_project: project, target_project: project) - end - - subject { described_class.merge_when_pipeline_succeeds(noteable, project, author, pipeline.sha) } + it 'calls MergeRequestsService' do + sha = double - it_behaves_like 'a system note' do - let(:action) { 'merge' } - end + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:merge_when_pipeline_succeeds).with(sha) + end - it "posts the 'merge when pipeline succeeds' system note" do - expect(subject.note).to match(%r{enabled an automatic merge when the pipeline for (\w+/\w+@)?\h{40} succeeds}) + described_class.merge_when_pipeline_succeeds(noteable, project, author, sha) end end describe '.cancel_merge_when_pipeline_succeeds' do - let(:noteable) do - create(:merge_request, source_project: project, target_project: project) - end - - subject { described_class.cancel_merge_when_pipeline_succeeds(noteable, project, author) } - - it_behaves_like 'a system note' do - let(:action) { 'merge' } - end + it 'calls MergeRequestsService' do + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:cancel_merge_when_pipeline_succeeds) + end - it "posts the 'merge when pipeline succeeds' system note" do - expect(subject.note).to eq "canceled the automatic merge" + described_class.cancel_merge_when_pipeline_succeeds(noteable, project, author) end end describe '.abort_merge_when_pipeline_succeeds' do - let(:noteable) do - create(:merge_request, source_project: project, target_project: project) - end + it 'calls MergeRequestsService' do + reason = double - subject { described_class.abort_merge_when_pipeline_succeeds(noteable, project, author, 'merge request was closed') } - - it_behaves_like 'a system note' do - let(:action) { 'merge' } - end + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:abort_merge_when_pipeline_succeeds).with(reason) + end - it "posts the 'merge when pipeline succeeds' system note" do - expect(subject.note).to eq "aborted the automatic merge because merge request was closed" + described_class.abort_merge_when_pipeline_succeeds(noteable, project, author, reason) end end @@ -196,77 +181,55 @@ describe SystemNoteService do end describe '.change_branch' do - subject { described_class.change_branch(noteable, project, author, 'target', old_branch, new_branch) } - - let(:old_branch) { 'old_branch'} - let(:new_branch) { 'new_branch'} - - it_behaves_like 'a system note' do - let(:action) { 'branch' } - end + it 'calls MergeRequestsService' do + old_branch = double + new_branch = double + branch_type = double - context 'when target branch name changed' do - it 'sets the note text' do - expect(subject.note).to eq "changed target branch from `#{old_branch}` to `#{new_branch}`" + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:change_branch).with(branch_type, old_branch, new_branch) end + + described_class.change_branch(noteable, project, author, branch_type, old_branch, new_branch) end end describe '.change_branch_presence' do - subject { described_class.change_branch_presence(noteable, project, author, :source, 'feature', :delete) } - - it_behaves_like 'a system note' do - let(:action) { 'branch' } - end + it 'calls MergeRequestsService' do + presence = double + branch = double + branch_type = double - context 'when source branch deleted' do - it 'sets the note text' do - expect(subject.note).to eq "deleted source branch `feature`" + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:change_branch_presence).with(branch_type, branch, presence) end + + described_class.change_branch_presence(noteable, project, author, branch_type, branch, presence) end end describe '.new_issue_branch' do - let(:branch) { '1-mepmep' } + it 'calls MergeRequestsService' do + branch = double + branch_project = double - subject { described_class.new_issue_branch(noteable, project, author, branch, branch_project: branch_project) } - - shared_examples_for 'a system note for new issue branch' do - it_behaves_like 'a system note' do - let(:action) { 'branch' } - end - - context 'when a branch is created from the new branch button' do - it 'sets the note text' do - expect(subject.note).to start_with("created branch [`#{branch}`]") - end + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:new_issue_branch).with(branch, branch_project: branch_project) end - end - context 'branch_project is set' do - let(:branch_project) { create(:project, :repository) } - - it_behaves_like 'a system note for new issue branch' - end - - context 'branch_project is not set' do - let(:branch_project) { nil } - - it_behaves_like 'a system note for new issue branch' + described_class.new_issue_branch(noteable, project, author, branch, branch_project: branch_project) end end describe '.new_merge_request' do - subject { described_class.new_merge_request(noteable, project, author, merge_request) } - - let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + it 'calls MergeRequestsService' do + merge_request = double - it_behaves_like 'a system note' do - let(:action) { 'merge' } - end + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:new_merge_request).with(merge_request) + end - it 'sets the new merge request note text' do - expect(subject.note).to eq("created merge request #{merge_request.to_reference(project)} to address this issue") + described_class.new_merge_request(noteable, project, author, merge_request) end end @@ -642,57 +605,24 @@ describe SystemNoteService do end describe '.handle_merge_request_wip' do - context 'adding wip note' do - let(:noteable) { create(:merge_request, source_project: project, title: 'WIP Lorem ipsum') } - - subject { described_class.handle_merge_request_wip(noteable, project, author) } - - it_behaves_like 'a system note' do - let(:action) { 'title' } + it 'calls MergeRequestsService' do + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:handle_merge_request_wip) end - it 'sets the note text' do - expect(subject.note).to eq 'marked as a **Work In Progress**' - end - end - - context 'removing wip note' do - let(:noteable) { create(:merge_request, source_project: project, title: 'Lorem ipsum') } - - subject { described_class.handle_merge_request_wip(noteable, project, author) } - - it_behaves_like 'a system note' do - let(:action) { 'title' } - end - - it 'sets the note text' do - expect(subject.note).to eq 'unmarked as a **Work In Progress**' - end + described_class.handle_merge_request_wip(noteable, project, author) end end describe '.add_merge_request_wip_from_commit' do - let(:noteable) do - create(:merge_request, source_project: project, target_project: project) - end - - subject do - described_class.add_merge_request_wip_from_commit( - noteable, - project, - author, - noteable.diff_head_commit - ) - end + it 'calls MergeRequestsService' do + commit = double - it_behaves_like 'a system note' do - let(:action) { 'title' } - end + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:add_merge_request_wip_from_commit).with(commit) + end - it "posts the 'marked as a Work In Progress from commit' system note" do - expect(subject.note).to match( - /marked as a \*\*Work In Progress\*\* from #{Commit.reference_pattern}/ - ) + described_class.add_merge_request_wip_from_commit(noteable, project, author, commit) end end @@ -709,75 +639,25 @@ describe SystemNoteService do end describe '.resolve_all_discussions' do - let(:noteable) { create(:merge_request, source_project: project, target_project: project) } - - subject { described_class.resolve_all_discussions(noteable, project, author) } - - it_behaves_like 'a system note' do - let(:action) { 'discussion' } - end + it 'calls MergeRequestsService' do + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:resolve_all_discussions) + end - it 'sets the note text' do - expect(subject.note).to eq 'resolved all threads' + described_class.resolve_all_discussions(noteable, project, author) end end describe '.diff_discussion_outdated' do - let(:discussion) { create(:diff_note_on_merge_request, project: project).to_discussion } - let(:merge_request) { discussion.noteable } - let(:change_position) { discussion.position } + it 'calls MergeRequestsService' do + discussion = double + change_position = double - def reloaded_merge_request - MergeRequest.find(merge_request.id) - end - - subject { described_class.diff_discussion_outdated(discussion, project, author, change_position) } - - it_behaves_like 'a system note' do - let(:expected_noteable) { discussion.first_note.noteable } - let(:action) { 'outdated' } - end - - context 'when the change_position is valid for the discussion' do - it 'creates a new note in the discussion' do - # we need to completely rebuild the merge request object, or the `@discussions` on the merge request are not reloaded. - expect { subject }.to change { reloaded_merge_request.discussions.first.notes.size }.by(1) - end - - it 'links to the diff in the system note' do - diff_id = merge_request.merge_request_diff.id - line_code = change_position.line_code(project.repository) - link = diffs_project_merge_request_path(project, merge_request, diff_id: diff_id, anchor: line_code) - - expect(subject.note).to eq("changed this line in [version 1 of the diff](#{link})") + expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service| + expect(service).to receive(:diff_discussion_outdated).with(discussion, change_position) end - context 'discussion is on an image' do - let(:discussion) { create(:image_diff_note_on_merge_request, project: project).to_discussion } - - it 'links to the diff in the system note' do - diff_id = merge_request.merge_request_diff.id - file_hash = change_position.file_hash - link = diffs_project_merge_request_path(project, merge_request, diff_id: diff_id, anchor: file_hash) - - expect(subject.note).to eq("changed this file in [version 1 of the diff](#{link})") - end - end - end - - context 'when the change_position does not point to a valid version' do - before do - allow(merge_request).to receive(:version_params_for).and_return(nil) - end - - it 'creates a new note in the discussion' do - # we need to completely rebuild the merge request object, or the `@discussions` on the merge request are not reloaded. - expect { subject }.to change { reloaded_merge_request.discussions.first.notes.size }.by(1) - end - - it 'does not create a link' do - expect(subject.note).to eq('changed this line in version 1 of the diff') - end + described_class.diff_discussion_outdated(discussion, project, author, change_position) end end diff --git a/spec/services/system_notes/issuables_service_spec.rb b/spec/services/system_notes/issuables_service_spec.rb index 5023abad4cd..ba484d95c9c 100644 --- a/spec/services/system_notes/issuables_service_spec.rb +++ b/spec/services/system_notes/issuables_service_spec.rb @@ -395,7 +395,7 @@ describe ::SystemNotes::IssuablesService do end end - context 'commit with cross-reference from fork' do + context 'commit with cross-reference from fork', :sidekiq_might_not_need_inline do let(:author2) { create(:project_member, :reporter, user: create(:user), project: project).user } let(:forked_project) { fork_project(project, author2, repository: true) } let(:commit2) { forked_project.commit } diff --git a/spec/services/system_notes/merge_requests_service_spec.rb b/spec/services/system_notes/merge_requests_service_spec.rb new file mode 100644 index 00000000000..cccc2818676 --- /dev/null +++ b/spec/services/system_notes/merge_requests_service_spec.rb @@ -0,0 +1,243 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe ::SystemNotes::MergeRequestsService do + include Gitlab::Routing + + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, :repository, group: group) } + let_it_be(:author) { create(:user) } + + let(:noteable) { create(:merge_request, source_project: project, target_project: project) } + + let(:service) { described_class.new(noteable: noteable, project: project, author: author) } + + describe '.merge_when_pipeline_succeeds' do + let(:pipeline) { build(:ci_pipeline_without_jobs )} + + subject { service.merge_when_pipeline_succeeds(pipeline.sha) } + + it_behaves_like 'a system note' do + let(:action) { 'merge' } + end + + it "posts the 'merge when pipeline succeeds' system note" do + expect(subject.note).to match(%r{enabled an automatic merge when the pipeline for (\w+/\w+@)?\h{40} succeeds}) + end + end + + describe '.cancel_merge_when_pipeline_succeeds' do + subject { service.cancel_merge_when_pipeline_succeeds } + + it_behaves_like 'a system note' do + let(:action) { 'merge' } + end + + it "posts the 'merge when pipeline succeeds' system note" do + expect(subject.note).to eq "canceled the automatic merge" + end + end + + describe '.abort_merge_when_pipeline_succeeds' do + subject { service.abort_merge_when_pipeline_succeeds('merge request was closed') } + + it_behaves_like 'a system note' do + let(:action) { 'merge' } + end + + it "posts the 'merge when pipeline succeeds' system note" do + expect(subject.note).to eq "aborted the automatic merge because merge request was closed" + end + end + + describe '.handle_merge_request_wip' do + context 'adding wip note' do + let(:noteable) { create(:merge_request, source_project: project, title: 'WIP Lorem ipsum') } + + subject { service.handle_merge_request_wip } + + it_behaves_like 'a system note' do + let(:action) { 'title' } + end + + it 'sets the note text' do + expect(subject.note).to eq 'marked as a **Work In Progress**' + end + end + + context 'removing wip note' do + subject { service.handle_merge_request_wip } + + it_behaves_like 'a system note' do + let(:action) { 'title' } + end + + it 'sets the note text' do + expect(subject.note).to eq 'unmarked as a **Work In Progress**' + end + end + end + + describe '.add_merge_request_wip_from_commit' do + subject { service.add_merge_request_wip_from_commit(noteable.diff_head_commit) } + + it_behaves_like 'a system note' do + let(:action) { 'title' } + end + + it "posts the 'marked as a Work In Progress from commit' system note" do + expect(subject.note).to match( + /marked as a \*\*Work In Progress\*\* from #{Commit.reference_pattern}/ + ) + end + end + + describe '.resolve_all_discussions' do + subject { service.resolve_all_discussions } + + it_behaves_like 'a system note' do + let(:action) { 'discussion' } + end + + it 'sets the note text' do + expect(subject.note).to eq 'resolved all threads' + end + end + + describe '.diff_discussion_outdated' do + let(:discussion) { create(:diff_note_on_merge_request, project: project).to_discussion } + let(:merge_request) { discussion.noteable } + let(:change_position) { discussion.position } + + def reloaded_merge_request + MergeRequest.find(merge_request.id) + end + + let(:service) { described_class.new(project: project, author: author) } + + subject { service.diff_discussion_outdated(discussion, change_position) } + + it_behaves_like 'a system note' do + let(:expected_noteable) { discussion.first_note.noteable } + let(:action) { 'outdated' } + end + + context 'when the change_position is valid for the discussion' do + it 'creates a new note in the discussion' do + # we need to completely rebuild the merge request object, or the `@discussions` on the merge request are not reloaded. + expect { subject }.to change { reloaded_merge_request.discussions.first.notes.size }.by(1) + end + + it 'links to the diff in the system note' do + diff_id = merge_request.merge_request_diff.id + line_code = change_position.line_code(project.repository) + link = diffs_project_merge_request_path(project, merge_request, diff_id: diff_id, anchor: line_code) + + expect(subject.note).to eq("changed this line in [version 1 of the diff](#{link})") + end + + context 'discussion is on an image' do + let(:discussion) { create(:image_diff_note_on_merge_request, project: project).to_discussion } + + it 'links to the diff in the system note' do + diff_id = merge_request.merge_request_diff.id + file_hash = change_position.file_hash + link = diffs_project_merge_request_path(project, merge_request, diff_id: diff_id, anchor: file_hash) + + expect(subject.note).to eq("changed this file in [version 1 of the diff](#{link})") + end + end + end + + context 'when the change_position does not point to a valid version' do + before do + allow(merge_request).to receive(:version_params_for).and_return(nil) + end + + it 'creates a new note in the discussion' do + # we need to completely rebuild the merge request object, or the `@discussions` on the merge request are not reloaded. + expect { subject }.to change { reloaded_merge_request.discussions.first.notes.size }.by(1) + end + + it 'does not create a link' do + expect(subject.note).to eq('changed this line in version 1 of the diff') + end + end + end + + describe '.change_branch' do + subject { service.change_branch('target', old_branch, new_branch) } + + let(:old_branch) { 'old_branch'} + let(:new_branch) { 'new_branch'} + + it_behaves_like 'a system note' do + let(:action) { 'branch' } + end + + context 'when target branch name changed' do + it 'sets the note text' do + expect(subject.note).to eq "changed target branch from `#{old_branch}` to `#{new_branch}`" + end + end + end + + describe '.change_branch_presence' do + subject { service.change_branch_presence(:source, 'feature', :delete) } + + it_behaves_like 'a system note' do + let(:action) { 'branch' } + end + + context 'when source branch deleted' do + it 'sets the note text' do + expect(subject.note).to eq "deleted source branch `feature`" + end + end + end + + describe '.new_issue_branch' do + let(:branch) { '1-mepmep' } + + subject { service.new_issue_branch(branch, branch_project: branch_project) } + + shared_examples_for 'a system note for new issue branch' do + it_behaves_like 'a system note' do + let(:action) { 'branch' } + end + + context 'when a branch is created from the new branch button' do + it 'sets the note text' do + expect(subject.note).to start_with("created branch [`#{branch}`]") + end + end + end + + context 'branch_project is set' do + let(:branch_project) { create(:project, :repository) } + + it_behaves_like 'a system note for new issue branch' + end + + context 'branch_project is not set' do + let(:branch_project) { nil } + + it_behaves_like 'a system note for new issue branch' + end + end + + describe '.new_merge_request' do + subject { service.new_merge_request(merge_request) } + + let!(:merge_request) { create(:merge_request, source_project: project, source_branch: generate(:branch), target_project: project) } + + it_behaves_like 'a system note' do + let(:action) { 'merge' } + end + + it 'sets the new merge request note text' do + expect(subject.note).to eq("created merge request #{merge_request.to_reference(project)} to address this issue") + end + end +end diff --git a/spec/support/cycle_analytics_helpers/test_generation.rb b/spec/support/cycle_analytics_helpers/test_generation.rb index c57abbd96c6..2096ec90c5b 100644 --- a/spec/support/cycle_analytics_helpers/test_generation.rb +++ b/spec/support/cycle_analytics_helpers/test_generation.rb @@ -29,7 +29,7 @@ module CycleAnalyticsHelpers scenarios.each do |start_time_conditions, end_time_conditions| context "start condition: #{start_time_conditions.map(&:first).to_sentence}" do context "end condition: #{end_time_conditions.map(&:first).to_sentence}" do - it "finds the median of available durations between the two conditions" do + it "finds the median of available durations between the two conditions", :sidekiq_might_not_need_inline do time_differences = Array.new(5) do |index| data = data_fn[self] start_time = (index * 10).days.from_now diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index a409dd2ef26..538380a625c 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -243,6 +243,22 @@ module TestEnv FileUtils.chmod_R 0755, target_repo_path end + def rm_storage_dir(storage, dir) + Gitlab::GitalyClient::StorageSettings.allow_disk_access do + repos_path = Gitlab.config.repositories.storages[storage].legacy_disk_path + target_repo_refs_path = File.join(repos_path, dir) + FileUtils.remove_dir(target_repo_refs_path) + end + rescue Errno::ENOENT + end + + def storage_dir_exists?(storage, dir) + Gitlab::GitalyClient::StorageSettings.allow_disk_access do + repos_path = Gitlab.config.repositories.storages[storage].legacy_disk_path + File.exist?(File.join(repos_path, dir)) + end + end + def create_bare_repository(path) FileUtils.mkdir_p(path) diff --git a/spec/support/shared_examples/models/with_uploads_shared_examples.rb b/spec/support/shared_examples/models/with_uploads_shared_examples.rb index 822836c771e..3d622ba8195 100644 --- a/spec/support/shared_examples/models/with_uploads_shared_examples.rb +++ b/spec/support/shared_examples/models/with_uploads_shared_examples.rb @@ -18,7 +18,7 @@ shared_examples_for 'model with uploads' do |supports_fileuploads| end end - context 'with not mounted uploads', :sidekiq, skip: !supports_fileuploads do + context 'with not mounted uploads', :sidekiq_might_not_need_inline, skip: !supports_fileuploads do context 'with local files' do let!(:uploads) { create_list(:upload, 2, uploader: FileUploader, model: model_object) } diff --git a/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb index ac7c17915de..a77d729aa2c 100644 --- a/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb @@ -7,7 +7,7 @@ shared_examples 'merge quick action' do visit project_merge_request_path(project, merge_request) end - it 'merges the MR' do + it 'merges the MR', :sidekiq_might_not_need_inline do add_note("/merge") expect(page).to have_content 'Scheduled to merge this merge request when the pipeline succeeds.' diff --git a/spec/support/shared_examples/requests/api/notes.rb b/spec/support/shared_examples/requests/api/notes.rb index 354ae7288b1..4ce78d885bc 100644 --- a/spec/support/shared_examples/requests/api/notes.rb +++ b/spec/support/shared_examples/requests/api/notes.rb @@ -139,7 +139,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name| expect(response).to have_gitlab_http_status(401) end - it "creates an activity event when a note is created" do + it "creates an activity event when a note is created", :sidekiq_might_not_need_inline do expect(Event).to receive(:create!) post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes", user), params: { body: 'hi!' } diff --git a/spec/support/shared_examples/updating_mentions_shared_examples.rb b/spec/support/shared_examples/updating_mentions_shared_examples.rb index 9a8f8012762..3295ab72987 100644 --- a/spec/support/shared_examples/updating_mentions_shared_examples.rb +++ b/spec/support/shared_examples/updating_mentions_shared_examples.rb @@ -27,7 +27,7 @@ RSpec.shared_examples 'updating mentions' do |service_class| update_mentionable(title: "For #{mentioned_user.to_reference}") end - it 'emails only the newly-mentioned user' do + it 'emails only the newly-mentioned user', :sidekiq_might_not_need_inline do should_only_email(mentioned_user) end end @@ -37,7 +37,7 @@ RSpec.shared_examples 'updating mentions' do |service_class| update_mentionable(description: "For #{mentioned_user.to_reference}") end - it 'emails only the newly-mentioned user' do + it 'emails only the newly-mentioned user', :sidekiq_might_not_need_inline do should_only_email(mentioned_user) end end @@ -51,7 +51,7 @@ RSpec.shared_examples 'updating mentions' do |service_class| ) end - it 'emails group members' do + it 'emails group members', :sidekiq_might_not_need_inline do should_email(mentioned_user) should_email(group_member1) should_email(group_member2) @@ -81,7 +81,7 @@ RSpec.shared_examples 'updating mentions' do |service_class| ) end - it 'emails mentioned user' do + it 'emails mentioned user', :sidekiq_might_not_need_inline do should_only_email(mentioned_user) end end diff --git a/spec/support/sidekiq.rb b/spec/support/sidekiq.rb index 585c458a64e..246efedc7e5 100644 --- a/spec/support/sidekiq.rb +++ b/spec/support/sidekiq.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'sidekiq/testing/inline' +require 'sidekiq/testing' # If Sidekiq::Testing.inline! is used, SQL transactions done inside # Sidekiq worker are included in the SQL query limit (in a real @@ -27,7 +27,9 @@ Sidekiq::Testing.server_middleware do |chain| end RSpec.configure do |config| - config.after(:each, :sidekiq) do + config.around(:each, :sidekiq) do |example| + Sidekiq::Worker.clear_all + example.run Sidekiq::Worker.clear_all end @@ -36,4 +38,19 @@ RSpec.configure do |config| 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/uploaders/workers/object_storage/background_move_worker_spec.rb b/spec/uploaders/workers/object_storage/background_move_worker_spec.rb index cf4872d6904..38b70d33993 100644 --- a/spec/uploaders/workers/object_storage/background_move_worker_spec.rb +++ b/spec/uploaders/workers/object_storage/background_move_worker_spec.rb @@ -22,7 +22,7 @@ describe ObjectStorage::BackgroundMoveWorker do stub_lfs_object_storage(background_upload: true) end - it 'uploads object to storage' do + it 'uploads object to storage', :sidekiq_might_not_need_inline do expect { perform }.to change { lfs_object.reload.file_store }.from(local).to(remote) end @@ -65,7 +65,7 @@ describe ObjectStorage::BackgroundMoveWorker do stub_artifacts_object_storage(background_upload: true) end - it "migrates file to remote storage" do + it "migrates file to remote storage", :sidekiq_might_not_need_inline do perform expect(artifact.reload.file_store).to eq(remote) @@ -91,7 +91,7 @@ describe ObjectStorage::BackgroundMoveWorker do let(:subject_class) { project.class } let(:subject_id) { project.id } - it "migrates file to remote storage" do + it "migrates file to remote storage", :sidekiq_might_not_need_inline do perform project.reload BatchLoader::Executor.clear_current @@ -104,7 +104,7 @@ describe ObjectStorage::BackgroundMoveWorker do let(:subject_class) { Upload } let(:subject_id) { project.avatar.upload.id } - it "migrates file to remote storage" do + it "migrates file to remote storage", :sidekiq_might_not_need_inline do perform expect(project.reload.avatar).not_to be_file_storage diff --git a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb index 71d74b06f85..755a40a7e4c 100644 --- a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'projects/merge_requests/_commits.html.haml' do +describe 'projects/merge_requests/_commits.html.haml', :sidekiq_might_not_need_inline do include Devise::Test::ControllerHelpers include ProjectForksHelper diff --git a/spec/workers/hashed_storage/migrator_worker_spec.rb b/spec/workers/hashed_storage/migrator_worker_spec.rb index 12c1a26104e..9180da87058 100644 --- a/spec/workers/hashed_storage/migrator_worker_spec.rb +++ b/spec/workers/hashed_storage/migrator_worker_spec.rb @@ -15,7 +15,7 @@ describe HashedStorage::MigratorWorker do worker.perform(5, 10) end - it 'migrates projects in the specified range' do + it 'migrates projects in the specified range', :sidekiq_might_not_need_inline do perform_enqueued_jobs do worker.perform(ids.min, ids.max) end diff --git a/spec/workers/hashed_storage/rollbacker_worker_spec.rb b/spec/workers/hashed_storage/rollbacker_worker_spec.rb index 5fcb1adf9ae..3ca2601df0f 100644 --- a/spec/workers/hashed_storage/rollbacker_worker_spec.rb +++ b/spec/workers/hashed_storage/rollbacker_worker_spec.rb @@ -15,7 +15,7 @@ describe HashedStorage::RollbackerWorker do worker.perform(5, 10) end - it 'rollsback projects in the specified range' do + it 'rollsback projects in the specified range', :sidekiq_might_not_need_inline do perform_enqueued_jobs do worker.perform(ids.min, ids.max) end diff --git a/spec/workers/pipeline_schedule_worker_spec.rb b/spec/workers/pipeline_schedule_worker_spec.rb index 9326db34209..4926c14a6ab 100644 --- a/spec/workers/pipeline_schedule_worker_spec.rb +++ b/spec/workers/pipeline_schedule_worker_spec.rb @@ -28,7 +28,7 @@ describe PipelineScheduleWorker do context 'when there is a scheduled pipeline within next_run_at' do shared_examples 'successful scheduling' do - it 'creates a new pipeline' do + it 'creates a new pipeline', :sidekiq_might_not_need_inline do expect { subject }.to change { project.ci_pipelines.count }.by(1) expect(Ci::Pipeline.last).to be_schedule diff --git a/spec/workers/project_cache_worker_spec.rb b/spec/workers/project_cache_worker_spec.rb index 7f3c4881b89..fa02762d716 100644 --- a/spec/workers/project_cache_worker_spec.rb +++ b/spec/workers/project_cache_worker_spec.rb @@ -105,7 +105,7 @@ describe ProjectCacheWorker do end context 'when a lease could be obtained' do - it 'updates the project statistics twice' do + it 'updates the project statistics twice', :sidekiq_might_not_need_inline do stub_exclusive_lease(lease_key, timeout: lease_timeout) expect(Projects::UpdateStatisticsService).to receive(:new) diff --git a/spec/workers/repository_check/single_repository_worker_spec.rb b/spec/workers/repository_check/single_repository_worker_spec.rb index 65e1c5e9d5d..6870e15424f 100644 --- a/spec/workers/repository_check/single_repository_worker_spec.rb +++ b/spec/workers/repository_check/single_repository_worker_spec.rb @@ -68,7 +68,7 @@ describe RepositoryCheck::SingleRepositoryWorker do it 'creates missing wikis' do project = create(:project, :wiki_enabled) - Gitlab::Shell.new.rm_directory(project.repository_storage, project.wiki.path) + TestEnv.rm_storage_dir(project.repository_storage, project.wiki.path) subject.perform(project.id) @@ -77,12 +77,12 @@ describe RepositoryCheck::SingleRepositoryWorker do it 'does not create a wiki if the main repo does not exist at all' do project = create(:project, :repository) - Gitlab::Shell.new.rm_directory(project.repository_storage, project.path) - Gitlab::Shell.new.rm_directory(project.repository_storage, project.wiki.path) + TestEnv.rm_storage_dir(project.repository_storage, project.path) + TestEnv.rm_storage_dir(project.repository_storage, project.wiki.path) subject.perform(project.id) - expect(Gitlab::Shell.new.exists?(project.repository_storage, project.wiki.path)).to eq(false) + expect(TestEnv.storage_dir_exists?(project.repository_storage, project.wiki.path)).to eq(false) end def create_push_event(project) diff --git a/spec/workers/stuck_merge_jobs_worker_spec.rb b/spec/workers/stuck_merge_jobs_worker_spec.rb index 09efed6d2cf..8ceaf1fc555 100644 --- a/spec/workers/stuck_merge_jobs_worker_spec.rb +++ b/spec/workers/stuck_merge_jobs_worker_spec.rb @@ -22,7 +22,7 @@ describe StuckMergeJobsWorker do expect(mr_without_sha.merge_jid).to be_nil end - it 'updates merge request to opened when locked but has not been merged' do + it 'updates merge request to opened when locked but has not been merged', :sidekiq_might_not_need_inline do allow(Gitlab::SidekiqStatus).to receive(:completed_jids).and_return(%w(123)) merge_request = create(:merge_request, :locked, merge_jid: '123', state: :locked) pipeline = create(:ci_empty_pipeline, project: merge_request.project, ref: merge_request.source_branch, sha: merge_request.source_branch_sha) |