diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-11-11 11:13:48 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-11-22 10:51:35 +0900 |
commit | b19b2e98675a132b4b4a59aa130fd5a9f65d775f (patch) | |
tree | 71fc95f6baedbe2b998fa14f5075b73d9c2d4478 /test | |
parent | e27381d289cbdbdca434bcc957c2cd1beab1c82c (diff) |
Merge RubyGems 3.2.31 and Bundler 2.2.31
Diffstat (limited to 'test')
-rw-r--r-- | test/rubygems/encrypted_private_key.pem | 52 | ||||
-rw-r--r-- | test/rubygems/helper.rb | 40 | ||||
-rw-r--r-- | test/rubygems/test_gem_command.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_cert_command.rb | 16 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_fetch_command.rb | 36 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_server_command.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_setup_command.rb | 69 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_signin_command.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_uninstall_command.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_yank_command.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_install_update_options.rb | 4 | ||||
-rw-r--r-- | test/rubygems/test_gem_request.rb | 14 | ||||
-rw-r--r-- | test/rubygems/test_gem_resolver.rb | 14 | ||||
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 11 |
14 files changed, 179 insertions, 91 deletions
diff --git a/test/rubygems/encrypted_private_key.pem b/test/rubygems/encrypted_private_key.pem index 868f332b7c..d9667689a6 100644 --- a/test/rubygems/encrypted_private_key.pem +++ b/test/rubygems/encrypted_private_key.pem @@ -1,30 +1,30 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-CBC,4E38D58B5A059DB6 +DEK-Info: AES-256-CBC,CB6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X0ahxQrfrbcl48//zR295u9POzCL97d6zpioI2NR -----END RSA PRIVATE KEY----- diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index c074f4bb15..9bd194f871 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -16,16 +16,6 @@ begin rescue Gem::LoadError end -begin - require 'simplecov' - SimpleCov.start do - add_filter "/test/" - add_filter "/bundler/" - add_filter "/lib/rubygems/resolver/molinillo" - end -rescue LoadError -end - if File.exist?(bundler_gemspec) require_relative '../../bundler/lib/bundler' else @@ -409,6 +399,14 @@ class Gem::TestCase < Test::Unit::TestCase @orig_bindir = RbConfig::CONFIG["bindir"] RbConfig::CONFIG["bindir"] = File.join @gemhome, "bin" + @orig_sitelibdir = RbConfig::CONFIG["sitelibdir"] + new_sitelibdir = @orig_sitelibdir.sub(RbConfig::CONFIG["prefix"], @gemhome) + $LOAD_PATH.insert(Gem.load_path_insert_index, new_sitelibdir) + RbConfig::CONFIG["sitelibdir"] = new_sitelibdir + + @orig_mandir = RbConfig::CONFIG["mandir"] + RbConfig::CONFIG["mandir"] = File.join @gemhome, "share", "man" + Gem::Specification.unresolved_deps.clear Gem.use_paths(@gemhome) @@ -480,6 +478,8 @@ class Gem::TestCase < Test::Unit::TestCase Gem.ruby = @orig_ruby if @orig_ruby + RbConfig::CONFIG['mandir'] = @orig_mandir + RbConfig::CONFIG['sitelibdir'] = @orig_sitelibdir RbConfig::CONFIG['bindir'] = @orig_bindir Gem.instance_variable_set :@default_specifications_dir, nil @@ -1084,19 +1084,23 @@ Also, a list: @fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"] = l_zip @fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip - v = Gem.marshal_version - - all_specs.each do |spec| - path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz" - data = Marshal.dump spec - data_deflate = Zlib::Deflate.deflate data - @fetcher.data[path] = data_deflate - end + write_marshalled_gemspecs(*all_specs) end nil # force errors end + def write_marshalled_gemspecs(*all_specs) + v = Gem.marshal_version + + all_specs.each do |spec| + path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz" + data = Marshal.dump spec + data_deflate = Zlib::Deflate.deflate data + @fetcher.data[path] = data_deflate + end + end + ## # Deflates +data+ diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index 43ce6ea39f..65b9b040b7 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -118,7 +118,7 @@ class TestGemCommand < Gem::TestCase use_ui @ui do @cmd.when_invoked { true } - ex = assert_raise OptionParser::InvalidOption do + ex = assert_raise Gem::OptionParser::InvalidOption do @cmd.invoke('-zzz') end diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb index 077be11d55..901bf5aed6 100644 --- a/test/rubygems/test_gem_commands_cert_command.rb +++ b/test/rubygems/test_gem_commands_cert_command.rb @@ -745,7 +745,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis def test_handle_options_add_bad nonexistent = File.join @tempdir, 'nonexistent' - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[--add #{nonexistent}] end @@ -755,7 +755,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis bad = File.join @tempdir, 'bad' FileUtils.touch bad - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[--add #{bad}] end @@ -765,7 +765,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis def test_handle_options_certificate nonexistent = File.join @tempdir, 'nonexistent' - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[--certificate #{nonexistent}] end @@ -775,7 +775,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis bad = File.join @tempdir, 'bad' FileUtils.touch bad - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[--certificate #{bad}] end @@ -786,7 +786,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis def test_handle_options_key_bad nonexistent = File.join @tempdir, 'nonexistent' - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[--private-key #{nonexistent}] end @@ -797,14 +797,14 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis bad = File.join @tempdir, 'bad' FileUtils.touch bad - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[--private-key #{bad}] end assert_equal "invalid argument: --private-key #{bad}: invalid RSA, DSA, or EC key", e.message - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[--private-key #{PUBLIC_KEY_FILE}] end @@ -851,7 +851,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis def test_handle_options_sign_nonexistent nonexistent = File.join @tempdir, 'nonexistent' - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %W[ --private-key #{ALTERNATE_KEY_FILE} diff --git a/test/rubygems/test_gem_commands_fetch_command.rb b/test/rubygems/test_gem_commands_fetch_command.rb index 35ee00f763..c745648d56 100644 --- a/test/rubygems/test_gem_commands_fetch_command.rb +++ b/test/rubygems/test_gem_commands_fetch_command.rb @@ -79,6 +79,42 @@ class TestGemCommandsFetchCommand < Gem::TestCase "#{a2.full_name} not fetched") end + def test_execute_platform + a2_spec, a2 = util_gem("a", "2") + + a2_universal_darwin_spec, a2_universal_darwin = util_gem("a", "2") do |s| + s.platform = 'universal-darwin' + end + + Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new + + write_marshalled_gemspecs(a2_spec, a2_universal_darwin_spec) + + @cmd.options[:args] = %w[a] + + @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = util_gzip(Marshal.dump([ + Gem::NameTuple.new(a2_spec.name, a2_spec.version, a2_spec.platform), + Gem::NameTuple.new(a2_universal_darwin_spec.name, a2_universal_darwin_spec.version, a2_universal_darwin_spec.platform), + ])) + + @fetcher.data["#{@gem_repo}gems/#{a2_spec.file_name}"] = Gem.read_binary(a2) + FileUtils.cp a2, a2_spec.cache_file + + @fetcher.data["#{@gem_repo}gems/#{a2_universal_darwin_spec.file_name}"] = Gem.read_binary(a2_universal_darwin) + FileUtils.cp a2_universal_darwin, a2_universal_darwin_spec.cache_file + + util_set_arch 'arm64-darwin20' do + use_ui @ui do + Dir.chdir @tempdir do + @cmd.execute + end + end + end + + assert_path_exist(File.join(@tempdir, a2_universal_darwin_spec.file_name), + "#{a2_universal_darwin_spec.full_name} not fetched") + end + def test_execute_specific_prerelease specs = spec_fetcher do |fetcher| fetcher.gem 'a', 2 diff --git a/test/rubygems/test_gem_commands_server_command.rb b/test/rubygems/test_gem_commands_server_command.rb index 09cec63c15..d5cd4d13bd 100644 --- a/test/rubygems/test_gem_commands_server_command.rb +++ b/test/rubygems/test_gem_commands_server_command.rb @@ -40,18 +40,18 @@ class TestGemCommandsServerCommand < Gem::TestCase begin @cmd.send :handle_options, %w[-p discard] assert_equal 9, @cmd.options[:port] - rescue OptionParser::InvalidArgument + rescue Gem::OptionParser::InvalidArgument # for container environment on GitHub Actions end - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.send :handle_options, %w[-p nonexistent] end assert_equal 'invalid argument: -p nonexistent: no such named service', e.message - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.send :handle_options, %w[-p 65536] end diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index 3aa6bfa2fe..50f99bc419 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -14,9 +14,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase def setup super - @install_dir = File.join @tempdir, 'install' @cmd = Gem::Commands::SetupCommand.new - @cmd.options[:prefix] = @install_dir filelist = %w[ bin/gem @@ -227,27 +225,60 @@ class TestGemCommandsSetupCommand < Gem::TestCase f.puts 'echo "hello"' end - bindir(bin_dir) do - @cmd.options[:force] = true + @cmd.options[:force] = true - @cmd.install_default_bundler_gem bin_dir - - bundler_spec = Gem::Specification.load("bundler/bundler.gemspec") - default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec") - spec = Gem::Specification.load(default_spec_path) + @cmd.install_default_bundler_gem bin_dir - spec.executables.each do |e| - if Gem.win_platform? - assert_path_exist File.join(bin_dir, "#{e}.bat") - end + bundler_spec = Gem::Specification.load("bundler/bundler.gemspec") + default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec") + spec = Gem::Specification.load(default_spec_path) - assert_path_exist File.join bin_dir, e + spec.executables.each do |e| + if Gem.win_platform? + assert_path_exist File.join(bin_dir, "#{e}.bat") end + + assert_path_exist File.join bin_dir, e + end + end + + def test_install_default_bundler_gem_with_destdir_flag + @cmd.extend FileUtils + + destdir = File.join(@tempdir, 'foo') + bin_dir = File.join(destdir, 'bin') + + @cmd.options[:destdir] = destdir + + @cmd.install_default_bundler_gem bin_dir + + spec = Gem::Specification.load("bundler/bundler.gemspec") + + spec.executables.each do |e| + assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e + end + end + + def test_install_default_bundler_gem_with_destdir_and_prefix_flags + @cmd.extend FileUtils + + destdir = File.join(@tempdir, 'foo') + bin_dir = File.join(destdir, 'bin') + + @cmd.options[:destdir] = destdir + @cmd.options[:prefix] = "/" + + @cmd.install_default_bundler_gem bin_dir + + spec = Gem::Specification.load("bundler/bundler.gemspec") + + spec.executables.each do |e| + assert_path_exist File.join destdir, 'gems', spec.full_name, spec.bindir, e end end def test_remove_old_lib_files - lib = File.join @install_dir, 'lib' + lib = RbConfig::CONFIG["sitelibdir"] lib_rubygems = File.join lib, 'rubygems' lib_bundler = File.join lib, 'bundler' lib_rubygems_defaults = File.join lib_rubygems, 'defaults' @@ -278,7 +309,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase end def test_remove_old_man_files - man = File.join @install_dir, 'man' + man = File.join RbConfig::CONFIG['mandir'], 'man' ruby_1 = File.join man, 'man1', 'ruby.1' bundle_b_1 = File.join man, 'man1', 'bundle-b.1' @@ -384,14 +415,14 @@ class TestGemCommandsSetupCommand < Gem::TestCase end def default_gem_bin_path - File.join @install_dir, 'bin', 'gem' + File.join RbConfig::CONFIG['bindir'], 'gem' end def default_bundle_bin_path - File.join @install_dir, 'bin', 'bundle' + File.join RbConfig::CONFIG['bindir'], 'bundle' end def default_bundler_bin_path - File.join @install_dir, 'bin', 'bundler' + File.join RbConfig::CONFIG['bindir'], 'bundler' end end unless Gem.java_platform? diff --git a/test/rubygems/test_gem_commands_signin_command.rb b/test/rubygems/test_gem_commands_signin_command.rb index eaf32886b3..0f856a53ba 100644 --- a/test/rubygems/test_gem_commands_signin_command.rb +++ b/test/rubygems/test_gem_commands_signin_command.rb @@ -80,7 +80,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase assert_equal api_key, credentials[:rubygems_api_key] end - def test_excute_with_key_name_and_scope + def test_execute_with_key_name_and_scope email = 'you@example.com' password = 'secret' api_key = '1234' diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb index 55f1049266..5bd2c40d59 100644 --- a/test/rubygems/test_gem_commands_uninstall_command.rb +++ b/test/rubygems/test_gem_commands_uninstall_command.rb @@ -436,7 +436,7 @@ WARNING: Use your OS package manager to uninstall vendor gems def test_handle_options_vendor_missing vendordir(nil) do - e = assert_raise OptionParser::InvalidOption do + e = assert_raise Gem::OptionParser::InvalidOption do @cmd.handle_options %w[--vendor] end diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb index 3b0956e1c4..b798eb3689 100644 --- a/test/rubygems/test_gem_commands_yank_command.rb +++ b/test/rubygems/test_gem_commands_yank_command.rb @@ -35,7 +35,7 @@ class TestGemCommandsYankCommand < Gem::TestCase def test_handle_options_missing_argument %w[-v --version -p --platform].each do |option| - assert_raise OptionParser::MissingArgument do + assert_raise Gem::OptionParser::MissingArgument do @cmd.handle_options %W[a #{option}] end end diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb index 33cb5c08bf..a499c2be3b 100644 --- a/test/rubygems/test_gem_install_update_options.rb +++ b/test/rubygems/test_gem_install_update_options.rb @@ -104,7 +104,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase @cmd.add_install_update_options - e = assert_raise OptionParser::InvalidArgument do + e = assert_raise Gem::OptionParser::InvalidArgument do @cmd.handle_options %w[-P UnknownSecurity] end assert_includes e.message, "UnknownSecurity" @@ -169,7 +169,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase def test_vendor_missing vendordir(nil) do - e = assert_raise OptionParser::InvalidOption do + e = assert_raise Gem::OptionParser::InvalidOption do @cmd.handle_options %w[--vendor] end diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb index 66477be7bc..47654f6fa4 100644 --- a/test/rubygems/test_gem_request.rb +++ b/test/rubygems/test_gem_request.rb @@ -354,30 +354,36 @@ class TestGemRequest < Gem::TestCase def test_verify_certificate pend if Gem.java_platform? + + error_number = OpenSSL::X509::V_ERR_OUT_OF_MEM + store = OpenSSL::X509::Store.new context = OpenSSL::X509::StoreContext.new store - context.error = OpenSSL::X509::V_ERR_OUT_OF_MEM + context.error = error_number use_ui @ui do Gem::Request.verify_certificate context end - assert_equal "ERROR: SSL verification error at depth 0: out of memory (17)\n", + assert_equal "ERROR: SSL verification error at depth 0: out of memory (#{error_number})\n", @ui.error end def test_verify_certificate_extra_message pend if Gem.java_platform? + + error_number = OpenSSL::X509::V_ERR_INVALID_CA + store = OpenSSL::X509::Store.new context = OpenSSL::X509::StoreContext.new store - context.error = OpenSSL::X509::V_ERR_INVALID_CA + context.error = error_number use_ui @ui do Gem::Request.verify_certificate context end expected = <<-ERROR -ERROR: SSL verification error at depth 0: invalid CA certificate (24) +ERROR: SSL verification error at depth 0: invalid CA certificate (#{error_number}) ERROR: Certificate is an invalid CA certificate ERROR diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb index eb798ad557..ea9f9049ce 100644 --- a/test/rubygems/test_gem_resolver.rb +++ b/test/rubygems/test_gem_resolver.rb @@ -266,14 +266,14 @@ class TestGemResolver < Gem::TestCase res = Gem::Resolver.new [a_dep], Gem::Resolver::IndexSet.new - e = assert_raise Gem::UnsatisfiableDepedencyError do + e = assert_raise Gem::UnsatisfiableDependencyError do res.resolve end refute_empty e.errors end - def test_no_overlap_specificly + def test_no_overlap_specifically a = util_spec "a", '1' b = util_spec "b", "1" @@ -469,7 +469,7 @@ class TestGemResolver < Gem::TestCase r = Gem::Resolver.new([ad], set) - e = assert_raise Gem::UnsatisfiableDepedencyError do + e = assert_raise Gem::UnsatisfiableDependencyError do r.resolve end @@ -486,7 +486,7 @@ class TestGemResolver < Gem::TestCase r = Gem::Resolver.new([ad], set(a1)) - e = assert_raise Gem::UnsatisfiableDepedencyError do + e = assert_raise Gem::UnsatisfiableDependencyError do r.resolve end @@ -499,7 +499,7 @@ class TestGemResolver < Gem::TestCase r = Gem::Resolver.new([ad], set(a1)) - e = assert_raise Gem::UnsatisfiableDepedencyError do + e = assert_raise Gem::UnsatisfiableDependencyError do r.resolve end @@ -516,7 +516,7 @@ class TestGemResolver < Gem::TestCase r = Gem::Resolver.new([ad], set(a1)) - e = assert_raise Gem::UnsatisfiableDepedencyError do + e = assert_raise Gem::UnsatisfiableDependencyError do r.resolve end @@ -781,7 +781,7 @@ class TestGemResolver < Gem::TestCase r = Gem::Resolver.new([ad], set(a1)) - e = assert_raise Gem::UnsatisfiableDepedencyError do + e = assert_raise Gem::UnsatisfiableDependencyError do r.resolve end diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 582813c01d..bfd0db347e 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -3066,6 +3066,17 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. WARNING end + def test_validate_license_ref + util_setup_validate + + use_ui @ui do + @a1.licenses = ['LicenseRef-LICENSE.md'] + @a1.validate + end + + assert_empty @ui.error + end + def test_validate_license_values_plus util_setup_validate |