Ruby 3.4 support - #449
Open
salimepoint wants to merge 2 commits into
Open
Conversation
minitest 5.16 added `srand Minitest.seed` to Test.runnable_methods, which runs once per suite, so from that version on the global PRNG replays the same sequence at the start of every describe block. command_line_interface_spec's write_file built its file name from Digest::MD5.hexdigest(rand.to_s), so specs in different describe blocks were handed the same name. The second `require` of that path does nothing - it is already in $LOADED_FEATURES - so LOADED_FILES never gets an entry for it and the assertions on it fail. Which specs collide moves around with the seed, so the failures read as flakes rather than as a bug. Under minitest 5.25 every one of six seeds tried produced between one and three of them. SecureRandom is not affected by srand.
Ruby 3.4 removed mutex_m from the standard library. minitest 5.10.1
requires it, so the suite could not even load. minitest 5.25 has no
such dependency and still supports Ruby 2.7, so the one pin covers the
whole matrix.
Ruby 3.4 also changed Hash#inspect to render symbol keys as {key: 1}
rather than {:key=>1}. listener_spec hardcoded the old rendering of a
hash that Que::Listener inspects into an error message; deriving the
expectation with #inspect instead makes it hold either way.
Adds Ruby 3.3 and 3.4 to CI, against Rails 7.2 only - the older Rails
gemfiles are already excluded from the newer Rubies they don't support.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Ruby 3.3 and 3.4 to CI and fixes the three things that stood in the way.
Ruby 3.4 removed mutex_m from the standard library. The pinned minitest ~> 5.10.1 requires it, so the suite failed before a single test ran. minitest ~> 5.25.0 has no such dependency and still supports Ruby 2.7, so one pin covers the whole existing matrix — bumped in the root Gemfile and in all five spec/gemfiles/Gemfile-rails-*.
Ruby 3.4 renders symbol keys as {key: 1} rather than {:key=>1}. listener_spec hardcoded the old rendering of a hash that Que::Listener inspects into an error message. Deriving the expectation with #inspect instead of writing it out makes it hold on every Ruby version.
This one is a prerequisite for the bump rather than a Ruby 3.4 issue, so it's a separate commit.
minitest 5.16 added srand Minitest.seed to Test.runnable_methods, which runs once per suite — so from that version on, the global PRNG replays the same sequence at the start of every describe block. command_line_interface_spec's write_file built its file name from Digest::MD5.hexdigest(rand.to_s), so specs in different describe blocks were handed the same name. The second require of that path is a no-op — it's already in $LOADED_FEATURES — so LOADED_FILES never gets an entry for it and the assertions on it fail.
Which specs collide moves around with the seed, so the failures read as flakes rather than as a bug. Under minitest 5.25, every one of six seeds tried produced between one and three of them. Switching to SecureRandom.hex(16) fixes it, as SecureRandom is unaffected by srand.
CI
Adds { ruby: 3.3, rails: 7.2, postgres: 14 } and { ruby: 3.4, rails: 7.2, postgres: 14 }. Rails 7.2 only — the older Rails gemfiles are already excluded from the newer Rubies they don't support.