Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/rspec_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,4 +91,4 @@ jobs:
sudo apt remove rpm
fi

bundle exec rake parallel:spec
bundle exec rake parallel:spec[2]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion lib/puppet/face/facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion spec/unit/application/facts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Loading