提交 cc5890f2 编写于 作者: D Douwe Maan

Merge branch '46481-preserve-warnings-even-if-passed' into 'master'

Resolve "A lot of constants redefinition warnings"

Closes #46481

See merge request gitlab-org/gitlab-ce!19286
require 'gitlab/webpack/manifest'
module WebpackHelper module WebpackHelper
def webpack_bundle_tag(bundle) def webpack_bundle_tag(bundle)
javascript_include_tag(*webpack_entrypoint_paths(bundle)) javascript_include_tag(*webpack_entrypoint_paths(bundle))
......
require_relative '../../lib/gitlab' require_dependency 'gitlab'
...@@ -19,12 +19,5 @@ end ...@@ -19,12 +19,5 @@ end
if Gitlab.config.omniauth.enabled if Gitlab.config.omniauth.enabled
provider_names = Gitlab.config.omniauth.providers.map(&:name) provider_names = Gitlab.config.omniauth.providers.map(&:name)
require 'omniauth-kerberos' if provider_names.include?('kerberos') Gitlab::Auth.omniauth_setup_providers(provider_names)
end
module OmniAuth
module Strategies
autoload :Bitbucket, Rails.root.join('lib', 'omni_auth', 'strategies', 'bitbucket')
autoload :Jwt, Rails.root.join('lib', 'omni_auth', 'strategies', 'jwt')
end
end end
...@@ -14,6 +14,25 @@ module Gitlab ...@@ -14,6 +14,25 @@ module Gitlab
DEFAULT_SCOPES = [:api].freeze DEFAULT_SCOPES = [:api].freeze
class << self class << self
def omniauth_customized_providers
@omniauth_customized_providers ||= %w[bitbucket jwt]
end
def omniauth_setup_providers(provider_names)
provider_names.each do |provider|
omniauth_setup_a_provider(provider)
end
end
def omniauth_setup_a_provider(provider)
case provider
when 'kerberos'
require 'omniauth-kerberos'
when *omniauth_customized_providers
require_dependency "omni_auth/strategies/#{provider}"
end
end
def find_for_git_client(login, password, project:, ip:) def find_for_git_client(login, password, project:, ip:)
raise "Must provide an IP for rate limiting" if ip.nil? raise "Must provide an IP for rate limiting" if ip.nil?
......
...@@ -3,7 +3,7 @@ require 'jwt' ...@@ -3,7 +3,7 @@ require 'jwt'
module OmniAuth module OmniAuth
module Strategies module Strategies
class JWT class Jwt
ClaimInvalid = Class.new(StandardError) ClaimInvalid = Class.new(StandardError)
include OmniAuth::Strategy include OmniAuth::Strategy
...@@ -56,7 +56,5 @@ module OmniAuth ...@@ -56,7 +56,5 @@ module OmniAuth
fail! :claim_invalid, e fail! :claim_invalid, e
end end
end end
class Jwt < JWT; end
end end
end end
require 'json' require 'json'
require_relative 'config' require_dependency 'rspec_flaky/config'
require_relative 'example' require_dependency 'rspec_flaky/example'
require_relative 'flaky_example' require_dependency 'rspec_flaky/flaky_example'
require_relative 'flaky_examples_collection' require_dependency 'rspec_flaky/flaky_examples_collection'
require_relative 'report' require_dependency 'rspec_flaky/report'
module RspecFlaky module RspecFlaky
class Listener class Listener
......
require 'json' require 'json'
require 'time' require 'time'
require_relative 'config' require_dependency 'rspec_flaky/config'
require_relative 'flaky_examples_collection' require_dependency 'rspec_flaky/flaky_examples_collection'
module RspecFlaky module RspecFlaky
# This class is responsible for loading/saving JSON reports, and pruning # This class is responsible for loading/saving JSON reports, and pruning
......
...@@ -30,11 +30,12 @@ unless Rails.env.production? ...@@ -30,11 +30,12 @@ unless Rails.env.production?
lint:static_verification lint:static_verification
].each do |task| ].each do |task|
pid = Process.fork do pid = Process.fork do
rd, wr = IO.pipe rd_out, wr_out = IO.pipe
rd_err, wr_err = IO.pipe
stdout = $stdout.dup stdout = $stdout.dup
stderr = $stderr.dup stderr = $stderr.dup
$stdout.reopen(wr) $stdout.reopen(wr_out)
$stderr.reopen(wr) $stderr.reopen(wr_err)
begin begin
begin begin
...@@ -48,14 +49,13 @@ unless Rails.env.production? ...@@ -48,14 +49,13 @@ unless Rails.env.production?
ensure ensure
$stdout.reopen(stdout) $stdout.reopen(stdout)
$stderr.reopen(stderr) $stderr.reopen(stderr)
wr.close wr_out.close
wr_err.close
if msg warn "\n#{msg}\n\n" if msg
warn "\n#{msg}\n\n"
IO.copy_stream(rd, $stderr) IO.copy_stream(rd_out, $stdout)
else IO.copy_stream(rd_err, $stderr)
IO.copy_stream(rd, $stdout)
end
end end
end end
......
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
# gem manually on the CI # gem manually on the CI
require 'rubygems' require 'rubygems'
require_relative '../lib/rspec_flaky/report' # In newer Ruby, alias_method is not private then we don't need __send__
singleton_class.__send__(:alias_method, :require_dependency, :require) # rubocop:disable GitlabSecurity/PublicSend
$:.unshift(File.expand_path('../lib', __dir__))
require 'rspec_flaky/report'
report_file = ARGV.shift report_file = ARGV.shift
unless report_file unless report_file
......
...@@ -43,7 +43,7 @@ describe OmniAuth::Strategies::Jwt do ...@@ -43,7 +43,7 @@ describe OmniAuth::Strategies::Jwt do
end end
it 'raises error' do it 'raises error' do
expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::JWT::ClaimInvalid) expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::Jwt::ClaimInvalid)
end end
end end
...@@ -61,7 +61,7 @@ describe OmniAuth::Strategies::Jwt do ...@@ -61,7 +61,7 @@ describe OmniAuth::Strategies::Jwt do
end end
it 'raises error' do it 'raises error' do
expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::JWT::ClaimInvalid) expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::Jwt::ClaimInvalid)
end end
end end
...@@ -80,7 +80,7 @@ describe OmniAuth::Strategies::Jwt do ...@@ -80,7 +80,7 @@ describe OmniAuth::Strategies::Jwt do
end end
it 'raises error' do it 'raises error' do
expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::JWT::ClaimInvalid) expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::Jwt::ClaimInvalid)
end end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册