Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rspec testsuite fails with ruby 3.3.0dev #73

Closed
mtasaka opened this issue Sep 26, 2023 · 1 comment · Fixed by #74
Closed

rspec testsuite fails with ruby 3.3.0dev #73

mtasaka opened this issue Sep 26, 2023 · 1 comment · Fixed by #74
Assignees
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@mtasaka
Copy link
Contributor

mtasaka commented Sep 26, 2023

With ruby 3.3.0dev ( I tested ruby/ruby@6d7730a ), mixlib-log git head ( 8643e33 ) rspec testsuite causes error like:

$ rspec spec
.....
Failures:

  1) Mixlib::Log::Child can query the parent's level at debug
     Failure/Error: logger.send(method_name)

     NoMethodError:
       undefined method `[]' for nil
     # ./lib/mixlib/log.rb:131:in `block (2 levels) in <module:Log>'
     # ./lib/mixlib/log/child.rb:41:in `block (2 levels) in <class:Child>'
     # ./spec/mixlib/log/child_spec.rb:95:in `block (4 levels) in <top (required)>'

  2) Mixlib::Log::Child can query the parent's level at info
     Failure/Error: logger.send(method_name)

     NoMethodError:
       undefined method `[]' for nil
     # ./lib/mixlib/log.rb:131:in `block (2 levels) in <module:Log>'
     # ./lib/mixlib/log/child.rb:41:in `block (2 levels) in <class:Child>'
     # ./spec/mixlib/log/child_spec.rb:95:in `block (4 levels) in <top (required)>'

  3) Mixlib::Log::Child can query the parent's level at warn
     Failure/Error: logger.send(method_name)

     NoMethodError:
       undefined method `[]' for nil
     # ./lib/mixlib/log.rb:131:in `block (2 levels) in <module:Log>'
     # ./lib/mixlib/log/child.rb:41:in `block (2 levels) in <class:Child>'
     # ./spec/mixlib/log/child_spec.rb:95:in `block (4 levels) in <top (required)>'

  4) Mixlib::Log::Child can query the parent's level at error
     Failure/Error: logger.send(method_name)

     NoMethodError:
       undefined method `[]' for nil
     # ./lib/mixlib/log.rb:131:in `block (2 levels) in <module:Log>'
     # ./lib/mixlib/log/child.rb:41:in `block (2 levels) in <class:Child>'
     # ./spec/mixlib/log/child_spec.rb:95:in `block (4 levels) in <top (required)>'

  5) Mixlib::Log::Child can query the parent's level at fatal
     Failure/Error: logger.send(method_name)

     NoMethodError:
       undefined method `[]' for nil
     # ./lib/mixlib/log.rb:131:in `block (2 levels) in <module:Log>'
     # ./lib/mixlib/log/child.rb:41:in `block (2 levels) in <class:Child>'
     # ./spec/mixlib/log/child_spec.rb:95:in `block (4 levels) in <top (required)>'

  6) Mixlib::Log should set the log level using the binding form,  with :trace, :debug, :info, :warn, :error, or :fatal
     Failure/Error: expect(Logit.logger.level).to eq(constant)

     NoMethodError:
       undefined method `[]' for nil
     # ./spec/mixlib/log_spec.rb:109:in `block (3 levels) in <top (required)>'
     # ./spec/mixlib/log_spec.rb:107:in `each'
     # ./spec/mixlib/log_spec.rb:107:in `block (2 levels) in <top (required)>'

  7) Mixlib::Log should set the log level using the method form, with :trace, :debug, :info, :warn, :error, or :fatal
     Failure/Error: expect(Logit.logger.level).to eq(constant)

     NoMethodError:
       undefined method `[]' for nil
     # ./spec/mixlib/log_spec.rb:132:in `block (3 levels) in <top (required)>'
     # ./spec/mixlib/log_spec.rb:130:in `each'
     # ./spec/mixlib/log_spec.rb:130:in `block (2 levels) in <top (required)>'

  8) Mixlib::Log should pass other method calls directly to logger
     Failure/Error: logger.send(method_name)

     NoMethodError:
       undefined method `[]' for nil
     # ./lib/mixlib/log.rb:131:in `block (2 levels) in <module:Log>'
     # ./spec/mixlib/log_spec.rb:150:in `block (3 levels) in <top (required)>'
     # ./spec/mixlib/log_spec.rb:145:in `block (2 levels) in <top (required)>'

  9) Mixlib::Log should pass add method calls directly to logger
     Failure/Error: logger.send(method_name)

     NoMethodError:
       undefined method `[]' for nil
     # ./lib/mixlib/log.rb:131:in `block (2 levels) in <module:Log>'
     # ./spec/mixlib/log_spec.rb:159:in `block (2 levels) in <top (required)>'

Finished in 0.02143 seconds (files took 0.07924 seconds to load)
44 examples, 9 failures

This is due to change in ruby Logger:
ruby/ruby@194520f
ruby/logger#85

and almost the same fix as steveklabnik/mono_logger#12 is needed.

@mtasaka mtasaka added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Sep 26, 2023
mtasaka added a commit to mtasaka/mixlib-log that referenced this issue Sep 26, 2023
Upcoming ruby3.3 will have enhanced Logger class:
ruby/ruby@194520f
which initializes newly added instance variables.
Without initializing such variables (in super class), now using
subclass of Logger will cause exception.

To avoid this, first call super, then execute additional subclass
initialization.

Fixes chef#73.
mtasaka added a commit to mtasaka/mixlib-log that referenced this issue Sep 26, 2023
Upcoming ruby3.3 will have enhanced Logger class:
ruby/ruby@194520f
which initializes newly added instance variables.
Without initializing such variables (in super class), now using
subclass of Logger will cause exception.

To avoid this, first call super, then execute additional subclass
initialization.

Fixes chef#73.

Signed-off-by: Mamoru TASAKA <mtasaka@fedoraproject.org>
@tpowell-progress tpowell-progress self-assigned this Jul 9, 2024
@tpowell-progress
Copy link
Contributor

See also: steveklabnik/mono_logger#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants