Jira (FACT-3154) Update tests for Ruby 3.2

17 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Sep 30, 2022, 1:09:02 AM9/30/22
to puppe...@googlegroups.com
Josh Cooper created an issue
 
Facter / Task FACT-3154
Update tests for Ruby 3.2
Issue Type: Task Task
Assignee: Unassigned
Created: 2022/09/29 10:08 PM
Priority: Normal Normal
Reporter: Josh Cooper

Tests currently fail against rspec 3.2 preview 2

Failures:
 
  1) LegacyFacter::Util::DirectoryLoader does nothing bad when dir doesn't exist
     Failure/Error: allow(FileTest).to receive(:exists?).with(my_loader.directories[0]).and_return(false)
       FileTest does not implement: exists?
     # ./spec/custom_facts/util/directory_loader_spec.rb:19:in `block (2 levels) in <top (required)>'
 
  2) LegacyFacter::Util::Parser LegacyFacter::Util::Parser::YamlParser#parse_results when yaml contains Date formatted fields loads date
     Failure/Error: expect(yaml_parser.parse_results).to eq(expected_result)
     
       expected: {"testsfact"=>{"date"=>#<Date: 2020-04-28 ((2458968j,0s,0n),+0s,2299161j)>}}
            got: {"testsfact"=>{"date"=>"2020-04-28"}}
     
       (compared using ==)
     
       Diff:
       @@ -1 +1 @@
       -"testsfact" => {"date"=>#<Date: 2020-04-28 ((2458968j,0s,0n),+0s,2299161j)>},
       +"testsfact" => {"date"=>"2020-04-28"},
       
     # ./spec/custom_facts/util/parser_spec.rb:359:in `block (5 levels) in <top (required)>'
 
  3) Facter::Util::Linux::SocketParser#retrieve_interfaces when Ifaddr.addr.getnameinfo throws SocketError does not retrieve mac for ens160
     Failure/Error: mac if !mac.nil? && mac != '00:00:00:00:00:00' && mac =~ /^([0-9A-Fa-f]{2}[:-]){5,19}([0-9A-Fa-f]{2})$/
       the Facter::Log class does not implement the instance method: =~
     # ./lib/facter/util/linux/socket_parser.rb:39:in `search_for_mac'
     # ./lib/facter/util/linux/socket_parser.rb:32:in `mac'
     # ./lib/facter/util/linux/socket_parser.rb:25:in `populate_interface_info'
     # ./lib/facter/util/linux/socket_parser.rb:13:in `block in retrieve_interfaces'
     # ./lib/facter/util/linux/socket_parser.rb:12:in `each'
     # ./lib/facter/util/linux/socket_parser.rb:12:in `retrieve_interfaces'
     # ./spec/facter/util/linux/socket_parser_spec.rb:210:in `block (4 levels) in <top (required)>'
 
  4) Facter::Util::Linux::SocketParser#retrieve_interfaces when Ifaddr.addr.inspect_sockaddr throws SocketError does not retrieve mac for ens160
     Failure/Error: mac if !mac.nil? && mac != '00:00:00:00:00:00' && mac =~ /^([0-9A-Fa-f]{2}[:-]){5,19}([0-9A-Fa-f]{2})$/
       the Facter::Log class does not implement the instance method: =~
     # ./lib/facter/util/linux/socket_parser.rb:39:in `search_for_mac'
     # ./lib/facter/util/linux/socket_parser.rb:32:in `mac'
     # ./lib/facter/util/linux/socket_parser.rb:25:in `populate_interface_info'
     # ./lib/facter/util/linux/socket_parser.rb:13:in `block in retrieve_interfaces'
     # ./lib/facter/util/linux/socket_parser.rb:12:in `each'
     # ./lib/facter/util/linux/socket_parser.rb:12:in `retrieve_interfaces'
     # ./spec/facter/util/linux/socket_parser_spec.rb:248:in `block (4 levels) in <top (required)>'
 
Finished in 3.35 seconds (files took 1.43 seconds to load)
3596 examples, 4 failures
 
Failed examples:
 
rspec ./spec/custom_facts/util/directory_loader_spec.rb:16 # LegacyFacter::Util::DirectoryLoader does nothing bad when dir doesn't exist
rspec ./spec/custom_facts/util/parser_spec.rb:356 # LegacyFacter::Util::Parser LegacyFacter::Util::Parser::YamlParser#parse_results when yaml contains Date formatted fields loads date
rspec ./spec/facter/util/linux/socket_parser_spec.rb:201 # Facter::Util::Linux::SocketParser#retrieve_interfaces when Ifaddr.addr.getnameinfo throws SocketError does not retrieve mac for ens160
rspec ./spec/facter/util/linux/socket_parser_spec.rb:239 # Facter::Util::Linux::SocketParser#retrieve_interfaces when Ifaddr.addr.inspect_sockaddr throws SocketError does not retrieve mac for ens160

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

unread,
Sep 30, 2022, 1:10:01 AM9/30/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Phoenix

Michael Hashizume (Jira)

unread,
Oct 4, 2022, 6:40:02 PM10/4/22
to puppe...@googlegroups.com
Michael Hashizume updated an issue
Change By: Michael Hashizume
Sprint: Phoenix 2022-10- 26 12

Michael Hashizume (Jira)

unread,
Oct 4, 2022, 6:40:03 PM10/4/22
to puppe...@googlegroups.com
Michael Hashizume assigned an issue to Michael Hashizume
Change By: Michael Hashizume
Assignee: Michael Hashizume

Michael Hashizume (Jira)

unread,
Oct 4, 2022, 6:41:05 PM10/4/22
to puppe...@googlegroups.com
Michael Hashizume updated an issue
Change By: Michael Hashizume
Story Points: 3

Michael Hashizume (Jira)

unread,
Oct 5, 2022, 12:41:02 PM10/5/22
to puppe...@googlegroups.com
Michael Hashizume commented on Task FACT-3154
 
Re: Update tests for Ruby 3.2

I believe that the YAML parser failure is related to this bug: https://bugs.ruby-lang.org/issues/18946 , which the author says also affects Psych

Michael Hashizume (Jira)

unread,
Oct 5, 2022, 6:03:02 PM10/5/22
to puppe...@googlegroups.com

We looked at the socket spec failures today. Starting with 3.2.0preview1, the two tests in spec/facter/util/linux/socket_parser_spec.rb that use this line:

expect(socket_parser.retrieve_interfaces(log_spy)).to eq(expected)

Fail in an unexpected way. The retrieve_interfaces method tries to use the logging double as interface address information, even though we've mocked out `ifaddrs` in the test.

This seems like a bug, but I can't quite identify where things are breaking down. For now, I'm going to skip these two tests for 3.2 only.

Michael Hashizume (Jira)

unread,
Oct 5, 2022, 7:37:02 PM10/5/22
to puppe...@googlegroups.com

Deleted some of my earlier comments that had incorrect information about why tests were failing.

Josh Cooper (Jira)

unread,
Oct 12, 2022, 11:58:03 AM10/12/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Release Notes: Not Needed

Aria Li (Jira)

unread,
Nov 30, 2022, 6:52:01 PM11/30/22
to puppe...@googlegroups.com
Aria Li updated an issue
Change By: Aria Li
Fix Version/s: FACT 4.2.14

Aria Li (Jira)

unread,
Nov 30, 2022, 7:31:02 PM11/30/22
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages