Jira (PUP-11406) Update tests for Ruby 3.2

4 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Sep 30, 2022, 1:27:03 AM9/30/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Puppet / Bug PUP-11406
Update tests for Ruby 3.2
Change By: Josh Cooper
Summary: Update tests for Ruby 3. 1 2
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

unread,
Oct 7, 2022, 12:56:02 PM10/7/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Issue Type: Bug Task

Josh Cooper (Jira)

unread,
Oct 7, 2022, 12:56:03 PM10/7/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Puppet rspec tests currently fail on Ruby 3.1:

{noformat}
rspec ./spec/unit/reports/store_spec.rb:23 # Puppet::Reports::Store#process should create a report directory for the client if one doesn't exist
rspec ./spec/unit/reports/store_spec.rb:29 # Puppet::Reports::Store#process should write the report to the file in YAML
rspec ./spec/unit/reports/store_spec.rb:36 # Puppet::Reports::Store#process rejects invalid hostnames
rspec ./spec/unit/util/storage_spec.rb:170 # Puppet::Util::Storage when loading from the state file when the state file/directory exists should load Time and Symbols
rspec ./spec/unit/network/formats_spec.rb:506 # Puppet Network Format :console format when rendering face-related objects pretty prints facts
rspec ./spec/unit/x509/cert_provider_spec.rb:127 # Puppet::X509::CertProvider when loading crls and input is invalid raises when invalid input is inside BEGIN-END block
rspec ./spec/unit/http/service/compiler_spec.rb:591 # Puppet::HTTP::Service::Compiler when putting facts raises a serialization error if the report cannot be serialized
{noformat}

The failures can be grouped into a few different buckets:

1. Ruby 3.1 vendors Psych 4.0, which changed YAML.load to behave like YAML.safe_load. To get the unsafe behavior you have to call YAML.unsafe_load explicitly, which our tests are relying on to load an old report format.

2. Ruby 3.1 no longer accepts certain Time strings:

{noformat}
  1) Puppet Network Format :console format when rendering face-related objects pretty prints facts
     Failure/Error: tm = Time.new("2016-01-27T19:30:00")
     ArgumentError:
       invalid value for Integer(): "2016-01-27T19:30:00"
{noformat}

3. Ruby 3.1 changed the error messages associated with some openssl and string encoding errors, e.g.

{noformat}
expected OpenSSL::X509::CRLError with "nested asn1 error", got #<OpenSSL::X509::CRLError: PEM_read_bio_X509_CRL: bad base64 decode>

expected Puppet::HTTP::SerializationError with message matching /Failed to serialize Puppet::Node::Facts to json: "\\xE2" from ASCII-8BIT to UTF-8/, got #<Puppet::HTTP::SerializationError: Failed to serialize Puppet::Node::Facts to json: partial character in source, but hit end
{noformat}

Once the failures are resolved, add 4. Fast-gettext is not compatible with Ruby 3. 1 in GH actions for Ubuntu (and Windows if 2, because it calls String#untaint and that method was removed. We ' s available) ll need to bump our dependency on fast-gettext to "~> 2.1", see related ticket PA-4725
Reply all
Reply to author
Forward
0 new messages