Skip to content

Commit 6e8be3a

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Test JRuby 10
Necessary changes to get tests passing are: * Rewrite one "out of memory" error spec to not define a subclass inside a RSpec context block. Due to some [JRuby issue], that's failing in JRuby 10, so I rewrote the test so that the Bundler process really goes OOM and that class definition is not necessary. * JRuby 10, even if Ruby 3.4-compatible, has not yet adapted backtraces to include receivers, so our tests need an special case for JRuby when detecting a test method call inside backtraces. * Warbler test is upgraded to use JRuby 10. Getting it to pass needs [a PR] to warbler, so our test is temporarily pointing to that PR. [JRuby issue]: jruby/jruby#8838 [a PR]: jruby/warbler#557 ruby/rubygems@edec85d4c3
1 parent bfab76a commit 6e8be3a

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

spec/bundler/bundler/friendly_errors_spec.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,13 @@
130130
# Does nothing
131131
end
132132

133-
context "Java::JavaLang::OutOfMemoryError" do
134-
module Java
135-
module JavaLang
136-
class OutOfMemoryError < StandardError; end
137-
end
138-
end
139-
133+
context "Java::JavaLang::OutOfMemoryError", :jruby_only do
140134
it "Bundler.ui receive error" do
141-
error = Java::JavaLang::OutOfMemoryError.new
142-
expect(Bundler.ui).to receive(:error).with(/JVM has run out of memory/)
143-
Bundler::FriendlyErrors.log_error(error)
135+
install_gemfile <<-G, raise_on_error: false, env: { "JRUBY_OPTS" => "-J-Xmx32M" }, artifice: nil
136+
source "https://gem.repo1"
137+
G
138+
139+
expect(err).to include("JVM has run out of memory")
144140
end
145141
end
146142

spec/bundler/realworld/fixtures/warbler/Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
source "https://rubygems.org"
44

55
gem "demo", path: "./demo"
6-
gem "jruby-jars", "~> 9.4"
7-
gem "warbler", "~> 2.0"
6+
gem "jruby-jars", "~> 10.0"
7+
gem "warbler", github: "https://github.com/jruby/warbler/pull/557"
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
GIT
2+
remote: https://github.com/jruby/warbler.git
3+
revision: 3a3a89e9a055ab1badb4e6fee860e8617b4acfe1
4+
ref: refs/pull/557/head
5+
specs:
6+
warbler (2.0.5)
7+
jruby-jars (>= 9.0.0)
8+
jruby-rack (>= 1.1.1, < 1.3)
9+
rake (>= 13.0.3)
10+
rexml (~> 3.0)
11+
rubyzip (>= 1.0.0)
12+
113
PATH
214
remote: demo
315
specs:
@@ -6,15 +18,11 @@ PATH
618
GEM
719
remote: https://rubygems.org/
820
specs:
9-
jruby-jars (9.4.10.0)
10-
jruby-rack (1.1.21)
11-
rake (13.0.1)
12-
rubyzip (1.3.0)
13-
warbler (2.0.5)
14-
jruby-jars (>= 9.0.0.0)
15-
jruby-rack (>= 1.1.1, < 1.3)
16-
rake (>= 10.1.0)
17-
rubyzip (~> 1.0, < 1.4)
21+
jruby-jars (10.0.0.1)
22+
jruby-rack (1.2.2)
23+
rake (13.2.1)
24+
rexml (3.4.1)
25+
rubyzip (2.4.1)
1826

1927
PLATFORMS
2028
arm64-darwin
@@ -24,8 +32,8 @@ PLATFORMS
2432

2533
DEPENDENCIES
2634
demo!
27-
jruby-jars (~> 9.4)
28-
warbler (~> 2.0)
35+
jruby-jars (~> 10.0)
36+
warbler!
2937

3038
BUNDLED WITH
3139
2.7.0.dev

spec/bundler/support/builders.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def build_repo(path, **kwargs, &blk)
277277
end
278278

279279
def update_repo(path, build_compact_index: true)
280-
exempted_caller = Gem.ruby_version >= Gem::Version.new("3.4.0.dev") ? "#{Module.nesting.first}#build_repo" : "build_repo"
280+
exempted_caller = Gem.ruby_version >= Gem::Version.new("3.4.0.dev") && RUBY_ENGINE != "jruby" ? "#{Module.nesting.first}#build_repo" : "build_repo"
281281
if path == gem_repo1 && caller_locations(1, 1).first.label != exempted_caller
282282
raise "Updating gem_repo1 is unsupported -- use gem_repo2 instead"
283283
end

0 commit comments

Comments
 (0)