提交 735e7717 编写于 作者: G GitLab Bot

Add latest changes from gitlab-org/gitlab@master

上级 55be83f7
...@@ -351,7 +351,6 @@ RSpec/LeakyConstantDeclaration: ...@@ -351,7 +351,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/db/schema_spec.rb' - 'spec/db/schema_spec.rb'
- 'spec/lib/feature_spec.rb' - 'spec/lib/feature_spec.rb'
- 'spec/lib/gitlab/config/entry/simplifiable_spec.rb' - 'spec/lib/gitlab/config/entry/simplifiable_spec.rb'
- 'spec/lib/gitlab/git/diff_collection_spec.rb'
- 'spec/lib/gitlab/import_export/import_test_coverage_spec.rb' - 'spec/lib/gitlab/import_export/import_test_coverage_spec.rb'
- 'spec/lib/gitlab/quick_actions/dsl_spec.rb' - 'spec/lib/gitlab/quick_actions/dsl_spec.rb'
- 'spec/lib/marginalia_spec.rb' - 'spec/lib/marginalia_spec.rb'
...@@ -363,7 +362,6 @@ RSpec/LeakyConstantDeclaration: ...@@ -363,7 +362,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/models/concerns/triggerable_hooks_spec.rb' - 'spec/models/concerns/triggerable_hooks_spec.rb'
- 'spec/models/repository_spec.rb' - 'spec/models/repository_spec.rb'
- 'spec/services/clusters/applications/check_installation_progress_service_spec.rb' - 'spec/services/clusters/applications/check_installation_progress_service_spec.rb'
- 'spec/services/clusters/applications/check_uninstall_progress_service_spec.rb'
- 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb' - 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb'
RSpec/EmptyLineAfterHook: RSpec/EmptyLineAfterHook:
......
...@@ -352,7 +352,7 @@ module Ci ...@@ -352,7 +352,7 @@ module Ci
begin begin
Ci::Build.retry(build, build.user) Ci::Build.retry(build, build.user)
rescue Gitlab::Access::AccessDeniedError => ex rescue Gitlab::Access::AccessDeniedError => ex
Rails.logger.error "Unable to auto-retry job #{build.id}: #{ex}" # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.error "Unable to auto-retry job #{build.id}: #{ex}"
end end
end end
end end
......
...@@ -950,7 +950,6 @@ class Repository ...@@ -950,7 +950,6 @@ class Repository
async_remove_remote(remote_name) if tmp_remote_name async_remove_remote(remote_name) if tmp_remote_name
end end
# rubocop:disable Gitlab/RailsLogger
def async_remove_remote(remote_name) def async_remove_remote(remote_name)
return unless remote_name return unless remote_name
return unless project return unless project
...@@ -958,14 +957,13 @@ class Repository ...@@ -958,14 +957,13 @@ class Repository
job_id = RepositoryRemoveRemoteWorker.perform_async(project.id, remote_name) job_id = RepositoryRemoveRemoteWorker.perform_async(project.id, remote_name)
if job_id if job_id
Rails.logger.info("Remove remote job scheduled for #{project.id} with remote name: #{remote_name} job ID #{job_id}.") Gitlab::AppLogger.info("Remove remote job scheduled for #{project.id} with remote name: #{remote_name} job ID #{job_id}.")
else else
Rails.logger.info("Remove remote job failed to create for #{project.id} with remote name #{remote_name}.") Gitlab::AppLogger.info("Remove remote job failed to create for #{project.id} with remote name #{remote_name}.")
end end
job_id job_id
end end
# rubocop:enable Gitlab/RailsLogger
def fetch_source_branch!(source_repository, source_branch, local_ref) def fetch_source_branch!(source_repository, source_branch, local_ref)
raw_repository.fetch_source_branch!(source_repository.raw_repository, source_branch, local_ref) raw_repository.fetch_source_branch!(source_repository.raw_repository, source_branch, local_ref)
......
...@@ -107,7 +107,7 @@ class SshHostKey ...@@ -107,7 +107,7 @@ class SshHostKey
if status.success? && !errors.present? if status.success? && !errors.present?
{ known_hosts: known_hosts } { known_hosts: known_hosts }
else else
Rails.logger.debug("Failed to detect SSH host keys for #{id}: #{errors}") # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.debug("Failed to detect SSH host keys for #{id}: #{errors}")
{ error: 'Failed to detect SSH host keys' } { error: 'Failed to detect SSH host keys' }
end end
......
...@@ -19,7 +19,7 @@ module Projects ...@@ -19,7 +19,7 @@ module Projects
def initialize(project:, old_disk_path:, logger: nil) def initialize(project:, old_disk_path:, logger: nil)
@project = project @project = project
@old_disk_path = old_disk_path @old_disk_path = old_disk_path
@logger = logger || Rails.logger # rubocop:disable Gitlab/RailsLogger @logger = logger || Gitlab::AppLogger
end end
# Return whether this operation was skipped or not # Return whether this operation was skipped or not
......
---
title: Move prepend to last in ee-app-services
merge_request: 31838
author: Rajendra Kadam
type: fixed
---
title: Fix leaky constant issue in diff collection spec
merge_request: 32163
author: Rajendra Kadam
type: fixed
---
title: Fix leaky constant issue in uninstall progress service check
merge_request: 32036
author: Rajendra Kadam
type: fixed
---
title: Use applogger in base attachment service
merge_request: 32201
author: Rajendra Kadam
type: fixed
---
title: Use applogger in repository model
merge_request: 32185
author: Rajendra Kadam
type: fixed
---
title: Use applogger in build and ssh host key
merge_request: 32187
author: Rajendra Kadam
type: fixed
...@@ -4,8 +4,6 @@ require 'flipper/adapters/active_record' ...@@ -4,8 +4,6 @@ require 'flipper/adapters/active_record'
require 'flipper/adapters/active_support_cache_store' require 'flipper/adapters/active_support_cache_store'
class Feature class Feature
prepend_if_ee('EE::Feature') # rubocop: disable Cop/InjectEnterpriseEditionModule
# Classes to override flipper table names # Classes to override flipper table names
class FlipperFeature < Flipper::Adapters::ActiveRecord::Feature class FlipperFeature < Flipper::Adapters::ActiveRecord::Feature
# Using `self.table_name` won't work. ActiveRecord bug? # Using `self.table_name` won't work. ActiveRecord bug?
...@@ -186,3 +184,5 @@ class Feature ...@@ -186,3 +184,5 @@ class Feature
end end
end end
end end
Feature.prepend_if_ee('EE::Feature')
...@@ -3,6 +3,31 @@ ...@@ -3,6 +3,31 @@
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::DiffCollection, :seed_helper do describe Gitlab::Git::DiffCollection, :seed_helper do
before do
stub_const('MutatingConstantIterator', Class.new)
MutatingConstantIterator.class_eval do
include Enumerable
def initialize(count, value)
@count = count
@value = value
end
def each
return enum_for(:each) unless block_given?
loop do
break if @count.zero?
# It is critical to decrement before yielding. We may never reach the lines after 'yield'.
@count -= 1
yield @value
end
end
end
end
subject do subject do
Gitlab::Git::DiffCollection.new( Gitlab::Git::DiffCollection.new(
iterator, iterator,
...@@ -659,25 +684,4 @@ describe Gitlab::Git::DiffCollection, :seed_helper do ...@@ -659,25 +684,4 @@ describe Gitlab::Git::DiffCollection, :seed_helper do
def fake_diff(line_length, line_count) def fake_diff(line_length, line_count)
{ 'diff' => "#{'a' * line_length}\n" * line_count } { 'diff' => "#{'a' * line_length}\n" * line_count }
end end
class MutatingConstantIterator
include Enumerable
def initialize(count, value)
@count = count
@value = value
end
def each
return enum_for(:each) unless block_given?
loop do
break if @count.zero?
# It is critical to decrement before yielding. We may never reach the lines after 'yield'.
@count -= 1
yield @value
end
end
end
end end
...@@ -3612,7 +3612,7 @@ describe Ci::Build do ...@@ -3612,7 +3612,7 @@ describe Ci::Build do
.to receive(:execute) .to receive(:execute)
.with(subject) .with(subject)
.and_raise(Gitlab::Access::AccessDeniedError) .and_raise(Gitlab::Access::AccessDeniedError)
allow(Rails.logger).to receive(:error) allow(Gitlab::AppLogger).to receive(:error)
end end
it 'handles raised exception' do it 'handles raised exception' do
...@@ -3622,7 +3622,7 @@ describe Ci::Build do ...@@ -3622,7 +3622,7 @@ describe Ci::Build do
it 'logs the error' do it 'logs the error' do
subject.drop! subject.drop!
expect(Rails.logger) expect(Gitlab::AppLogger)
.to have_received(:error) .to have_received(:error)
.with(a_string_matching("Unable to auto-retry job #{subject.id}")) .with(a_string_matching("Unable to auto-retry job #{subject.id}"))
end end
......
...@@ -974,7 +974,7 @@ describe Repository do ...@@ -974,7 +974,7 @@ describe Repository do
end end
it 'returns nil' do it 'returns nil' do
expect(Rails.logger).to receive(:info).with("Remove remote job failed to create for #{project.id} with remote name joe.") expect(Gitlab::AppLogger).to receive(:info).with("Remove remote job failed to create for #{project.id} with remote name joe.")
expect(repository.async_remove_remote('joe')).to be_nil expect(repository.async_remove_remote('joe')).to be_nil
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe Clusters::Applications::CheckUninstallProgressService do describe Clusters::Applications::CheckUninstallProgressService do
RESCHEDULE_PHASES = Gitlab::Kubernetes::Pod::PHASES - [Gitlab::Kubernetes::Pod::SUCCEEDED, Gitlab::Kubernetes::Pod::FAILED].freeze reschedule_phases = Gitlab::Kubernetes::Pod::PHASES - [Gitlab::Kubernetes::Pod::SUCCEEDED, Gitlab::Kubernetes::Pod::FAILED].freeze
let(:application) { create(:clusters_applications_prometheus, :uninstalling) } let(:application) { create(:clusters_applications_prometheus, :uninstalling) }
let(:service) { described_class.new(application) } let(:service) { described_class.new(application) }
...@@ -42,7 +42,7 @@ describe Clusters::Applications::CheckUninstallProgressService do ...@@ -42,7 +42,7 @@ describe Clusters::Applications::CheckUninstallProgressService do
end end
context 'when application is uninstalling' do context 'when application is uninstalling' do
RESCHEDULE_PHASES.each { |phase| it_behaves_like 'a not yet terminated installation', phase } reschedule_phases.each { |phase| it_behaves_like 'a not yet terminated installation', phase }
context 'when installation POD succeeded' do context 'when installation POD succeeded' do
let(:phase) { Gitlab::Kubernetes::Pod::SUCCEEDED } let(:phase) { Gitlab::Kubernetes::Pod::SUCCEEDED }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册