parameterize class caching in test

closes FOO-2539
flag=none

TEST PLAN:
  1) specs pass

Change-Id: Ibd4030767a8f015b3c197a568d7bb26a91dca92d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277273
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
Ethan Vizitei 2021-11-02 11:48:37 -05:00
parent c0f7b567fa
commit fc439c30bf
3 changed files with 17 additions and 1 deletions

10
Jenkinsfile vendored
View File

@ -303,6 +303,16 @@ pipeline {
CANVAS_LMS_REFSPEC = getCanvasLmsRefspec()
DOCKER_WORKDIR = getDockerWorkDir()
LOCAL_WORKDIR = getLocalWorkDir()
// TEST_CACHE_CLASSES is consumed by config/environments/test.rb
// to decide whether to allow class reloading or not.
// in local development we usually want this unset or set to '0' because
// we want spring to be able to reload classes between
// spec runs, but this is expensive when running all the
// specs for the build. EVERYWHERE in the build we want
// to be able to cache classes because they don't change while the build
// is running and should never be reloaded.
TEST_CACHE_CLASSES = '1'
}
stages {

View File

@ -24,7 +24,12 @@ environment_configuration(defined?(config) && config) do |config|
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# In local development we usually want this unset or set to '0' because
# we want spring to be able to reload classes between
# spec runs, but this is expensive when running all the
# specs for the build, so this ENV var can be provided by
# any harness to turn class caching on for performance.
config.cache_classes = (ENV.fetch("TEST_CACHE_CLASSES", "0") == "1")
# Show formatted error reports and disable caching
config.consider_all_requests_local = false

View File

@ -19,6 +19,7 @@ services:
FORCE_FAILURE:
CANVAS_RAILS6_0:
CANVAS_ZEITWERK:
TEST_CACHE_CLASSES:
# parallel_tests
CI_NODE_TOTAL: