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

AppGeneratorTest fails because Could not find gem 'kamal' in locally installed gems. #51816

Closed
yahonda opened this issue May 14, 2024 · 1 comment

Comments

@yahonda
Copy link
Member

yahonda commented May 14, 2024

Managed to reproduce CI failure at https://buildkite.com/rails/rails/builds/107161#018f75c2-80af-4e18-aa3a-d05ff094812a/1165-1173

Steps to reproduce

git clone https://github.com/rails/rails
cd rails/railties
bundle install
bin/test test/generators/app_generator_test.rb:434

Expected behavior

It should pass.

Actual behavior

$ bin/test test/generators/app_generator_test.rb:434
Run options: --seed 6749

# Running:

E

Error:
AppGeneratorTest#test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name:
RuntimeError: Command failed with exit 1: bin/rails
    test/generators/app_generator_test.rb:1509:in `system'
    test/generators/app_generator_test.rb:1509:in `block (2 levels) in run_app_update'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/testing/stream.rb:11:in `silence_stream'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/testing/stream.rb:19:in `block in quietly'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/testing/stream.rb:11:in `silence_stream'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/testing/stream.rb:18:in `quietly'
    test/generators/app_generator_test.rb:1509:in `block in run_app_update'
    test/generators/app_generator_test.rb:1504:in `chdir'
    test/generators/app_generator_test.rb:1504:in `run_app_update'
    test/generators/app_generator_test.rb:448:in `test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name'


bin/test test/generators/app_generator_test.rb:434



Finished in 0.793763s, 1.2598 runs/s, 15.1179 assertions/s.
1 runs, 12 assertions, 0 failures, 1 errors, 0 skips
$

System configuration

Rails version: main branch including bee3fa4

Ruby version: ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]

@yahonda
Copy link
Member Author

yahonda commented May 14, 2024

  • Removing the quietly block
$ git diff
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 21a1587c74..7158b1232e 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -1506,7 +1506,7 @@ def run_app_update(app_root = destination_root, flags: "--force")
         gemfile_contents.sub!(/^(gem "rails").*/, "\\1, path: #{File.expand_path("../../..", __dir__).inspect}")
         File.write("Gemfile", gemfile_contents)

-        quietly { system({ "BUNDLE_GEMFILE" => "Gemfile" }, "bin/rails app:update #{flags}", exception: true) }
+        system({ "BUNDLE_GEMFILE" => "Gemfile" }, "bin/rails app:update #{flags}", exception: true)
       end
     end

$
  • Run the same test shows the actual error message "Could not find gem 'kamal' in locally installed gems."
$ bin/test test/generators/app_generator_test.rb:434
Run options: --seed 23390

# Running:

Could not find gem 'kamal' in locally installed gems.
Run `bundle install` to install missing gems.
E

Error:
AppGeneratorTest#test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name:
RuntimeError: Command failed with exit 7: bin/rails
    test/generators/app_generator_test.rb:1509:in `system'
    test/generators/app_generator_test.rb:1509:in `block in run_app_update'
    test/generators/app_generator_test.rb:1504:in `chdir'
    test/generators/app_generator_test.rb:1504:in `run_app_update'
    test/generators/app_generator_test.rb:448:in `test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name'


bin/test test/generators/app_generator_test.rb:434



Finished in 0.794015s, 1.2594 runs/s, 15.1131 assertions/s.
1 runs, 12 assertions, 0 failures, 1 errors, 0 skips
$

carlosantoniodasilva pushed a commit that referenced this issue May 14, 2024
We need this gem to be able to run the generators test.

Closes #51816.
xjunior pushed a commit to xjunior/rails that referenced this issue Jun 9, 2024
We need this gem to be able to run the generators test.

Closes rails#51816.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant