diff --git a/.github/workflows/rspec_tests.yaml b/.github/workflows/rspec_tests.yaml index c9e9fbbd80..a34a627da5 100644 --- a/.github/workflows/rspec_tests.yaml +++ b/.github/workflows/rspec_tests.yaml @@ -20,7 +20,14 @@ jobs: - {os: ubuntu-24.04, ruby: '3.2'} # openssl 3 - {os: ubuntu-24.04, ruby: '3.3'} # openssl 3 - {os: ubuntu-24.04, ruby: '3.4'} # openssl 3 - - {os: ubuntu-24.04, ruby: 'jruby-9.4'} + - {os: ubuntu-22.04, ruby: 'jruby-9.4.3'} + - {os: ubuntu-22.04, ruby: 'jruby-9.4.3'} # what Perforce used in their CI + - {os: ubuntu-22.04, ruby: 'jruby-9.4.4'} + - {os: ubuntu-22.04, ruby: 'jruby-9.4.5'} + - {os: ubuntu-22.04, ruby: 'jruby-9.4.6'} + - {os: ubuntu-22.04, ruby: 'jruby-9.4.7'} + - {os: ubuntu-22.04, ruby: 'jruby-9.4.8' } # what Openvox packages + - {os: ubuntu-22.04, ruby: 'jruby-9.4.13' } # latest - {os: windows-2019, ruby: '3.1'} - {os: windows-2019, ruby: '3.2'} # openssl 3 - {os: windows-2019, ruby: '3.3'} # openssl 3 / latest Ruby @@ -84,4 +91,4 @@ jobs: sudo apt remove rpm fi - bundle exec rake parallel:spec + bundle exec rake parallel:spec[2] diff --git a/Gemfile b/Gemfile index 1d95b68e31..0259dab594 100644 --- a/Gemfile +++ b/Gemfile @@ -49,7 +49,7 @@ group(:test) do gem "rspec-its", "~> 1.1", require: false gem 'rspec-mocks', '< 3.13.3', require: false # breaking change afterwards: https://github.com/rspec/rspec-mocks/pull/1596 gem 'vcr', '~> 6.1', require: false - gem 'webmock', '~> 3.0', require: false + gem 'webmock', '~> 3.0', '< 3.25', require: false gem 'webrick', '~> 1.7', require: false gem 'yard', require: false diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 1075411208..3e9cdf32ec 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -167,7 +167,15 @@ case result when Array, Hash - Puppet::Util::Json.dump(result, :pretty => true) + # JSON < 2.8.0 would pretty print empty arrays and hashes with newlines + # Maintain that behavior for our users for now + if result.is_a?(Array) && result.empty? + "[\n\n]" + elsif result.is_a?(Hash) && result.empty? + "{\n}" + else + Puppet::Util::Json.dump(result, :pretty => true) + end else # one of VALID_TYPES above result end diff --git a/spec/unit/application/facts_spec.rb b/spec/unit/application/facts_spec.rb index a7e5106a11..c3aecd0425 100644 --- a/spec/unit/application/facts_spec.rb +++ b/spec/unit/application/facts_spec.rb @@ -91,7 +91,8 @@ { "type_hash" => [{'a' => 2}, "{\n \"a\": 2\n}"], - "type_array" => [[], "[]"], + "type_empty_hash" => [{}, "{\n}"], + "type_array" => [[], "[\n\n]"], "type_string" => ["str", "str"], "type_int" => [1, "1"], "type_float" => [1.0, "1.0"],