Skip to content

Speed up backend tests in Gitpod environment

Peter Leitzen requested to merge pl-gitpod-speedup-be-tests into master

What does this MR do?

This MR speeds up backend tests in Gitpod environment.

By setting the environment variable GITLAB_TEST_EAGER_LOAD=false disable Rails' eager loading of class in the test environment which improves the load time of specs.

This way Gitpod users don't need to set Variables anymore.

Screenshots or Screencasts (strongly suggested)

To simulate the behaviour we are setting GITLAB_TEST_EAGER_LOAD to true and false explicitly.

Before (GITLAB_TEST_EAGER_LOAD=true) After (GITLAB_TEST_EAGER_LOAD=false) After via Gitpod
Screenshot_from_2021-08-18_17-33-24 Screenshot_from_2021-08-18_17-33-53 Screenshot_from_2021-08-18_17-57-21

How to setup and validate locally (strongly suggested)

  1. 🖱 Click Open in Gitpod below
  2. Wait for Gitpod to boot
  3. In Gitpod Terminal
    1. Verify that envvar is set to false via echo $GITLAB_TEST_EAGER_LOAD
    2. Verify speedup via time bin/rspec spec/models/ability_spec.rb
    3. Run this command at least twice to get relevant timings

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Leitzen

Merge request reports