Add Bundler tests.

* Add `make test-bundler-parallel` executed on the upstream CI.
  See <41a48535d1/.github/workflows/ubuntu.yml (L22)>.
* The tests are disabled as a default, as it requires the internet.
  Run the Bundler tests as follows.
  ```
  $ mock --with bundler_tests ruby-3.1.0-161.fc37.src.rpm
  ```
* Fix a test for `bin/bundle update --bundler` in `make test-bundler`.
This commit is contained in:
Jun Aruga 2022-03-04 13:50:28 +01:00
parent aee17a2180
commit 796a198176
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From bfa2f72cfa3bfde34049d26dcb24976316074ad7 Mon Sep 17 00:00:00 2001
From: Jun Aruga <jaruga@redhat.com>
Date: Mon, 21 Mar 2022 15:36:51 +0100
Subject: [PATCH] Fix a test for `bin/bundle update --bundler` to pass on
ruby/ruby.
Consider the case that the latest Bundler version on RubyGems is higher than
the `system_bundler_version` (= `Bundler::VERSION`) in `make test-bundler` on
ruby/ruby.
See <https://bugs.ruby-lang.org/issues/18643>.
---
spec/bundler/commands/binstubs_spec.rb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 198226207bc..2634f43417c 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/commands/binstubs_spec.rb
@@ -226,7 +226,10 @@
it "calls through to the latest bundler version" do
sys_exec "bin/bundle update --bundler", :env => { "DEBUG" => "1" }
- expect(out).to include %(Using bundler #{system_bundler_version}\n)
+ using_bundler_line = /Using bundler ([\w\.]+)\n/.match(out)
+ expect(using_bundler_line).to_not be_nil
+ latest_version = using_bundler_line[1]
+ expect(Gem::Version.new(latest_version)).to be >= Gem::Version.new(system_bundler_version)
end
it "calls through to the explicit bundler version" do

View File

@ -85,6 +85,8 @@
%bcond_without gmp %bcond_without gmp
%bcond_without hostname %bcond_without hostname
%bcond_without systemtap %bcond_without systemtap
# Enable test when building on local.
%bcond_with bundler_tests
%if 0%{?fedora} %if 0%{?fedora}
%bcond_without hardening_test %bcond_without hardening_test
@ -161,6 +163,10 @@ Patch7: ruby-3.1.0-Don-t-query-RubyVM-FrozenCore-for-class-path.patch
# Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. # Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add.
# https://bugs.ruby-lang.org/issues/16492 # https://bugs.ruby-lang.org/issues/16492
Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch
# Fix a test for `bin/bundle update --bundler` in `make test-bundler`.
# https://bugs.ruby-lang.org/issues/18643
# https://github.com/rubygems/rubygems/commit/bfa2f72cfa3bfde34049d26dcb24976316074ad7
Patch20: ruby-bundler-2.4.0-bundle-update-bundler-test-in-ruby.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Suggests: rubypick Suggests: rubypick
@ -186,6 +192,8 @@ BuildRequires: multilib-rpm-config
BuildRequires: gcc BuildRequires: gcc
BuildRequires: make BuildRequires: make
BuildRequires: zlib-devel BuildRequires: zlib-devel
# The bundler/spec/runtime/setup_spec.rb requires the command `man`.
%{?with_bundler_tests:BuildRequires: %{_bindir}/man}
# This package provides %%{_bindir}/ruby-mri therefore it is marked by this # This package provides %%{_bindir}/ruby-mri therefore it is marked by this
# virtual provide. It can be installed as dependency of rubypick. # virtual provide. It can be installed as dependency of rubypick.
@ -623,6 +631,7 @@ rm -rf ext/fiddle/libffi*
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch19 -p1 %patch19 -p1
%patch20 -p1
# Provide an example of usage of the tapset: # Provide an example of usage of the tapset:
cp -a %{SOURCE3} . cp -a %{SOURCE3} .
@ -938,6 +947,8 @@ mv test/fiddle/test_import.rb{,.disable}
%{?test_timeout_scale:RUBY_TEST_TIMEOUT_SCALE="%{test_timeout_scale}"} \ %{?test_timeout_scale:RUBY_TEST_TIMEOUT_SCALE="%{test_timeout_scale}"} \
make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS"
%{?with_bundler_tests:make test-bundler-parallel}
%files %files
%license BSDL %license BSDL
%license COPYING %license COPYING