Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-05-24 06:08:57 +00:00
parent a67ba1bbfa
commit ecf2b5b604
16 changed files with 136 additions and 49 deletions

View File

@ -17,6 +17,9 @@ module GitlabRecaptcha
flash.delete :recaptcha_error
self.resource = resource_class.new
add_gon_variables
render action: 'new'
end
end

View File

@ -360,6 +360,7 @@ class GroupsController < Groups::ApplicationController
flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
flash.delete :recaptcha_error
@group = Group.new(group_params)
add_gon_variables
render action: 'new'
end

View File

@ -153,6 +153,7 @@ class RegistrationsController < Devise::RegistrationsController
flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
flash.delete :recaptcha_error
add_gon_variables
render action: 'new'
end

View File

@ -127,7 +127,9 @@ class SessionsController < Devise::SessionsController
flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
flash.delete :recaptcha_error
redirect_to new_user_session_path
add_gon_variables
respond_with_navigational(resource) { render :new }
end
end

View File

@ -8,16 +8,11 @@
%p.text-secondary
= s_('ProjectSettings|The default target project for merge requests created in this fork project.')
.form-check.gl-mb-2
= settings.radio_button :mr_default_target_self, false, class: "form-check-input"
= label_tag :project_project_setting_attributes_mr_default_target_self_false, class: 'form-check-label' do
.gl-font-weight-bold
= s_('ProjectSettings|Upstream project')
= @project.forked_from_project.full_name
.form-check.gl-mb-2
= settings.radio_button :mr_default_target_self, true, class: "form-check-input"
= label_tag :project_project_setting_attributes_mr_default_target_self_true, class: 'form-check-label' do
.gl-font-weight-bold
= s_('ProjectSettings|This project')
= @project.full_name
= settings.gitlab_ui_radio_component :mr_default_target_self,
false,
s_('ProjectSettings|Upstream project'),
help_text: @project.forked_from_project.full_name
= settings.gitlab_ui_radio_component :mr_default_target_self,
true,
s_('ProjectSettings|This project'),
help_text: @project.full_name

View File

@ -1,7 +1,11 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Verify', :runner, :reliable do
RSpec.describe 'Verify', :runner, :reliable, quarantine: {
only: { subdomain: %i[staging staging-canary] },
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/363188",
type: :investigating
} do
describe 'Parent-child pipelines dependent relationship' do
let!(:project) do
Resource::Project.fabricate_via_api! do |project|

View File

@ -1,7 +1,11 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Verify', :runner, :reliable do
RSpec.describe 'Verify', :runner, :reliable, quarantine: {
only: { subdomain: %i[staging staging-canary] },
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/363188",
type: :investigating
} do
describe 'Parent-child pipelines independent relationship' do
let!(:project) do
Resource::Project.fabricate_via_api! do |project|

View File

@ -2,7 +2,11 @@
module QA
RSpec.describe 'Package' do
describe 'Container Registry', :reliable, only: { subdomain: %i[staging pre] } do
describe 'Container Registry', :reliable, only: { subdomain: %i[staging pre] }, quarantine: {
only: { subdomain: %i[staging staging-canary] },
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/363188",
type: :investigating
} do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-with-registry'
@ -37,7 +41,7 @@ module QA
do
docker info && break
sleep 1s
done
done
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .

View File

@ -1,7 +1,11 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable do
RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable, quarantine: {
only: { subdomain: %i[staging staging-canary] },
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/363188",
type: :investigating
} do
describe 'Maven group level endpoint' do
include Runtime::Fixtures
include_context 'packages registry qa scenario'

View File

@ -1,7 +1,11 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable do
RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable, quarantine: {
only: { subdomain: %i[staging staging-canary] },
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/363188",
type: :investigating
} do
describe 'Maven project level endpoint' do
let(:group_id) { 'com.gitlab.qa' }
let(:artifact_id) { "maven-#{SecureRandom.hex(8)}" }

View File

@ -1,7 +1,11 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable do
RSpec.describe 'Package', :orchestrated, :packages, :object_storage, :reliable, quarantine: {
only: { subdomain: %i[staging staging-canary] },
issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/363188",
type: :investigating
} do
describe 'NuGet group level endpoint' do
using RSpec::Parameterized::TableSyntax
include Runtime::Fixtures

View File

@ -146,13 +146,26 @@ RSpec.describe ConfirmationsController do
stub_application_setting(recaptcha_enabled: true)
end
it 'displays an error when the reCAPTCHA is not solved' do
Recaptcha.configuration.skip_verify_env.delete('test')
context 'when the reCAPTCHA is not solved' do
before do
Recaptcha.configuration.skip_verify_env.delete('test')
end
perform_request
it 'displays an error' do
perform_request
expect(response).to render_template(:new)
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(response).to render_template(:new)
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
end
it 'sets gon variables' do
Gon.clear
perform_request
expect(response).to render_template(:new)
expect(Gon.all_variables).not_to be_empty
end
end
it 'successfully sends password reset when reCAPTCHA is solved' do

View File

@ -373,13 +373,26 @@ RSpec.describe GroupsController, factory_default: :keep do
end
end
it 'displays an error when the reCAPTCHA is not solved' do
allow(controller).to receive(:verify_recaptcha).and_return(false)
context 'when the reCAPTCHA is not solved' do
before do
allow(controller).to receive(:verify_recaptcha).and_return(false)
end
post :create, params: { group: { name: 'new_group', path: "new_group" } }
it 'displays an error' do
post :create, params: { group: { name: 'new_group', path: "new_group" } }
expect(response).to render_template(:new)
expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'))
expect(response).to render_template(:new)
expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'))
end
it 'sets gon variables' do
Gon.clear
post :create, params: { group: { name: 'new_group', path: "new_group" } }
expect(response).to render_template(:new)
expect(Gon.all_variables).not_to be_empty
end
end
it 'allows creating a group when the reCAPTCHA is solved' do

View File

@ -115,13 +115,26 @@ RSpec.describe PasswordsController do
stub_application_setting(recaptcha_enabled: true)
end
it 'displays an error when the reCAPTCHA is not solved' do
Recaptcha.configuration.skip_verify_env.delete('test')
context 'when the reCAPTCHA is not solved' do
before do
Recaptcha.configuration.skip_verify_env.delete('test')
end
perform_request
it 'displays an error' do
perform_request
expect(response).to render_template(:new)
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(response).to render_template(:new)
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
end
it 'sets gon variables' do
Gon.clear
perform_request
expect(response).to render_template(:new)
expect(Gon.all_variables).not_to be_empty
end
end
it 'successfully sends password reset when reCAPTCHA is solved' do

View File

@ -292,13 +292,26 @@ RSpec.describe RegistrationsController do
end
end
it 'displays an error when the reCAPTCHA is not solved' do
allow_any_instance_of(described_class).to receive(:verify_recaptcha).and_return(false)
context 'when the reCAPTCHA is not solved' do
before do
allow_any_instance_of(described_class).to receive(:verify_recaptcha).and_return(false)
end
subject
it 'displays an error' do
subject
expect(response).to render_template(:new)
expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'))
expect(response).to render_template(:new)
expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'))
end
it 'sets gon variables' do
Gon.clear
subject
expect(response).to render_template(:new)
expect(Gon.all_variables).not_to be_empty
end
end
it 'redirects to the welcome page when the reCAPTCHA is solved' do

View File

@ -233,14 +233,23 @@ RSpec.describe SessionsController do
request.headers[described_class::CAPTCHA_HEADER] = '1'
end
it 'displays an error when the reCAPTCHA is not solved' do
# Without this, `verify_recaptcha` arbitrarily returns true in test env
context 'when the reCAPTCHA is not solved' do
it 'displays an error' do
unsuccesful_login(user_params)
unsuccesful_login(user_params)
expect(response).to render_template(:new)
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(subject.current_user).to be_nil
end
expect(response).to redirect_to new_user_session_path
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(subject.current_user).to be_nil
it 'sets gon variables' do
Gon.clear
unsuccesful_login(user_params)
expect(response).to render_template(:new)
expect(Gon.all_variables).not_to be_empty
end
end
it 'successfully logs in a user when reCAPTCHA is solved' do
@ -262,7 +271,7 @@ RSpec.describe SessionsController do
it 'displays an error when the reCAPTCHA is not solved' do
unsuccesful_login(user_params, sesion_params: { failed_login_attempts: 6 })
expect(response).to redirect_to new_user_session_path
expect(response).to render_template(:new)
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(subject.current_user).to be_nil
end
@ -282,7 +291,7 @@ RSpec.describe SessionsController do
it 'displays an error when the reCAPTCHA is not solved' do
unsuccesful_login(user_params)
expect(response).to redirect_to new_user_session_path
expect(response).to render_template(:new)
expect(flash[:alert]).to include _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
expect(subject.current_user).to be_nil
end