* Change asset pipeline default to Propshaft
* Use :all for stylesheets when propshaft is active
* Switch to using propshaft as the default (still need to find a way to tests against sprockets too)
* Fix tests that rely on sprockets being used
* Fix Propshaft tests (#51913)
* Update railties/test/generators/shared_generator_tests.rb
Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>
---------
Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>
```
2024-04-26 09:36:45 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
https://selenium.dev/documentation/webdriver/troubleshooting/logging
2024-04-26 09:36:45 WARN Selenium [DEPRECATION] DriverFinder.path(options, service_class) is deprecated. Use DriverFinder.new(options, service).driver_path instead.
```
This commit will not install the selenium-webdriver` version 4.20.0
because `Selenium::WebDriver::DriverFinder.path` was dropped in `selenium-webdriver` 4.20.0 that was not intentional.
It will be restored once the newer version of `selenium-webdriver` that includes https://github.com/SeleniumHQ/selenium/pull/13877 .
Fix#51658
`save_and_open_page` is a capybara helper that lets developers
inspect the status of the page at any given point in their
test. This is helpful when trying to keep a short feedback loop while
working on a test.
This change adds a similar helper with matching signature to
integration tests.
On my machine, running the whole Active Record test suite takes
`88` seconds, and `40` of these are spent in encryption tests.
Some of them also happen to flake because of random blips.
I appreciate the care that has been put into ensuring the overhead
of encrption was reasonable, but I don't think these tests justify
their cost.
Managed to reproduce CI failure at https://buildkite.com/rails/rails-nightly/builds/133#018d7bb8-8a32-4978-8e36-d7cb9b067813/1196-1204 . It would also reproduce against the released versions of Ruby because this is triggered by minitest v5.22.0 change. ebb468c81c
To avoid all of railties CI failures, pin minitest version to 5.21 tentatively.
* Steps to reproduce
```ruby
git clone https://github.com/rails/rails
cd rails
rm Gemfile.lock
bundle install
cd railties
bin/test test/application/test_runner_test.rb -n test_system_tests_are_not_run_with_the_default_test_command
```
* Expected behavior
It should pass.
* Actual behavior
```ruby
$ bin/test test/application/test_runner_test.rb -n test_system_tests_are_not_run_with_the_default_test_command
Run options: -n test_system_tests_are_not_run_with_the_default_test_command --seed 14574
F
Failure:
ApplicationTests::TestRunnerTest#test_system_tests_are_not_run_with_the_default_test_command [test/application/test_runner_test.rb:1191]:
Expected /0\ runs,\ 0\ assertions,\ 0\ failures,\ 0\ errors,\ 0\ skips/ to match "Nothing ran for filter: \nRunning 0 tests in a single process (parallelization threshold is 50)\nRun options: --seed 45713\n\n# Running:\n\n".
bin/test test/application/test_runner_test.rb:1179
Finished in 9.982314s, 0.1002 runs/s, 0.2004 assertions/s.
1 runs, 2 assertions, 1 failures, 0 errors, 0 skips
$
```
This pull request addresses "Daily build with Ruby head" failure https://buildkite.com/rails/rails-nightly/builds/101#018d5285-b4de-4072-b7d3-61c19f21347a
Action Mailbox needs `webmock` which depends on `httpclient`.
`httpclient` master branch that added `mutex_m` as a dependency via https://github.com/nahi/httpclient/pull/455 to support Ruby 3.4.0dev.
```ruby
cd actionmailbox
bundle exec rake test
```
```ruby
... snip ...
/home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/httpclient_adapter.rb:234:in `alias_method': undefined method `do_get_block' for class `WebMockHTTPClient' (NameError)
alias_method :do_get_block_without_webmock, :do_get_block
^^^^^^^^^^^^
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/httpclient_adapter.rb:234:in `<class:WebMockHTTPClient>'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/httpclient_adapter.rb:233:in `<top (required)>'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock.rb:52:in `require_relative'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock.rb:52:in `<top (required)>'
from <internal:/home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:/home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler/runtime.rb:60:in `block (2 levels) in require'
from <internal:array>:52:in `each'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler/runtime.rb:55:in `block in require'
from <internal:array>:52:in `each'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler/runtime.rb:44:in `require'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler.rb:187:in `require'
from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/dummy/config/application.rb:7:in `<top (required)>'
from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/dummy/config/environment.rb:2:in `require_relative'
from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/dummy/config/environment.rb:2:in `<top (required)>'
from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/test_helper.rb:8:in `require_relative'
from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/test_helper.rb:8:in `<top (required)>'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `require'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/controllers/ingresses/mailgun/inbound_emails_controller_test.rb:3:in `<top (required)>'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `require'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:21:in `block in <main>'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:6:in `select'
from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
Command failed with status (1): [ruby -w -I"lib:test" /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb "test/controllers/ingresses/mailgun/inbound_emails_controller_test.rb" "test/controllers/ingresses/mandrill/inbound_emails_controller_test.rb" "test/controllers/ingresses/postmark/inbound_emails_controller_test.rb" "test/controllers/ingresses/relay/inbound_emails_controller_test.rb" "test/controllers/ingresses/sendgrid/inbound_emails_controller_test.rb" "test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb" "test/generators/mailbox_generator_test.rb" "test/jobs/incineration_job_test.rb" "test/migrations_test.rb" "test/models/table_name_test.rb" "test/unit/inbound_email/incineration_test.rb" "test/unit/inbound_email/message_id_test.rb" "test/unit/inbound_email_test.rb" "test/unit/mail_ext/address_equality_test.rb" "test/unit/mail_ext/address_wrapping_test.rb" "test/unit/mail_ext/addresses_test.rb" "test/unit/mailbox/bouncing_test.rb" "test/unit/mailbox/callbacks_test.rb" "test/unit/mailbox/notifications_test.rb" "test/unit/mailbox/routing_test.rb" "test/unit/mailbox/state_test.rb" "test/unit/relayer_test.rb" "test/unit/router_test.rb" "test/unit/test_helper_test.rb" ]
<internal:array>:52:in `each'
<internal:array>:52:in `each'
/home/yahonda/.rbenv/versions/ruby-dev/bin/bundle:25:in `load'
/home/yahonda/.rbenv/versions/ruby-dev/bin/bundle:25:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)
$
```
Previously, only the PrismRenderParser or RipperRenderParser would be
tested depending on if the Prism gem is available. This meant that
PrismRenderParser was being tested on Ruby 3.3 and RipperRenderParser
was tested on Ruby < 3.3. Additionally, if someone were to add prism to
the rails/rails Gemfile because they wrote a tool that uses it then the
RipperRenderParser would end up completely untested.
This commit is a small refactor to enable testing both RenderParsers in
all Ruby versions so that the prism gem can be added to the Gemfile.
At GitHub we get a fair number of Trilogy `ETIMEDOUT` errors (for known
reasons that we might be able to improve somewhat, but I doubt we'll
make them go away entirely). These are very much retryable network
errors, so it'd be handy if these `ETIMEDOUT` errors were translated to
`ConnectionFailed` instead of `StatementInvalid`, making them
`retryable_connection_error`s.
ed2bc92b82/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb (L1077)
We're already translating `ECONNRESET` (via matching on the error
message) and `EPIPE` to `ConnectionFailed`. Rather than adding another
case, this commit treats all of the Trilogy `SystemCallError` subclasses
as `ConnectionFailed`.
This requires bumping trilogy 2.7 so we can get
https://github.com/trilogy-libraries/trilogy/pull/143
Given that the limiter implementation provided by Kredis is a simple
increment with a limit, all `ActiveSupport::Cache` already provide that
same capability, with a wide range of backing stores, and not just Redis.
This even allow to use SolidCache has a backend if you so desire.
If we feel particularly fancy, we could also accept a more generic
limiter interface to better allow users to swap the implementation
for better algorithms such as leaky-bucket etc.
This is currently causing an issue in 6-1-stable CI due to a chain of
dependencies: minitest-bisect -> minitest-server -> drb. The last
working version of Drb for Ruby 2.5 and 2.6 includes usage of
ruby2_keywords but does not declare a dependency on the shim gem
(meaning that version of Drb actual does not work on those Ruby
versions).
ruby2_keywords was [added][1] to the 6-1-stable Active Support gemspec
to address the issue with Drb, but this only fixes cases where Drb is
required by Rails. However, there are still failing tests on 6-1-stable
due to Drb being loaded in integration tests where a dummy Rails
application calls Bundler.require and the above dependency chain is
required.
To address those test failures, this commit prevents minitest-bisect
from being automatically required when the whole bundle is required. It
is not strictly necessary for main or any stable branches other than
6-1-stable, but it seems more correct since minitest_bisect is ran as an
external command anyways.
[1]: 5a54e2f36a
This commit is meant to accomplish two things:
- update gems with precompiled C extensions (nokogiri) so that Rails'
lockfile can be `bundle install`d on Ruby 3.3
- remove some Gemfile conditionals for Ruby < 3 now that 3.1 is the
minimum version
Additionally, a requirement is added to ignore mdl 0.13.0 because it
raises false positive warnings. The commit introducing those warnings
has been reverted but there has not been a release since the revert.
Follow-up to #50507.
Since `brakeman` is now included in generated apps by default, it must
be installed before running Rails tests that invoke `bin/rails` for
generated apps.
This fixes CI failures such as:
```
Error:
AppGeneratorTest#test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name:
RuntimeError: Command failed with exit 1: yes | bin/rails app:update
test/generators/app_generator_test.rb:1304:in `system'
test/generators/app_generator_test.rb:1304:in `block (2 levels) in run_app_update'
test/generators/app_generator_test.rb:1304:in `block in run_app_update'
test/generators/app_generator_test.rb:1299:in `chdir'
test/generators/app_generator_test.rb:1299:in `run_app_update'
test/generators/app_generator_test.rb:430:in `test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name'
```
It breaks various `rails console` related integration tests:
```
Failure:
FullStackConsoleTest#test_sandbox [test/application/console_test.rb:123]:
"> " expected, but got:
(END).
Expected "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n--More--\r \r(END)" to include "> ".
```
I tried to figure out a fix, but ran out of time, so in order
to fix CI we can lock IRB for now.
As of Selenium 4.6, [the Selenium Manager is capable of managing Chrome
Driver installations and integrations][readme]. As of Selenium 4.11, the
Selenium Manager is capable of [capable of resolving the Chrome for
Testing installation][] path.
By omitting the `gem` declaration from the `Gemfile.tt`, newly generated
applications and applications updating their `Gemfile` in lockstep with
newer Rails versions can shed the dependency and avoid test failures
introduced by newly released Chrome versions (like, for example,
[titusfortner/webdrivers#247][]).
[readme]: 43f8ac436c (update-selenium-manager)
[titusfortner/webdrivers#247]: https://github.com/titusfortner/webdrivers/issues/247
[capable of resolving the Chrome for Testing installation]: https://github.com/rails/rails/pull/48847#issuecomment-1656756862
Co-authored-by: Titus Fortner <titusfortner@users.noreply.github.com>
Address these Rails CI failures:
https://buildkite.com/rails/rails/builds/96301#01880117-acb1-4d77-935a-4a1de13c8609/1093-1101
Refer to
https://bugs.ruby-lang.org/issues/19616https://github.com/ruby/ruby/pull/7781
```ruby
$ ruby -v
ruby 3.3.0dev (2023-05-09T19:40:26Z master e1c84e8ee6) [x86_64-linux]
$ cd railties
$ bin/test test/application/console_test.rb
... snip ...
.F
Failure:
FullStackConsoleTest#test_environment_option_and_irb_option [/home/yahonda/src/github.com/rails/rails/railties/test/application/console_test.rb:133]:
"> " expected, but got:
Loading test environment (Rails 7.1.0.alpha)
Switch to inspect mode.
▽.
Expected # encoding: ASCII-8BIT
"Loading test environment (Rails 7.1.0.alpha)\r\nSwitch to inspect mode.\r\n\e[1G\xE2\x96\xBD\e[6n" to include "> ".
bin/test test/application/console_test.rb:167
^[[30;2RF
Failure:
FullStackConsoleTest#test_sandbox [/home/yahonda/src/github.com/rails/rails/railties/test/application/console_test.rb:133]:
"> " expected, but got:
Loading development environment in sandbox (Rails 7.1.0.alpha)
Any modifications you make will be rolled back on exit
▽.
Expected # encoding: ASCII-8BIT
"Loading development environment in sandbox (Rails 7.1.0.alpha)\r\nAny modifications you make will be rolled back on exit\r\n\e[1G\xE2\x96\xBD\e[6n" to include "> ".
bin/test test/application/console_test.rb:139
^[[30;2R......
Finished in 66.153595s, 0.1360 runs/s, 0.2872 assertions/s.
9 runs, 19 assertions, 2 failures, 0 errors, 0 skips
$
```