Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-07-13 03:09:46 +00:00
parent 41038b07f7
commit 5dd05f8e99
10 changed files with 6 additions and 69 deletions

View file

@ -2106,7 +2106,7 @@ class User < ApplicationRecord
end
def check_username_format
return if username.blank? || Mime::EXTENSION_LOOKUP.keys.none? { |type| username.end_with?(type) }
return if username.blank? || Mime::EXTENSION_LOOKUP.keys.none? { |type| username.end_with?(".#{type}") }
errors.add(:username, _('ending with MIME type format is not allowed.'))
end

View file

@ -274,15 +274,6 @@
:weight: 1
:idempotent:
:tags: []
- :name: cronjob:gitlab_usage_ping
:worker_name: GitlabUsagePingWorker
:feature_category: :service_ping
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent:
:tags: []
- :name: cronjob:import_export_project_cleanup
:worker_name: ImportExportProjectCleanupWorker
:feature_category: :importers

View file

@ -1,4 +0,0 @@
# frozen_string_literal: true
class GitlabUsagePingWorker < GitlabServicePingWorker # rubocop:disable Scalability/IdempotentWorker
end

View file

@ -498,9 +498,6 @@ Settings.cron_jobs['jira_import_stuck_jira_import_jobs']['job_class'] = 'Gitlab:
Settings.cron_jobs['stuck_export_jobs_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['stuck_export_jobs_worker']['cron'] ||= '30 * * * *'
Settings.cron_jobs['stuck_export_jobs_worker']['job_class'] = 'StuckExportJobsWorker'
Settings.cron_jobs['gitlab_usage_ping_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['gitlab_usage_ping_worker']['cron'] ||= nil # This is dynamically loaded in the sidekiq initializer
Settings.cron_jobs['gitlab_usage_ping_worker']['job_class'] = 'GitlabUsagePingWorker'
Settings.cron_jobs['gitlab_service_ping_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['gitlab_service_ping_worker']['cron'] ||= nil # This is dynamically loaded in the sidekiq initializer
Settings.cron_jobs['gitlab_service_ping_worker']['job_class'] = 'GitlabServicePingWorker'

View file

@ -201,6 +201,9 @@ For example configurations, see the [notes on specific providers](#providers).
If a username is not specified, the email address is used to generate the GitLab username.
See [`attribute_statements`](#attribute_statements) for examples on how the
assertions are configured.
Please refer to [the OmniAuth SAML gem](https://github.com/omniauth/omniauth-saml/blob/master/lib/omniauth/strategies/saml.rb)
for a full list of supported assertions.

Binary file not shown.

View file

@ -152,7 +152,7 @@ module QA
@project = Resource::ImportProject.fabricate_via_browser_ui!
# Setting the name here, since otherwise some tests will look for an existing file in
# the proejct without ever knowing what is in it.
@file_name = "LICENSE"
@file_name = "github_controller_spec.rb"
visit("#{project.web_url}/-/merge_requests/1")
current_url
end

View file

@ -394,6 +394,7 @@ RSpec.describe User do
expect(user).not_to be_valid
expect(user.errors.full_messages).to include('Username ending with MIME type format is not allowed.')
expect(build(:user, username: "test#{type}")).to be_valid
end
end

View file

@ -288,7 +288,6 @@ RSpec.describe 'Every Sidekiq worker' do
'GitlabPerformanceBarStatsWorker' => 3,
'GitlabShellWorker' => 3,
'GitlabServicePingWorker' => 3,
'GitlabUsagePingWorker' => 3,
'GroupDestroyWorker' => 3,
'GroupExportWorker' => false,
'GroupImportWorker' => false,

View file

@ -1,50 +0,0 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GitlabUsagePingWorker, :clean_gitlab_redis_shared_state do
before do
allow_next_instance_of(ServicePing::SubmitService) { |service| allow(service).to receive(:execute) }
allow(subject).to receive(:sleep)
end
it 'does not run for GitLab.com' do
allow(Gitlab).to receive(:com?).and_return(true)
expect(ServicePing::SubmitService).not_to receive(:new)
subject.perform
end
it 'delegates to ServicePing::SubmitService' do
expect_next_instance_of(ServicePing::SubmitService) { |service| expect(service).to receive(:execute) }
subject.perform
end
it "obtains a #{described_class::LEASE_TIMEOUT} second exclusive lease" do
expect(Gitlab::ExclusiveLeaseHelpers::SleepingLock)
.to receive(:new)
.with(described_class::LEASE_KEY, hash_including(timeout: described_class::LEASE_TIMEOUT))
.and_call_original
subject.perform
end
it 'sleeps for between 0 and 60 seconds' do
expect(subject).to receive(:sleep).with(0..60)
subject.perform
end
context 'when lease is not obtained' do
before do
Gitlab::ExclusiveLease.new(described_class::LEASE_KEY, timeout: described_class::LEASE_TIMEOUT).try_obtain
end
it 'does not invoke ServicePing::SubmitService' do
allow_next_instance_of(ServicePing::SubmitService) { |service| expect(service).not_to receive(:execute) }
expect { subject.perform }.to raise_error(Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError)
end
end
end