ruby / rake

A make-like build utility for Ruby.

Home Page:https://ruby.github.io/rake

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rake test fails to run with uninitialized constant FileList (NameError)

tbrisker opened this issue · comments

Since the 13.0.4 release all our tests are failing to run:

[2021-07-07T12:31:48.957Z] ** Execute test:katello:spec
[2021-07-07T12:31:48.957Z] ** Invoke katello_spec_task (first_time)
[2021-07-07T12:31:48.957Z] ** Execute katello_spec_task
[2021-07-07T12:31:48.957Z] /usr/local/rvm/rubies/ruby-2.7.0/bin/ruby -I"lib:test:/home/jenkins/workspace/katello-pr-test/test:spec:/home/jenkins/workspace/katello-pr-test/spec" /usr/local/rvm/gems/ruby-2.7.0@katello-pr-test-7573-1/gems/rake-13.0.4/lib/rake/rake_test_loader.rb "/home/jenkins/workspace/katello-pr-test/spec/**/*_spec.rb" -v --ci-reporter
[2021-07-07T12:31:49.528Z] /usr/local/rvm/gems/ruby-2.7.0@katello-pr-test-7573-1/gems/rake-13.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>': uninitialized constant FileList (NameError)
[2021-07-07T12:31:49.528Z] Did you mean?  FileTest
[2021-07-07T12:31:49.528Z] 	from /usr/local/rvm/gems/ruby-2.7.0@katello-pr-test-7573-1/gems/rake-13.0.4/lib/rake/rake_test_loader.rb:4:in `select'
[2021-07-07T12:31:49.528Z] 	from /usr/local/rvm/gems/ruby-2.7.0@katello-pr-test-7573-1/gems/rake-13.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
[2021-07-07T12:31:49.528Z] rake aborted!

Not sure, but this might be related to #379

@tbrisker Just released rake-13.0.5. Can you try it?

I've submitted theforeman/foreman#8650 so we'll see what CI says.

Unfortunately it seems to still be broken in 13.0.5 as well:

/usr/local/rvm/gems/ruby-2.5.1@test_develop_pr_katello-0/gems/rake-13.0.5/lib/rake/rake_test_loader.rb:11:in `block in <main>': uninitialized constant FileList (NameError)
Did you mean?  FileTest
	from /usr/local/rvm/gems/ruby-2.5.1@test_develop_pr_katello-0/gems/rake-13.0.5/lib/rake/rake_test_loader.rb:6:in `select'
	from /usr/local/rvm/gems/ruby-2.5.1@test_develop_pr_katello-0/gems/rake-13.0.5/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!

Ah, Can you try the following patch?

From 971c873c6cd58f8e6b37284aaf3a0c8d09340509 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Date: Thu, 8 Jul 2021 20:45:08 +0900
Subject: [PATCH] Added Rake namespace explicitly

---
 lib/rake/rake_test_loader.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git lib/rake/rake_test_loader.rb lib/rake/rake_test_loader.rb
index af4a182..3ecee5d 100644
--- lib/rake/rake_test_loader.rb
+++ lib/rake/rake_test_loader.rb
@@ -8,7 +8,7 @@
   when /^-/ then
     argument
   when /\*/ then
-    FileList[argument].to_a.each do |file|
+    Rake::FileList[argument].to_a.each do |file|
       require File.expand_path file
     end

--
2.32.0

@hsbt Thank you for the quick response. looks like that indeed fixes the issue.

Thanks @hsbt , I tested in our environment and that fixed the issue for https://github.com/theforeman

@tbrisker Thanks! I released rake-13.0.6 with the above fix.