Do not `eager_load` by default in the test environment
Usually, developers run a single test locally. Disabling eager loading by default in test environment should increase productivity since it saves around 10 seconds: With `eager_load` as `true`: ```bash bogdanvlviv@lenovo:~/gitlab-development-kit/gitlab$ bin/rspec spec/models/users_statistics_spec.rb Run options: include {:focus=>true} All examples were filtered out; ignoring {:focus=>true} Test environment set up in 5.122837013 seconds ...... Finished in 8.51 seconds (files took 16.46 seconds to load) 6 examples, 0 failures ``` With `eager_load` as `false`: ```bash bogdanvlviv@lenovo:~/gitlab-development-kit/gitlab$ bin/rspec spec/models/users_statistics_spec.rb Run options: include {:focus=>true} All examples were filtered out; ignoring {:focus=>true} Test environment set up in 5.013345478 seconds ...... Finished in 8.24 seconds (files took 7.18 seconds to load) 6 examples, 0 failures ``` Inspired by https://github.com/rails/rails/pull/43508. It is important to eager load app before deploying it to catch any issues with constants loading. I see that we disable eager_loading on CI, https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30368/diffs#c1e8bf49d38a49639de4f3b2f3cef9ebdbe50dd4_16_26 For mentioned reason above I thik we should enable eager loading on CI. @rymai What do you think about that? I also found that we 'Speed up backend tests in Gitpod environment', https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68482. /cc @splattael Remove `GITLAB_TEST_EAGER_LOAD: "0"` for scripts/setup-test-env It doesn't make any difference for this script. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72964#note_713013642 Document `GITLAB_TEST_EAGER_LOAD`. Closes https://gitlab.com/gitlab-org/gitlab/-/issues/343751
Showing
Please register or sign in to comment