Skip to content

Fix railties tests for Propshaft and maintain support for Sprockets#52899

Merged
dhh merged 1 commit intopropshaft-only-for-new-appsfrom
rm-sprockets
Sep 14, 2024
Merged

Fix railties tests for Propshaft and maintain support for Sprockets#52899
dhh merged 1 commit intopropshaft-only-for-new-appsfrom
rm-sprockets

Conversation

@zzak
Copy link
Member

@zzak zzak commented Sep 12, 2024

Combine #52122 and fix the remaining failures for #52887.

Create sprockets_assets_test.rb file that will contain the sprockets-specific tests of assets_test.rb (which in turn will contain the tests common to both pipelines).

I've squashed those commits once I felt confident there was no missing cases, but it might be a useful exercise to review the commits from the other PR as well for those interested.

There is one flaky test, but I have seen this flake on main before.

(Edit: yup, it was reported in #50364)

$ bin/test test/application/sprockets_assets_test.rb

........................E, [2024-09-14T08:35:08.072799 #1983325] ERROR -- : [1ae49fc5-8c5a-48e4-ab4b-0ce5e73f79d0]
[1ae49fc5-8c5a-48e4-ab4b-0ce5e73f79d0] ActionController::RoutingError (No route matches [GET] "/assets/demo.js"):
[1ae49fc5-8c5a-48e4-ab4b-0ce5e73f79d0]
..** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
F

Failure:
ApplicationTests::SprocketsAssetsTest#test_precompile_shouldn't_use_the_digests_present_in_manifest.json [test/application/sprockets_assets_test.rb:326]:
Expected "application-0a89120b13dcff9cb069311101add34ef7717de154816b01622972a4509eb5c9.css" to not be equal to "application-0a89120b13dcff9cb069311101add34ef7717de154816b01622972a4509eb5c9.css".

bin/test test/application/sprockets_assets_test.rb:307

..

Finished in 1.424157s, 20.3629 runs/s, 120.0710 assertions/s.
29 runs, 171 assertions, 1 failures, 0 errors, 0 skips

$ bin/test test/application/sprockets_assets_test.rb

........................E, [2024-09-14T08:35:12.994864 #1985849] ERROR -- : [615c9d49-d1bf-40c8-96a6-bf9c76a9a28d]
[615c9d49-d1bf-40c8-96a6-bf9c76a9a28d] ActionController::RoutingError (No route matches [GET] "/assets/demo.js"):
[615c9d49-d1bf-40c8-96a6-bf9c76a9a28d]
..** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
I, [2024-09-14T08:35:13.044219 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/rails-6738e33efa7b8d2036e0a0118601555f0b771ac042f6790f7538dd881a1a7f3a.png
I, [2024-09-14T08:35:13.045199 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/application-f1fa81296280307c358b4bd65e4bfd705be90dc5eba7c04dcd1d76ec084c78e7.css
I, [2024-09-14T08:35:13.045508 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/application-f1fa81296280307c358b4bd65e4bfd705be90dc5eba7c04dcd1d76ec084c78e7.css.gz
I, [2024-09-14T08:35:13.045767 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/rails-6738e33efa7b8d2036e0a0118601555f0b771ac042f6790f7538dd881a1a7f3a.png
...

Thanks @tute and @fedesapuppo for the initial push here!

@rails-bot rails-bot bot added the railties label Sep 12, 2024
@dhh
Copy link
Member

dhh commented Sep 13, 2024

I think we still need to retain these sprocket specific tests. But we should move them into their own suite, so at some point, in the far future, they can be moved into a rails-sprockets gem.

Create `sprockets_assets_test.rb` file that will contain the
sprockets-specific tests of `assets_test.rb` (which in turn will contain
the tests common to both pipelines).

There is one flaky test, but I have seen this flake on main before.

```
$ bin/test test/application/sprockets_assets_test.rb

........................E, [2024-09-14T08:35:08.072799 #1983325] ERROR -- : [1ae49fc5-8c5a-48e4-ab4b-0ce5e73f79d0]
[1ae49fc5-8c5a-48e4-ab4b-0ce5e73f79d0] ActionController::RoutingError (No route matches [GET] "/assets/demo.js"):
[1ae49fc5-8c5a-48e4-ab4b-0ce5e73f79d0]
..** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
F

Failure:
ApplicationTests::SprocketsAssetsTest#test_precompile_shouldn't_use_the_digests_present_in_manifest.json [test/application/sprockets_assets_test.rb:326]:
Expected "application-0a89120b13dcff9cb069311101add34ef7717de154816b01622972a4509eb5c9.css" to not be equal to "application-0a89120b13dcff9cb069311101add34ef7717de154816b01622972a4509eb5c9.css".

bin/test test/application/sprockets_assets_test.rb:307

..

Finished in 1.424157s, 20.3629 runs/s, 120.0710 assertions/s.
29 runs, 171 assertions, 1 failures, 0 errors, 0 skips

$ bin/test test/application/sprockets_assets_test.rb

........................E, [2024-09-14T08:35:12.994864 #1985849] ERROR -- : [615c9d49-d1bf-40c8-96a6-bf9c76a9a28d]
[615c9d49-d1bf-40c8-96a6-bf9c76a9a28d] ActionController::RoutingError (No route matches [GET] "/assets/demo.js"):
[615c9d49-d1bf-40c8-96a6-bf9c76a9a28d]
..** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
I, [2024-09-14T08:35:13.044219 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/rails-6738e33efa7b8d2036e0a0118601555f0b771ac042f6790f7538dd881a1a7f3a.png
I, [2024-09-14T08:35:13.045199 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/application-f1fa81296280307c358b4bd65e4bfd705be90dc5eba7c04dcd1d76ec084c78e7.css
I, [2024-09-14T08:35:13.045508 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/application-f1fa81296280307c358b4bd65e4bfd705be90dc5eba7c04dcd1d76ec084c78e7.css.gz
I, [2024-09-14T08:35:13.045767 #1986490]  INFO -- : Writing /home/zzak/code/rails/tmp/d20240914-1985782-wcigrx/app/public/assets/rails-6738e33efa7b8d2036e0a0118601555f0b771ac042f6790f7538dd881a1a7f3a.png
...

```

Co-authored-by: Tute Costa <tutecosta@gmail.com>
Co-authored-by: Federico Sapuppo <fedesapuppo@hotmail.com>
@zzak zzak changed the title Fix remaining tests for propshaft Fix railties tests for Propshaft and maintain support for Sprockets Sep 14, 2024
@dhh dhh merged commit a2aecd4 into propshaft-only-for-new-apps Sep 14, 2024
@dhh dhh deleted the rm-sprockets branch September 14, 2024 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants