Skip to content

Commit ab460e6

Browse files
committed
Update JRuby in tests to 9.4.7.0
This commit updates the version of JRuby used in spec tests from 9.4.3.0 to 9.4.7.0, which matches what is used in the latest version of Puppet Server 8.x. (See: puppetlabs/jruby-utils@1180711.) JRuby 9.4.7.0 includes bug fixes to several issues that we have worked around in Puppet in the past: - Dir.glob not properly supporting wildcard syntax (worked around in Puppet in 663062a, resolved in JRuby in jruby/jruby@a39cd49). - format and sprintf not supporting %a and %A (worked aroundin Puppet in 334ea05, resolved in JRuby in jruby/jruby#7996). Because of these bug fixes in JRuby, this commit also removes Puppet's workarounds.
1 parent b0d63e5 commit ab460e6

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

.github/workflows/rspec_tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- {os: ubuntu-latest, ruby: '3.1'}
2020
- {os: ubuntu-20.04, ruby: '3.2'} # openssl 1.1.1
2121
- {os: ubuntu-22.04, ruby: '3.2'} # openssl 3
22-
- {os: ubuntu-latest, ruby: 'jruby-9.4.3.0'}
22+
- {os: ubuntu-latest, ruby: 'jruby-9.4.7.0'}
2323
- {os: windows-2019, ruby: '3.1'}
2424
- {os: windows-2019, ruby: '3.2'} # openssl 3
2525

lib/puppet/node/environment.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -593,12 +593,10 @@ def perform_initial_import
593593
if file == NO_MANIFEST
594594
empty_parse_result
595595
elsif File.directory?(file)
596-
# JRuby does not properly perform Dir.glob operations with wildcards, (see PUP-11788 and https://github.com/jruby/jruby/issues/7836).
597-
# We sort the results because Dir.glob order is inconsistent in Ruby < 3 (see PUP-10115).
598-
parse_results = Puppet::FileSystem::PathPattern.absolute(File.join(file, '**/*')).glob.select { |globbed_file| globbed_file.end_with?('.pp') }.sort.map do |file_to_parse|
596+
parse_results = Puppet::FileSystem::PathPattern.absolute(File.join(file, '**/*.pp')).glob.map do | file_to_parse |
599597
parser.file = file_to_parse
600598
parser.parse
601-
end
599+
end
602600
# Use a parser type specific merger to concatenate the results
603601
Puppet::Parser::AST::Hostclass.new('', :code => Puppet::Parser::ParserFactory.code_merger.concatenate(parse_results))
604602
else

spec/unit/file_system/path_pattern_spec.rb

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'spec_helper'
22
require 'puppet_spec/files'
33
require 'puppet/file_system'
4-
require 'puppet/util'
54

65
describe Puppet::FileSystem::PathPattern do
76
include PuppetSpec::Files
@@ -134,9 +133,6 @@
134133
end
135134

136135
it 'globs wildcard patterns properly' do
137-
# See PUP-11788 and https://github.com/jruby/jruby/issues/7836.
138-
pending 'JRuby does not properly handle Dir.glob' if Puppet::Util::Platform.jruby?
139-
140136
dir = tmpdir('globtest')
141137
create_file_in(dir, 'foo.pp')
142138
create_file_in(dir, 'foo.pp.pp')

spec/unit/pops/types/string_converter_spec.rb

+2-11
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@
300300
'%o' => '22',
301301
'%4.2o' => ' 22',
302302
'%#o' => '022',
303+
'%#6.4o' => ' 0022',
303304
'%b' => '10010',
304305
'%7.6b' => ' 010010',
305306
'%#b' => '0b10010',
@@ -316,18 +317,11 @@
316317
'%.1f' => '18.0',
317318
}.each do |fmt, result |
318319
it "the format #{fmt} produces #{result}" do
319-
pending("PUP-8612 %a and %A not support on JRuby") if RUBY_PLATFORM == 'java' && fmt =~ /^%[aA]$/
320320
string_formats = { Puppet::Pops::Types::PIntegerType::DEFAULT => fmt}
321321
expect(converter.convert(18, string_formats)).to eq(result)
322322
end
323323
end
324324

325-
it 'the format %#6.4o produces 0022' do
326-
string_formats = { Puppet::Pops::Types::PIntegerType::DEFAULT => '%#6.4o' }
327-
result = RUBY_PLATFORM == 'java' ? ' 00022' : ' 0022'
328-
expect(converter.convert(18, string_formats)).to eq(result)
329-
end
330-
331325
it 'produces a unicode char string by using format %c' do
332326
string_formats = { Puppet::Pops::Types::PIntegerType::DEFAULT => '%c'}
333327
expect(converter.convert(0x1F603, string_formats)).to eq("\u{1F603}")
@@ -410,7 +404,6 @@
410404
'%#B' => '0B10010',
411405
}.each do |fmt, result |
412406
it "the format #{fmt} produces #{result}" do
413-
pending("PUP-8612 %a and %A not support on JRuby") if RUBY_PLATFORM == 'java' && fmt =~ /^%[-.014]*[aA]$/
414407
string_formats = { Puppet::Pops::Types::PFloatType::DEFAULT => fmt}
415408
expect(converter.convert(18.0, string_formats)).to eq(result)
416409
end
@@ -587,7 +580,6 @@
587580
"%#Y" => 'Y',
588581
}.each do |fmt, result |
589582
it "the format #{fmt} produces #{result}" do
590-
pending("PUP-8612 %a and %A not support on JRuby") if RUBY_PLATFORM == 'java' && fmt =~ /^%[aA]$/
591583
string_formats = { Puppet::Pops::Types::PBooleanType::DEFAULT => fmt}
592584
expect(converter.convert(true, string_formats)).to eq(result)
593585
end
@@ -634,7 +626,6 @@
634626
"%#Y" => 'N',
635627
}.each do |fmt, result |
636628
it "the format #{fmt} produces #{result}" do
637-
pending("PUP-8612 %a and %A not support on JRuby") if RUBY_PLATFORM == 'java' && fmt =~ /^%[aA]$/
638629
string_formats = { Puppet::Pops::Types::PBooleanType::DEFAULT => fmt}
639630
expect(converter.convert(false, string_formats)).to eq(result)
640631
end
@@ -692,7 +683,7 @@
692683
short_array_t => "%(a",
693684
long_array_t => "%[a",
694685
}
695-
expect(converter.convert([1, 2], string_formats)).to eq('(1, 2)') unless RUBY_PLATFORM == 'java' # PUP-8615
686+
expect(converter.convert([1, 2], string_formats)).to eq('(1, 2)')
696687
expect(converter.convert([1, 2, 3], string_formats)).to eq('[1, 2, 3]')
697688
end
698689

0 commit comments

Comments
 (0)