diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 00:09:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 00:09:58 +0300 |
commit | 919e3e3cd83e76dba137ef9bcc4746214c2085ff (patch) | |
tree | 4e9799b9c6193583896ea1f05137815ff9782796 /spec | |
parent | 6cae2159b8ce1e84fad48f3dbd5368995cbd87b1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
51 files changed, 175 insertions, 60 deletions
diff --git a/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json b/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json index 01c6563f76a..7d96b5faea3 100644 --- a/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json +++ b/spec/contracts/contracts/project/pipelines/index/pipelines#index-get_list_project_pipelines.json @@ -329,9 +329,6 @@ "match": "regex", "regex": "^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d(:?[0-5]\\d)?|Z)$" }, - "$.body.pipelines[*].details.name": { - "match": "type" - }, "$.body.pipelines[*].details.manual_actions": { "min": 1 }, diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb index 9984e989640..406a3604b23 100644 --- a/spec/controllers/import/github_controller_spec.rb +++ b/spec/controllers/import/github_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Import::GithubController, feature_category: :import do +RSpec.describe Import::GithubController, feature_category: :importers do include ImportSpecHelper let(:provider) { :github } @@ -419,4 +419,56 @@ RSpec.describe Import::GithubController, feature_category: :import do end end end + + describe 'POST cancel_all' do + context 'when import is in progress' do + it 'returns success' do + project = create(:project, :import_scheduled, namespace: user.namespace, import_type: 'github', import_url: 'https://fake.url') + project2 = create(:project, :import_started, namespace: user.namespace, import_type: 'github', import_url: 'https://fake2.url') + + expect(Import::Github::CancelProjectImportService) + .to receive(:new).with(project, user) + .and_return(double(execute: { status: :success, project: project })) + + expect(Import::Github::CancelProjectImportService) + .to receive(:new).with(project2, user) + .and_return(double(execute: { status: :bad_request, message: 'The import cannot be canceled because it is finished' })) + + post :cancel_all + + expect(json_response).to eq([ + { + 'id' => project.id, + 'status' => 'success' + }, + { + 'id' => project2.id, + 'status' => 'bad_request', + 'error' => 'The import cannot be canceled because it is finished' + } + ]) + end + end + + context 'when there is no imports in progress' do + it 'returns an empty array' do + create(:project, :import_finished, namespace: user.namespace, import_type: 'github', import_url: 'https://fake.url') + + post :cancel_all + + expect(json_response).to eq([]) + end + end + + context 'when there is no projects created by user' do + it 'returns an empty array' do + other_user_project = create(:project, :import_started, import_type: 'github', import_url: 'https://fake.url') + + post :cancel_all + + expect(json_response).to eq([]) + expect(other_user_project.import_status).to eq('started') + end + end + end end diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 55a73796d9d..b217b100349 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe RegistrationsController, feature_category: :users do +RSpec.describe RegistrationsController, feature_category: :user_profile do include TermsHelper include FullNameHelper diff --git a/spec/features/merge_request/user_can_see_draft_toggle_spec.rb b/spec/features/merge_request/user_can_see_draft_toggle_spec.rb index 0282c954225..ac7b5cdab04 100644 --- a/spec/features/merge_request/user_can_see_draft_toggle_spec.rb +++ b/spec/features/merge_request/user_can_see_draft_toggle_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Merge request > User sees draft toggle', feature_category: :code_review do +RSpec.describe 'Merge request > User sees draft toggle', feature_category: :code_review_workflow do let_it_be(:project) { create(:project, :public, :repository) } let(:user) { project.creator } diff --git a/spec/features/projects/issues/email_participants_spec.rb b/spec/features/projects/issues/email_participants_spec.rb index fdfd926b763..753c4ea18c5 100644 --- a/spec/features/projects/issues/email_participants_spec.rb +++ b/spec/features/projects/issues/email_participants_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'viewing an issue', :js, feature_category: :issue_email_participants do +RSpec.describe 'viewing an issue', :js, feature_category: :service_desk do let_it_be(:user) { create(:user) } let_it_be(:non_member) { create(:user) } let_it_be(:project) { create(:project, :public) } diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index f2c575231ad..06e48bc82c0 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > Create Snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > Create Snippet', :js, feature_category: :source_code_management do include DropzoneHelper include Spec::Support::Helpers::Features::SnippetSpecHelpers diff --git a/spec/features/projects/snippets/show_spec.rb b/spec/features/projects/snippets/show_spec.rb index 1a480696b4e..12018b4b9d7 100644 --- a/spec/features/projects/snippets/show_spec.rb +++ b/spec/features/projects/snippets/show_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > Project snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > Project snippet', :js, feature_category: :source_code_management do let_it_be(:user) { create(:user) } let_it_be(:project) do create(:project, creator: user).tap do |p| diff --git a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb index 556f549f86c..a153298da8e 100644 --- a/spec/features/projects/snippets/user_comments_on_snippet_spec.rb +++ b/spec/features/projects/snippets/user_comments_on_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User comments on a snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User comments on a snippet', :js, feature_category: :source_code_management do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } let_it_be(:snippet) { create(:project_snippet, :repository, project: project, author: user) } diff --git a/spec/features/projects/snippets/user_deletes_snippet_spec.rb b/spec/features/projects/snippets/user_deletes_snippet_spec.rb index c9d1afb7a4e..6a825fe18de 100644 --- a/spec/features/projects/snippets/user_deletes_snippet_spec.rb +++ b/spec/features/projects/snippets/user_deletes_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User deletes a snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User deletes a snippet', :js, feature_category: :source_code_management do let(:project) { create(:project) } let!(:snippet) { create(:project_snippet, :repository, project: project, author: user) } let(:user) { create(:user) } diff --git a/spec/features/projects/snippets/user_updates_snippet_spec.rb b/spec/features/projects/snippets/user_updates_snippet_spec.rb index 205db6c08b1..014bf63c696 100644 --- a/spec/features/projects/snippets/user_updates_snippet_spec.rb +++ b/spec/features/projects/snippets/user_updates_snippet_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User updates a snippet', :js, feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User updates a snippet', :js, feature_category: :source_code_management do include Spec::Support::Helpers::Features::SnippetSpecHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/snippets/user_views_snippets_spec.rb b/spec/features/projects/snippets/user_views_snippets_spec.rb index ece65763ea5..a6d1db2b02f 100644 --- a/spec/features/projects/snippets/user_views_snippets_spec.rb +++ b/spec/features/projects/snippets/user_views_snippets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Snippets > User views snippets', feature_category: :snippets do +RSpec.describe 'Projects > Snippets > User views snippets', feature_category: :source_code_management do let_it_be(:project) { create(:project) } let(:user) { create(:user) } diff --git a/spec/features/snippets_spec.rb b/spec/features/snippets_spec.rb index 2ccdb68e844..dde2f0fcfaa 100644 --- a/spec/features/snippets_spec.rb +++ b/spec/features/snippets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Snippets', feature_category: :snippets do +RSpec.describe 'Snippets', feature_category: :source_code_management do context 'when the project has snippets' do let(:project) { create(:project, :public) } let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.first_owner, project: project) } diff --git a/spec/features/users/snippets_spec.rb b/spec/features/users/snippets_spec.rb index 0d6bb0823b6..2876351be37 100644 --- a/spec/features/users/snippets_spec.rb +++ b/spec/features/users/snippets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Snippets tab on a user profile', :js, feature_category: :snippets do +RSpec.describe 'Snippets tab on a user profile', :js, feature_category: :source_code_management do context 'when the user has snippets' do let(:user) { create(:user) } diff --git a/spec/frontend/pipelines/mock_data.js b/spec/frontend/pipelines/mock_data.js index 36bce65dd56..dd7e81f3f22 100644 --- a/spec/frontend/pipelines/mock_data.js +++ b/spec/frontend/pipelines/mock_data.js @@ -837,7 +837,6 @@ export const mockPipelineTag = () => { duration: 93, finished_at: '2022-02-02T15:40:59.384Z', event_type_name: 'Pipeline', - name: 'Pipeline', manual_actions: [], scheduled_actions: [], }, @@ -1045,7 +1044,6 @@ export const mockPipelineBranch = () => { duration: 75, finished_at: '2022-01-14T18:02:35.842Z', event_type_name: 'Pipeline', - name: 'Pipeline', manual_actions: [], scheduled_actions: [], }, diff --git a/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js b/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js index 9c348fc9d58..441054493f7 100644 --- a/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/mr_widget_pipeline_spec.js @@ -224,7 +224,6 @@ describe('MRWidgetPipeline', () => { ({ pipeline } = JSON.parse(JSON.stringify(mockData))); pipeline.details.event_type_name = 'Pipeline'; - pipeline.details.name = 'Pipeline'; pipeline.merge_request_event_type = undefined; pipeline.ref.tag = false; pipeline.ref.branch = false; @@ -266,7 +265,6 @@ describe('MRWidgetPipeline', () => { describe('for a detached merge request pipeline', () => { it('renders a pipeline widget that reads "Merge request pipeline <ID> <status> for <SHA>"', () => { pipeline.details.event_type_name = 'Merge request pipeline'; - pipeline.details.name = 'Merge request pipeline'; pipeline.merge_request_event_type = 'detached'; factory(); diff --git a/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb b/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb index 4a0501bddbd..7fb45e93474 100644 --- a/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb +++ b/spec/graphql/mutations/ci/job_token_scope/remove_project_spec.rb @@ -17,6 +17,7 @@ RSpec.describe Mutations::Ci::JobTokenScope::RemoveProject, feature_category: :c end let(:target_project_path) { target_project.full_path } + let(:links_relation) { Ci::JobToken::ProjectScopeLink.with_source(project).with_target(target_project) } subject do mutation.resolve(project_path: project.full_path, target_project_path: target_project_path) @@ -45,18 +46,39 @@ RSpec.describe Mutations::Ci::JobTokenScope::RemoveProject, feature_category: :c target_project.add_guest(current_user) end - it 'removes target project from the job token scope' do - expect do - expect(subject).to include(ci_job_token_scope: be_present, errors: be_empty) - end.to change { Ci::JobToken::ProjectScopeLink.count }.by(-1) + context 'with no direction specified' do + it 'defaults to removing an outbound link to the target project' do + expect do + expect(subject).to include(ci_job_token_scope: be_present, errors: be_empty) + end.to change { Ci::JobToken::ProjectScopeLink.count }.by(-1) + + expect(links_relation.outbound.reload).to be_empty + end + end + + context 'with direction specified' do + let(:service) { instance_double('Ci::JobTokenScope::RemoveProjectService') } + + subject do + mutation.resolve(project_path: project.full_path, target_project_path: target_project_path, direction: 'inbound') + end + + it 'executes project removal for the correct direction' do + expect(::Ci::JobTokenScope::RemoveProjectService) + .to receive(:new).with(project, current_user).and_return(service) + expect(service).to receive(:execute).with(target_project, direction: 'inbound') + .and_return(instance_double('ServiceResponse', "success?": true)) + + subject + end end context 'when the service returns an error' do - let(:service) { double(:service) } + let(:service) { instance_double('Ci::JobTokenScope::RemoveProjectService') } it 'returns an error response' do expect(::Ci::JobTokenScope::RemoveProjectService).to receive(:new).with(project, current_user).and_return(service) - expect(service).to receive(:execute).with(target_project).and_return(ServiceResponse.error(message: 'The error message')) + expect(service).to receive(:execute).with(target_project, direction: :outbound).and_return(ServiceResponse.error(message: 'The error message')) expect(subject.fetch(:ci_job_token_scope)).to be_nil expect(subject.fetch(:errors)).to include("The error message") diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index a0680830622..1ae834c0769 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -98,7 +98,7 @@ RSpec.describe IssuablesHelper, feature_category: :team_planning do end end - describe '#assigned_issuables_count', feature_category: :project_management do + describe '#assigned_issuables_count', feature_category: :team_planning do context 'when issuable is issues' do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project).tap { |p| p.add_developer(user) } } @@ -117,7 +117,7 @@ RSpec.describe IssuablesHelper, feature_category: :team_planning do end end - describe '#assigned_open_issues_count_text', feature_category: :project_management do + describe '#assigned_open_issues_count_text', feature_category: :team_planning do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project).tap { |p| p.add_developer(user) } } diff --git a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb index 35ca67c8a4c..d6622785e65 100644 --- a/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb +++ b/spec/lib/bulk_imports/common/pipelines/uploads_pipeline_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::Common::Pipelines::UploadsPipeline, feature_category: :import do +RSpec.describe BulkImports::Common::Pipelines::UploadsPipeline, feature_category: :importers do let_it_be(:project) { create(:project) } let_it_be(:group) { create(:group) } diff --git a/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb b/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb index 97b432406eb..1365adb8993 100644 --- a/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb +++ b/spec/lib/gitlab/database/migrations/batched_migration_last_id_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Database::Migrations::BatchedMigrationLastId, feature_category: :pipeline_insights do +RSpec.describe Gitlab::Database::Migrations::BatchedMigrationLastId, feature_category: :database do subject(:test_sampling) { described_class.new(connection, base_dir) } let(:base_dir) { Pathname.new(Dir.mktmpdir) } diff --git a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb index 1b8da0b380b..c5b44b260c6 100644 --- a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb +++ b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require 'json' require 'tempfile' -RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitlay do +RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do let(:project) { create(:project, :repository) } let(:repository) { project.repository } let(:feature_flag_name) { wrapper.rugged_feature_keys.first } diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb index d69bc4d60ee..e93d585bc3c 100644 --- a/spec/lib/gitlab/github_import/client_spec.rb +++ b/spec/lib/gitlab/github_import/client_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Client, feature_category: :importer do +RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do subject(:client) { described_class.new('foo', parallel: parallel) } let(:parallel) { true } diff --git a/spec/lib/gitlab/github_import/clients/proxy_spec.rb b/spec/lib/gitlab/github_import/clients/proxy_spec.rb index 9fef57f2a38..0baff7bafcb 100644 --- a/spec/lib/gitlab/github_import/clients/proxy_spec.rb +++ b/spec/lib/gitlab/github_import/clients/proxy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Clients::Proxy, :manage, feature_category: :import do +RSpec.describe Gitlab::GithubImport::Clients::Proxy, :manage, feature_category: :importers do subject(:client) { described_class.new(access_token, client_options) } let(:access_token) { 'test_token' } diff --git a/spec/lib/gitlab/import_export/version_checker_spec.rb b/spec/lib/gitlab/import_export/version_checker_spec.rb index b3730d85f13..dd81b8b846d 100644 --- a/spec/lib/gitlab/import_export/version_checker_spec.rb +++ b/spec/lib/gitlab/import_export/version_checker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::ImportExport::VersionChecker, feature_category: :import do +RSpec.describe Gitlab::ImportExport::VersionChecker, feature_category: :importers do include ImportExport::CommonUtil let!(:shared) { Gitlab::ImportExport::Shared.new(nil) } diff --git a/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb b/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb index a57d3633ecf..c0b94313d4d 100644 --- a/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb +++ b/spec/migrations/20220309084954_remove_leftover_external_pull_request_deletions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe RemoveLeftoverExternalPullRequestDeletions, feature_category: :sharding do +RSpec.describe RemoveLeftoverExternalPullRequestDeletions, feature_category: :pods do let(:deleted_records) { table(:loose_foreign_keys_deleted_records) } let(:pending_record1) { deleted_records.create!(id: 1, fully_qualified_table_name: 'public.external_pull_requests', primary_key_value: 1, status: 1) } diff --git a/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb b/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb index 555856788b7..e9bca42f37f 100644 --- a/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb +++ b/spec/migrations/20220329175119_remove_leftover_ci_job_artifact_deletions_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe RemoveLeftoverCiJobArtifactDeletions, feature_category: :sharding do +RSpec.describe RemoveLeftoverCiJobArtifactDeletions, feature_category: :pods do let(:deleted_records) { table(:loose_foreign_keys_deleted_records) } target_table_name = Ci::JobArtifact.table_name diff --git a/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb b/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb index dd77ce503b8..36c65612bb9 100644 --- a/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb +++ b/spec/migrations/20220802204737_remove_deactivated_user_highest_role_stats_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe RemoveDeactivatedUserHighestRoleStats, feature_category: :utilization do +RSpec.describe RemoveDeactivatedUserHighestRoleStats, feature_category: :subscription_cost_management do let!(:users) { table(:users) } let!(:user_highest_roles) { table(:user_highest_roles) } diff --git a/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb b/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb index 899074399a1..d8270816afe 100644 --- a/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb +++ b/spec/migrations/20221209110934_update_import_sources_on_application_settings_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe UpdateImportSourcesOnApplicationSettings, feature_category: :migration do +RSpec.describe UpdateImportSourcesOnApplicationSettings, feature_category: :importers do let(:settings) { table(:application_settings) } let(:import_sources_with_google) { %w[google_code github git bitbucket bitbucket_server] } let(:import_sources_without_google) { %w[github git bitbucket bitbucket_server] } diff --git a/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb b/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb index e5b20b2d48a..1f276109b24 100644 --- a/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb +++ b/spec/migrations/20221209110935_fix_update_import_sources_on_application_settings_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe FixUpdateImportSourcesOnApplicationSettings, feature_category: :migration do +RSpec.describe FixUpdateImportSourcesOnApplicationSettings, feature_category: :importers do let(:settings) { table(:application_settings) } let(:import_sources) { %w[github git bitbucket bitbucket_server] } diff --git a/spec/models/integrations/apple_app_store_spec.rb b/spec/models/integrations/apple_app_store_spec.rb index 1a57f556895..e35daa4ae77 100644 --- a/spec/models/integrations/apple_app_store_spec.rb +++ b/spec/models/integrations/apple_app_store_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Integrations::AppleAppStore, feature_category: :mobile_devops do +RSpec.describe Integrations::AppleAppStore, feature_category: :mobile_signing_deployment do describe 'Validations' do context 'when active' do before do diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 3a42d5d4c3f..e29318a7e83 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Issue, feature_category: :project_management do +RSpec.describe Issue, feature_category: :team_planning do include ExternalAuthorizationServiceHelpers using RSpec::Parameterized::TableSyntax diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 4988ba3b70b..b438984322d 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -8813,6 +8813,16 @@ RSpec.describe Project, factory_default: :keep, feature_category: :projects do end end + describe '.is_importing' do + it 'returns projects that have import in progress' do + project_1 = create(:project, :import_scheduled, import_type: 'github') + project_2 = create(:project, :import_started, import_type: 'github') + create(:project, :import_finished, import_type: 'github') + + expect(described_class.is_importing).to match_array([project_1, project_2]) + end + end + private def finish_job(export_job) diff --git a/spec/models/resource_event_spec.rb b/spec/models/resource_event_spec.rb index f40c192ab2b..62bd5314b69 100644 --- a/spec/models/resource_event_spec.rb +++ b/spec/models/resource_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceEvent, feature_category: :team_planning, type: :model do let(:dummy_resource_label_event_class) do Class.new(ResourceEvent) do self.table_name = 'resource_label_events' diff --git a/spec/models/resource_label_event_spec.rb b/spec/models/resource_label_event_spec.rb index 87f3b9fb2bb..eb28010d57f 100644 --- a/spec/models/resource_label_event_spec.rb +++ b/spec/models/resource_label_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceLabelEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceLabelEvent, feature_category: :team_planning, type: :model do let_it_be(:project) { create(:project, :repository) } let_it_be(:issue) { create(:issue, project: project) } let_it_be(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/models/resource_milestone_event_spec.rb b/spec/models/resource_milestone_event_spec.rb index 11b704ceadf..d237a16da8f 100644 --- a/spec/models/resource_milestone_event_spec.rb +++ b/spec/models/resource_milestone_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceMilestoneEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceMilestoneEvent, feature_category: :team_planning, type: :model do it_behaves_like 'a resource event' it_behaves_like 'a resource event for issues' it_behaves_like 'a resource event for merge requests' diff --git a/spec/models/resource_state_event_spec.rb b/spec/models/resource_state_event_spec.rb index 04e4359a3ff..a6d6b507b69 100644 --- a/spec/models/resource_state_event_spec.rb +++ b/spec/models/resource_state_event_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ResourceStateEvent, feature_category: :team_planing, type: :model do +RSpec.describe ResourceStateEvent, feature_category: :team_planning, type: :model do subject { build(:resource_state_event, issue: issue) } let(:issue) { create(:issue) } diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb index 7120975a420..0575ba3237b 100644 --- a/spec/policies/global_policy_spec.rb +++ b/spec/policies/global_policy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GlobalPolicy, feature_category: :security_policies do +RSpec.describe GlobalPolicy, feature_category: :shared do include TermsHelper let_it_be(:admin_user) { create(:admin) } diff --git a/spec/policies/todo_policy_spec.rb b/spec/policies/todo_policy_spec.rb index fa62f53c628..0230f106f0f 100644 --- a/spec/policies/todo_policy_spec.rb +++ b/spec/policies/todo_policy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TodoPolicy, feature_category: :project_management do +RSpec.describe TodoPolicy, feature_category: :team_planning do using RSpec::Parameterized::TableSyntax let_it_be(:project) { create(:project) } diff --git a/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb b/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb index 61d5c56ae8a..805f300072d 100644 --- a/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/job_token_scope/remove_project_spec.rb @@ -22,6 +22,7 @@ RSpec.describe 'CiJobTokenScopeRemoveProject', feature_category: :continuous_int let(:variables) do { + direction: 'OUTBOUND', project_path: project.full_path, target_project_path: target_project.full_path } @@ -67,7 +68,7 @@ RSpec.describe 'CiJobTokenScopeRemoveProject', feature_category: :continuous_int target_project.add_guest(current_user) end - it 'removes the target project from the job token scope' do + it 'removes the target project from the job token outbound scope' do expect do post_graphql_mutation(mutation, current_user: current_user) expect(response).to have_gitlab_http_status(:success) diff --git a/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb b/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb index e34066d0ee4..4c0635c8640 100644 --- a/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb +++ b/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'PipelineSchedulePlay', feature_category: :continuious_integration do +RSpec.describe 'PipelineSchedulePlay', feature_category: :continuous_integration do include GraphqlHelpers let_it_be(:user) { create(:user) } diff --git a/spec/requests/api/graphql/project/project_statistics_spec.rb b/spec/requests/api/graphql/project/project_statistics_spec.rb index d078659b954..444738cbc81 100644 --- a/spec/requests/api/graphql/project/project_statistics_spec.rb +++ b/spec/requests/api/graphql/project/project_statistics_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'rendering project statistics', feature_category: :project_statistics do +RSpec.describe 'rendering project statistics', feature_category: :shared do include GraphqlHelpers let(:project) { create(:project) } diff --git a/spec/routing/import_routing_spec.rb b/spec/routing/import_routing_spec.rb index b63ae1e7e4e..ac3f2a4b7ca 100644 --- a/spec/routing/import_routing_spec.rb +++ b/spec/routing/import_routing_spec.rb @@ -71,6 +71,10 @@ RSpec.describe Import::GithubController, 'routing' do it 'to #personal_access_token' do expect(post('/import/github/personal_access_token')).to route_to('import/github#personal_access_token') end + + it 'to #cancel_all' do + expect(post('/import/github/cancel_all')).to route_to('import/github#cancel_all') + end end # personal_access_token_import_gitea POST /import/gitea/personal_access_token(.:format) import/gitea#personal_access_token diff --git a/spec/serializers/ci/pipeline_entity_spec.rb b/spec/serializers/ci/pipeline_entity_spec.rb index ae992e478a6..4df542e3c98 100644 --- a/spec/serializers/ci/pipeline_entity_spec.rb +++ b/spec/serializers/ci/pipeline_entity_spec.rb @@ -36,11 +36,10 @@ RSpec.describe Ci::PipelineEntity do expect(subject).to include :details expect(subject[:details]) - .to include :duration, :finished_at, :name, :event_type_name + .to include :duration, :finished_at, :event_type_name expect(subject[:details][:status]).to include :icon, :favicon, :text, :label, :tooltip expect(subject[:details][:event_type_name]).to eq('Merged result pipeline') - expect(subject[:details][:name]).to eq('Merged result pipeline') end it 'contains flags' do diff --git a/spec/serializers/merge_requests/pipeline_entity_spec.rb b/spec/serializers/merge_requests/pipeline_entity_spec.rb index 414ce6653bc..acffa1e87a6 100644 --- a/spec/serializers/merge_requests/pipeline_entity_spec.rb +++ b/spec/serializers/merge_requests/pipeline_entity_spec.rb @@ -33,12 +33,11 @@ RSpec.describe MergeRequests::PipelineEntity do ) expect(subject[:commit]).to include(:short_id, :commit_path) expect(subject[:ref]).to include(:branch) - expect(subject[:details]).to include(:artifacts, :name, :event_type_name, :status, :stages, :finished_at) + expect(subject[:details]).to include(:artifacts, :event_type_name, :status, :stages, :finished_at) expect(subject[:details][:status]).to include(:icon, :favicon, :text, :label, :tooltip) expect(subject[:flags]).to include(:merge_request_pipeline) expect(subject[:details][:event_type_name]).to eq('Merged result pipeline') - expect(subject[:details][:name]).to eq('Merged result pipeline') end it 'returns presented coverage' do diff --git a/spec/services/lfs/file_transformer_spec.rb b/spec/services/lfs/file_transformer_spec.rb index 9d4d8851c2d..c90d7af022f 100644 --- a/spec/services/lfs/file_transformer_spec.rb +++ b/spec/services/lfs/file_transformer_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe Lfs::FileTransformer, feature_category: :git_lfs do +RSpec.describe Lfs::FileTransformer, feature_category: :source_code_management do let(:project) { create(:project, :repository, :wiki_repo) } let(:repository) { project.repository } let(:file_content) { 'Test file content' } diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb index 8c90946e09e..1ee9e51433e 100644 --- a/spec/services/notes/create_service_spec.rb +++ b/spec/services/notes/create_service_spec.rb @@ -512,7 +512,7 @@ RSpec.describe Notes::CreateService, feature_category: :team_planning do end end - context 'personal snippet note', feature_category: :snippets do + context 'personal snippet note', feature_category: :source_code_management do subject { described_class.new(nil, user, params).execute } let(:snippet) { create(:personal_snippet) } diff --git a/spec/services/security/ci_configuration/sast_create_service_spec.rb b/spec/services/security/ci_configuration/sast_create_service_spec.rb index 39c32567f3c..e80fe1a42fa 100644 --- a/spec/services/security/ci_configuration/sast_create_service_spec.rb +++ b/spec/services/security/ci_configuration/sast_create_service_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe Security::CiConfiguration::SastCreateService, :snowplow, feature_category: :sast do +RSpec.describe Security::CiConfiguration::SastCreateService, :snowplow, + feature_category: :static_application_security_testing do subject(:result) { described_class.new(project, user, params).execute } let(:branch_name) { 'set-sast-config-1' } diff --git a/spec/services/users/assigned_issues_count_service_spec.rb b/spec/services/users/assigned_issues_count_service_spec.rb index afa6a0af3dd..2062f68b24b 100644 --- a/spec/services/users/assigned_issues_count_service_spec.rb +++ b/spec/services/users/assigned_issues_count_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Users::AssignedIssuesCountService, :use_clean_rails_memory_store_caching, - feature_category: :project_management do + feature_category: :team_planning do let_it_be(:user) { create(:user) } let_it_be(:max_limit) { 10 } diff --git a/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb b/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb index 85f71da8c97..25ea5d75a56 100644 --- a/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb +++ b/spec/tasks/gitlab/security/update_banned_ssh_keys_rake_spec.rb @@ -7,7 +7,7 @@ require 'rake_helper' # is hit in the rake task. require 'git' -RSpec.describe 'gitlab:security namespace rake tasks', :silence_stdout, feature_category: :security do +RSpec.describe 'gitlab:security namespace rake tasks', :silence_stdout, feature_category: :credential_management do let(:fixture_path) { Rails.root.join('spec/fixtures/tasks/gitlab/security') } let(:output_file) { File.join(__dir__, 'tmp/banned_keys_test.yml') } let(:git_url) { 'https://github.com/rapid7/ssh-badkeys.git' } diff --git a/spec/views/layouts/snippets.html.haml_spec.rb b/spec/views/layouts/snippets.html.haml_spec.rb index 69378906bcd..5c182f715d6 100644 --- a/spec/views/layouts/snippets.html.haml_spec.rb +++ b/spec/views/layouts/snippets.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'layouts/snippets', feature_category: :snippets do +RSpec.describe 'layouts/snippets', feature_category: :source_code_management do before do allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user)) diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb index 52b3d5b95f9..5fe89102be3 100644 --- a/spec/views/projects/commit/show.html.haml_spec.rb +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code do +RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code_management do let(:project) { create(:project, :repository) } let(:commit) { project.commit } diff --git a/spec/workers/bulk_imports/pipeline_worker_spec.rb b/spec/workers/bulk_imports/pipeline_worker_spec.rb index 10c63606f81..e8b0714471d 100644 --- a/spec/workers/bulk_imports/pipeline_worker_spec.rb +++ b/spec/workers/bulk_imports/pipeline_worker_spec.rb @@ -507,6 +507,40 @@ RSpec.describe BulkImports::PipelineWorker, feature_category: :importers do end end + context 'when job reaches timeout' do + it 'marks as failed and logs the error' do + old_created_at = pipeline_tracker.created_at + pipeline_tracker.update!(created_at: (BulkImports::Pipeline::NDJSON_EXPORT_TIMEOUT + 1.hour).ago) + + expect_next_instance_of(Gitlab::Import::Logger) do |logger| + expect(logger) + .to receive(:error) + .with( + hash_including( + 'pipeline_name' => 'NdjsonPipeline', + 'bulk_import_entity_id' => entity.id, + 'bulk_import_id' => entity.bulk_import_id, + 'bulk_import_entity_type' => entity.source_type, + 'source_full_path' => entity.source_full_path, + 'class' => 'BulkImports::PipelineWorker', + 'exception.backtrace' => anything, + 'exception.class' => 'BulkImports::Pipeline::ExpiredError', + 'exception.message' => 'Pipeline timeout', + 'importer' => 'gitlab_migration', + 'message' => 'Pipeline failed', + 'source_version' => entity.bulk_import.source_version_info.to_s + ) + ) + end + + subject.perform(pipeline_tracker.id, pipeline_tracker.stage, entity.id) + + expect(pipeline_tracker.reload.status_name).to eq(:failed) + + entity.update!(created_at: old_created_at) + end + end + context 'when export status is failed' do it 'marks as failed and logs the error' do allow_next_instance_of(BulkImports::ExportStatus) do |status| |