diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 06:21:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 06:21:36 +0300 |
commit | eba7329faa534bc0ea9332e3278f2a74f61a79dc (patch) | |
tree | 39b4d3d4b8d77ebb6766e689d8b9210f0ea643d1 /spec | |
parent | f3b2c536778dcd0981134c702d97c6e4047b64d4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
15 files changed, 71 insertions, 50 deletions
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 fdc996ef39b..eab5cee976e 100644 --- a/spec/features/merge_request/user_creates_merge_request_spec.rb +++ b/spec/features/merge_request/user_creates_merge_request_spec.rb @@ -98,7 +98,7 @@ RSpec.describe 'User creates a merge request', :js, feature_category: :code_revi click_button('Create merge request') - expect(page).to have_content(title).and have_content("• #{forked_project.full_path}:fix ➔ master") + expect(page).to have_content(title).and have_content("requested to merge #{forked_project.full_path}:fix into master") end end end diff --git a/spec/features/merge_request/user_edits_merge_request_spec.rb b/spec/features/merge_request/user_edits_merge_request_spec.rb index 31b382be611..584a17ae33d 100644 --- a/spec/features/merge_request/user_edits_merge_request_spec.rb +++ b/spec/features/merge_request/user_edits_merge_request_spec.rb @@ -95,7 +95,7 @@ RSpec.describe 'User edits a merge request', :js, feature_category: :code_review click_button('Save changes') - expect(page).to have_content("• #{merge_request.source_branch} ➔ merge-test") + expect(page).to have_content("requested to merge #{merge_request.source_branch} into merge-test") expect(page).to have_content("changed target branch from #{merge_request.target_branch} to merge-test") end diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb index 539c017dd0f..bb08ed7d07d 100644 --- a/spec/features/users/signup_spec.rb +++ b/spec/features/users/signup_spec.rb @@ -339,11 +339,24 @@ RSpec.describe 'Signup', :js, feature_category: :user_management do end context 'when invisible captcha detects malicious behaviour' do - it 'prevents from signing up' do - visit new_user_registration_path + context 'with form submitted quicker than timestamp_threshold', :freeze_time do + it 'prevents from signing up' do + visit new_user_registration_path - expect { fill_in_sign_up_form(new_user) }.not_to change { User.count } - expect(page).to have_content('That was a bit too quick! Please resubmit.') + expect { fill_in_sign_up_form(new_user) }.not_to change { User.count } + expect(page).to have_content('That was a bit too quick! Please resubmit.') + end + end + + context 'with honeypot field is filled' do + it 'prevents from signing up' do + visit new_user_registration_path + + find_field('If you are human, please ignore this field.', + visible: false).execute_script("this.value = 'bot'") + + expect { fill_in_sign_up_form(new_user) }.not_to change { User.count } + end end end end diff --git a/spec/frontend/badges/store/actions_spec.js b/spec/frontend/badges/store/actions_spec.js index 5ca199357f9..1900ebc1e08 100644 --- a/spec/frontend/badges/store/actions_spec.js +++ b/spec/frontend/badges/store/actions_spec.js @@ -258,7 +258,7 @@ describe('Badges store actions', () => { it('dispatches requestLoadBadges and receiveLoadBadges for successful response', async () => { const dummyData = 'this is just some data'; - const dummyReponse = [ + const dummyResponse = [ createDummyBadgeResponse(), createDummyBadgeResponse(), createDummyBadgeResponse(), @@ -266,11 +266,11 @@ describe('Badges store actions', () => { endpointMock.replyOnce(() => { expect(dispatch.mock.calls).toEqual([['requestLoadBadges', dummyData]]); dispatch.mockClear(); - return [HTTP_STATUS_OK, dummyReponse]; + return [HTTP_STATUS_OK, dummyResponse]; }); await actions.loadBadges({ state, dispatch }, dummyData); - const badges = dummyReponse.map(transformBackendBadge); + const badges = dummyResponse.map(transformBackendBadge); expect(dispatch.mock.calls).toEqual([['receiveLoadBadges', badges]]); }); @@ -377,15 +377,15 @@ describe('Badges store actions', () => { }); it('dispatches requestRenderedBadge and receiveRenderedBadge for successful response', async () => { - const dummyReponse = createDummyBadgeResponse(); + const dummyResponse = createDummyBadgeResponse(); endpointMock.replyOnce(() => { expect(dispatch.mock.calls).toEqual([['requestRenderedBadge']]); dispatch.mockClear(); - return [HTTP_STATUS_OK, dummyReponse]; + return [HTTP_STATUS_OK, dummyResponse]; }); await actions.renderBadge({ state, dispatch }); - const renderedBadge = transformBackendBadge(dummyReponse); + const renderedBadge = transformBackendBadge(dummyResponse); expect(dispatch.mock.calls).toEqual([['receiveRenderedBadge', renderedBadge]]); }); diff --git a/spec/lib/bulk_imports/pipeline/runner_spec.rb b/spec/lib/bulk_imports/pipeline/runner_spec.rb index 72e5e16a5b4..5482068204d 100644 --- a/spec/lib/bulk_imports/pipeline/runner_spec.rb +++ b/spec/lib/bulk_imports/pipeline/runner_spec.rb @@ -306,14 +306,14 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do allow(extractor).to receive(:extract).with(context).and_raise( BulkImports::NetworkError.new( 'Net::ReadTimeout', - response: instance_double(HTTParty::Response, code: reponse_status_code, headers: {}) + response: instance_double(HTTParty::Response, code: response_status_code, headers: {}) ) ) end end context 'when exception is retriable' do - let(:reponse_status_code) { 429 } + let(:response_status_code) { 429 } it 'raises the exception BulkImports::RetryPipelineError' do expect { subject.run }.to raise_error(BulkImports::RetryPipelineError) @@ -321,7 +321,7 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do end context 'when exception is not retriable' do - let(:reponse_status_code) { 505 } + let(:response_status_code) { 505 } it_behaves_like 'failed pipeline', 'BulkImports::NetworkError', 'Net::ReadTimeout' end diff --git a/spec/models/container_repository_spec.rb b/spec/models/container_repository_spec.rb index fb32c796016..dc53c420704 100644 --- a/spec/models/container_repository_spec.rb +++ b/spec/models/container_repository_spec.rb @@ -1148,9 +1148,9 @@ RSpec.describe ContainerRepository, :aggregate_failures, feature_category: :cont end end - describe '.find_or_create_from_path' do + describe '.find_or_create_from_path!' do let(:repository) do - described_class.find_or_create_from_path(ContainerRegistry::Path.new(path)) + described_class.find_or_create_from_path!(ContainerRegistry::Path.new(path)) end let(:repository_path) { ContainerRegistry::Path.new(path) } @@ -1239,7 +1239,7 @@ RSpec.describe ContainerRepository, :aggregate_failures, feature_category: :cont Thread.new do true while wait_for_it - described_class.find_or_create_from_path(path) + described_class.find_or_create_from_path!(path) end end wait_for_it = false diff --git a/spec/requests/api/ci/pipeline_schedules_spec.rb b/spec/requests/api/ci/pipeline_schedules_spec.rb index a4bb379d01c..f534b093b7c 100644 --- a/spec/requests/api/ci/pipeline_schedules_spec.rb +++ b/spec/requests/api/ci/pipeline_schedules_spec.rb @@ -241,7 +241,7 @@ RSpec.describe API::Ci::PipelineSchedules, feature_category: :continuous_integra let(:url) { "/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/pipelines" } matcher :return_pipeline_schedule_pipelines_successfully do - match_unless_raises do |reponse| + match_unless_raises do |response| expect(response).to have_gitlab_http_status(:ok) expect(response).to include_pagination_headers expect(response).to match_response_schema('public_api/v4/pipelines') diff --git a/spec/requests/api/graphql/mutations/container_registry/protection/rule/delete_spec.rb b/spec/requests/api/graphql/mutations/container_registry/protection/rule/delete_spec.rb index 8b5eaf580f4..dd661c302ff 100644 --- a/spec/requests/api/graphql/mutations/container_registry/protection/rule/delete_spec.rb +++ b/spec/requests/api/graphql/mutations/container_registry/protection/rule/delete_spec.rb @@ -20,7 +20,7 @@ RSpec.describe 'Deleting a container registry protection rule', :aggregate_failu post_graphql_mutation(mutation, current_user: current_user) end - shared_examples 'an erroneous reponse' do + shared_examples 'an erroneous response' do it { post_graphql_mutation_delete_container_registry_protection_rule.tap { expect(mutation_response).to be_blank } } it do @@ -53,7 +53,7 @@ RSpec.describe 'Deleting a container registry protection rule', :aggregate_failu create(:container_registry_protection_rule, repository_path_pattern: 'protection_rule_other_project') end - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { is_expected.tap { expect_graphql_errors_to_include(/you don't have permission to perform this action/) } } end @@ -64,7 +64,7 @@ RSpec.describe 'Deleting a container registry protection rule', :aggregate_failu repository_path_pattern: 'protection_rule_deleted').destroy! end - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { is_expected.tap { expect_graphql_errors_to_include(/you don't have permission to perform this action/) } } end @@ -80,7 +80,7 @@ RSpec.describe 'Deleting a container registry protection rule', :aggregate_failu end with_them do - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { is_expected.tap { expect_graphql_errors_to_include(/you don't have permission to perform this action/) } } end @@ -91,7 +91,7 @@ RSpec.describe 'Deleting a container registry protection rule', :aggregate_failu stub_feature_flags(container_registry_protected_containers: false) end - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it do post_graphql_mutation_delete_container_registry_protection_rule diff --git a/spec/requests/api/graphql/mutations/packages/protection/rule/delete_spec.rb b/spec/requests/api/graphql/mutations/packages/protection/rule/delete_spec.rb index 1d94d520674..6c300f8ce57 100644 --- a/spec/requests/api/graphql/mutations/packages/protection/rule/delete_spec.rb +++ b/spec/requests/api/graphql/mutations/packages/protection/rule/delete_spec.rb @@ -15,7 +15,7 @@ RSpec.describe 'Deleting a package protection rule', :aggregate_failures, featur subject { post_graphql_mutation(mutation, current_user: current_user) } - shared_examples 'an erroneous reponse' do + shared_examples 'an erroneous response' do it { subject.tap { expect(mutation_response).to be_blank } } it { expect { subject }.not_to change { ::Packages::Protection::Rule.count } } end @@ -44,7 +44,7 @@ RSpec.describe 'Deleting a package protection rule', :aggregate_failures, featur create(:package_protection_rule, package_name_pattern: 'protection_rule_other_project') end - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { subject.tap { expect_graphql_errors_to_include(/you don't have permission to perform this action/) } } end @@ -54,7 +54,7 @@ RSpec.describe 'Deleting a package protection rule', :aggregate_failures, featur create(:package_protection_rule, project: project, package_name_pattern: 'protection_rule_deleted').destroy! end - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { subject.tap { expect_graphql_errors_to_include(/you don't have permission to perform this action/) } } end @@ -70,7 +70,7 @@ RSpec.describe 'Deleting a package protection rule', :aggregate_failures, featur end with_them do - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { subject.tap { expect_graphql_errors_to_include(/you don't have permission to perform this action/) } } end @@ -81,7 +81,7 @@ RSpec.describe 'Deleting a package protection rule', :aggregate_failures, featur stub_feature_flags(packages_protected_packages: false) end - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { subject.tap { expect_graphql_errors_to_include(/'packages_protected_packages' feature flag is disabled/) } } end diff --git a/spec/requests/api/graphql/mutations/packages/protection/rule/update_spec.rb b/spec/requests/api/graphql/mutations/packages/protection/rule/update_spec.rb index cb4f9240311..efc919062d6 100644 --- a/spec/requests/api/graphql/mutations/packages/protection/rule/update_spec.rb +++ b/spec/requests/api/graphql/mutations/packages/protection/rule/update_spec.rb @@ -63,7 +63,7 @@ RSpec.describe 'Updating the packages protection rule', :aggregate_failures, fea end end - shared_examples 'an erroneous reponse' do + shared_examples 'an erroneous response' do it { subject.tap { expect(mutation_response).to be_blank } } it { expect { subject }.not_to change { package_protection_rule.reload.updated_at } } end @@ -92,7 +92,7 @@ RSpec.describe 'Updating the packages protection rule', :aggregate_failures, fea context 'with invalid input param `pushProtectedUpToAccessLevel`' do let(:input) { super().merge(push_protected_up_to_access_level: nil) } - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { is_expected.tap { expect_graphql_errors_to_include(/pushProtectedUpToAccessLevel can't be blank/) } } end @@ -100,7 +100,7 @@ RSpec.describe 'Updating the packages protection rule', :aggregate_failures, fea context 'with invalid input param `packageNamePattern`' do let(:input) { super().merge(package_name_pattern: '') } - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it { is_expected.tap { expect_graphql_errors_to_include(/packageNamePattern can't be blank/) } } end @@ -125,7 +125,7 @@ RSpec.describe 'Updating the packages protection rule', :aggregate_failures, fea stub_feature_flags(packages_protected_packages: false) end - it_behaves_like 'an erroneous reponse' + it_behaves_like 'an erroneous response' it 'returns error of disabled feature flag' do is_expected.tap { expect_graphql_errors_to_include(/'packages_protected_packages' feature flag is disabled/) } diff --git a/spec/requests/api/ml/mlflow/registered_models_spec.rb b/spec/requests/api/ml/mlflow/registered_models_spec.rb index 4dd6fe31258..09cf765b0b3 100644 --- a/spec/requests/api/ml/mlflow/registered_models_spec.rb +++ b/spec/requests/api/ml/mlflow/registered_models_spec.rb @@ -207,7 +207,7 @@ RSpec.describe API::Ml::Mlflow::RegisteredModels, feature_category: :mlops do let(:route) { "/projects/#{project_id}/ml/mlflow/api/2.0/mlflow/registered-models/delete" } let(:request) { delete api(route), params: params, headers: headers } - it 'returns a success reponse', :aggregate_failures do + it 'returns a success response', :aggregate_failures do is_expected.to have_gitlab_http_status(:ok) expect(json_response).to eq({}) end diff --git a/spec/requests/api/remote_mirrors_spec.rb b/spec/requests/api/remote_mirrors_spec.rb index 3da1760e319..7d37d73a361 100644 --- a/spec/requests/api/remote_mirrors_spec.rb +++ b/spec/requests/api/remote_mirrors_spec.rb @@ -50,7 +50,7 @@ RSpec.describe API::RemoteMirrors, feature_category: :source_code_management do let(:route) { "/projects/#{project.id}/remote_mirrors" } shared_examples 'creates a remote mirror' do - it 'creates a remote mirror and returns reponse' do + it 'creates a remote mirror and returns response' do project.add_maintainer(user) post api(route, user), params: params diff --git a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb index 3f3c5da5b55..37e686f9f92 100644 --- a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb @@ -15,6 +15,10 @@ RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers end.new end + it 'has a Sidekiq retry of 6' do + expect(worker.class.sidekiq_options['retry']).to eq(6) + end + describe '#perform' do it 'returns if no project could be found' do expect(worker).not_to receive(:try_import) diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb index e18f5ec2524..c60e8d37c2e 100644 --- a/spec/workers/every_sidekiq_worker_spec.rb +++ b/spec/workers/every_sidekiq_worker_spec.rb @@ -263,7 +263,7 @@ RSpec.describe 'Every Sidekiq worker', feature_category: :shared do 'Gitlab::BitbucketServerImport::Stage::ImportPullRequestsWorker' => 3, 'Gitlab::BitbucketServerImport::Stage::ImportRepositoryWorker' => 3, 'Gitlab::BitbucketServerImport::Stage::ImportUsersWorker' => 3, - 'Gitlab::GithubImport::AdvanceStageWorker' => 3, + 'Gitlab::GithubImport::AdvanceStageWorker' => 6, 'Gitlab::GithubImport::Attachments::ImportReleaseWorker' => 5, 'Gitlab::GithubImport::Attachments::ImportNoteWorker' => 5, 'Gitlab::GithubImport::Attachments::ImportIssueWorker' => 5, @@ -280,20 +280,20 @@ RSpec.describe 'Every Sidekiq worker', feature_category: :shared do 'Gitlab::GithubImport::PullRequests::ImportMergedByWorker' => 5, 'Gitlab::GithubImport::ImportPullRequestWorker' => 5, 'Gitlab::GithubImport::RefreshImportJidWorker' => 5, - 'Gitlab::GithubImport::Stage::FinishImportWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportBaseDataWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportIssueEventsWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportLfsObjectsWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportAttachmentsWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportProtectedBranchesWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportNotesWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportCollaboratorsWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportPullRequestsReviewRequestsWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportPullRequestsWorker' => 5, - 'Gitlab::GithubImport::Stage::ImportRepositoryWorker' => 5, + 'Gitlab::GithubImport::Stage::FinishImportWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportBaseDataWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportIssueEventsWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportLfsObjectsWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportAttachmentsWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportProtectedBranchesWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportNotesWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportCollaboratorsWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportPullRequestsReviewRequestsWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportPullRequestsWorker' => 6, + 'Gitlab::GithubImport::Stage::ImportRepositoryWorker' => 6, 'Gitlab::GithubGistsImport::ImportGistWorker' => 5, 'Gitlab::GithubGistsImport::StartImportWorker' => 5, 'Gitlab::GithubGistsImport::FinishImportWorker' => 5, diff --git a/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb b/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb index 60c117a2a90..dcf016c550b 100644 --- a/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb +++ b/spec/workers/gitlab/github_import/advance_stage_worker_spec.rb @@ -4,4 +4,8 @@ require 'spec_helper' RSpec.describe Gitlab::GithubImport::AdvanceStageWorker, feature_category: :importers do it_behaves_like Gitlab::Import::AdvanceStage, factory: :import_state + + it 'has a Sidekiq retry of 6' do + expect(described_class.sidekiq_options['retry']).to eq(6) + end end |