We'd like to add validation to migration timestamps (attempted in 2854e37),
but this is problematic for copied migrations, e.g. engine migrations:
migrations are copied by adding one to every migration timestamp number,
which may produce an invalid timestamp.
This commit adds a regression test for this case, ensuring that if / when
we revisit migration timestamp validation, we handle the case for copied
migrations.
When set, validates that the timestamp prefix for a migration is in the form YYYYMMDDHHMMSS.
This is designed to prevent migration timestamps from being modified by hand.
It is turned off by default.
These tests have never run in CI due to CI using a root user. This
commit keeps that behavior without using the skip so that we can enable
raise on skips.
Similarly to Action Mailbox, these tests didn't pass because the skip
patch was included before ActiveSupport::TestCase was defined. Moving
the patch to the bottom of the file fixes the issue.
Once the skip patch was fixed, all of the skips were due to differences
in adapters which aren't really test skips as much as tests that should
not ever run against those adapters.
We can't run this test on Ruby 2.7 due to minitest being locked in the
Gemfile to an older version, so we should use that as a condition
instead of skipping if minitest doesn't have metadata.
ActiveSupport::TestCase isn't defined until later in the file, so the
skip override can be added at the end to ensure it exists (similar to
what the Action Pack tests do)
The change to serialization mirrors the test just below it that also
uses a conditional for the assertion instead of a skip. The conditional
is necessary because memcached entries are not strings.
The class_serial test should not run on Ruby 3.2+ because class_serial
was replaced with Object Shapes. The class_serial value in RubyVM.stat
was removed in ruby/ruby@13bd617ea6
The CI env var was recently [changed][1] to be specific for the
application being tested instead of the framework tests. Because of
this, these lines which should have been true before are now false.
[1]: 1f0262aa2b
Since a GH token is required for the action-discord notify action to fetch the commit message, otherwise it would make unauthenticated requests leading to rate limiting. This shouldn't impact the result of a workflow, but it's annoying.
The permissions for this token can vary based on the repository's settings. So to ensure we don't accidentally get a token with write access or something, we should use restrictive permissions per workflow, like the other workflows in this project.
See: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
Updates `MemoryStore#write_entry` to pass a `nil` `namespace` to
`exist?`, which expects a _name_ rather than a an already "normalized"
_key_. This fixes a bug where `unless_exist` would overwrite any
existing entry if a `namespace` was used.
Fixes#50160
The `object_id` name may be used by polymorphic relations where `object` is the best name, like `notification.object`.
In that case two columns are created: `object_id` and `object_type`.
Update tests and comments to reference `__id__` instead of `object_id` for consistency.
Right now if the subprocess exit uncleanly, it straight out bring the
parent down with it because it will fail to parse the (likely empty)
Marshal payload:
```
<internal:marshal>:34:in `load': marshal data too short (ArgumentError)
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:23:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:1094:in `run_one_method'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:179:in `block in run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:168:in `with_timestamps'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:178:in `run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:229:in `block in run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/ci/queue/redis/worker.rb:55:in `poll'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:228:in `run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:213:in `__run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:162:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:86:in `block in autorun'
- XXXX::XXXXTest#test_xxxxx - /tmp/bundle/ruby/3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:52:in `write': closed stream (IOError)
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:52:in `puts'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:52:in `block (2 levels) in run_in_isolation'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:32:in `fork'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:32:in `block in run_in_isolation'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:28:in `pipe'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:28:in `run_in_isolation'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:19:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:1094:in `run_one_method'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:179:in `block in run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:168:in `with_timestamps'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:178:in `run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:229:in `block in run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/ci/queue/redis/worker.rb:55:in `poll'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:228:in `run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:213:in `__run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:162:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:86:in `block in autorun'
```
This breaks the Minitest contract that `run_one_method` shouldn't raise
ever, and return a `Minitest::Result`.
By properly checking the sub process status, we can turn this crash into
a test failure, allowing the original test process to go on.
When generating a new app, `bundle install` may be run multiple times
due to various application templates. This can create a lot of noise
in the output log, particularly with Bundler <= 2.4.16, which displays
the full list of gems each time `bundle install` is run.
To reduce noise, this commit adds the `--quiet` flag to `bundle install`
commands.
__Before__
```console
$ rails new my_cool_app --dev
create
create Gemfile
run bundle install
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
Bundle complete! 1 Gemfile dependency, 58 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run rails new my_cool_app --dev
exist
remove Gemfile
remove Gemfile.lock
create README.md
...
run bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
...
rails importmap:install
apply importmap-rails-1.2.3/lib/install/install.rb
...
run bundle install
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
rails turbo:install stimulus:install
apply turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
...
run bundle install
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
apply turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
Enable redis in bundle
gsub Gemfile
run bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Switch development cable to use redis
gsub config/cable.yml
run bundle install
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
apply stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
...
run bundle install
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
```
__After__
```console
$ rails new my_cool_app --dev
create
create Gemfile
run bundle install --quiet
run rails new my_cool_app --dev
exist
remove Gemfile
remove Gemfile.lock
create README.md
...
run bundle install --quiet
...
rails importmap:install
apply importmap-rails-1.2.3/lib/install/install.rb
...
run bundle install --quiet
rails turbo:install stimulus:install
apply turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
...
run bundle install --quiet
apply turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
Enable redis in bundle
gsub Gemfile
run bundle install --quiet
Switch development cable to use redis
gsub config/cable.yml
run bundle install --quiet
apply stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
...
run bundle install --quiet
```
Note that `bundle install` still displays any errors when using the
`--quiet` flag:
```console
$ bundle install
Could not find gem 'rails (= 9001.0)' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following gems matching 'rails':
* rails-0.8.0
...
* rails-7.1.2
```