From c64888048f7a0b5a9aa7889da87cb69b4c313ad0 Mon Sep 17 00:00:00 2001 From: Dinesh Date: Sat, 5 Sep 2020 13:37:07 +0000 Subject: [PATCH] puppeteer: Rename CASPER_TESTS env variable to PUPPETEER_TESTS. Also modified few comments to match with the changes. --- tools/test-js-with-puppeteer | 7 ++----- tools/webpack | 2 +- zerver/lib/cache.py | 8 ++++---- zproject/computed_settings.py | 2 +- zproject/test_extra_settings.py | 8 ++++---- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteer index 6943ecace8..c59ecd94ea 100755 --- a/tools/test-js-with-puppeteer +++ b/tools/test-js-with-puppeteer @@ -9,11 +9,8 @@ ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Request the special webpack setup for frontend integration tests, # where webpack assets are compiled up front rather than running in -# watch mode. We prefer the same for puppeteer, so the below line -# makes the webpack similar to casper. -# -# TODO: Eventually, we'll want to rename this parameter. -os.environ["CASPER_TESTS"] = "1" +# watch mode. +os.environ["PUPPETEER_TESTS"] = "1" os.environ["CHROMIUM_EXECUTABLE"] = os.path.join(ZULIP_PATH, "node_modules/.bin/chromium") os.environ.pop("http_proxy", "") diff --git a/tools/webpack b/tools/webpack index 9af7afb2ea..aea54c43fc 100755 --- a/tools/webpack +++ b/tools/webpack @@ -132,7 +132,7 @@ parser.add_argument('--disable-host-check', help='Disable host check for webpack-dev-server') args = parser.parse_args() -if "CASPER_TESTS" in os.environ: +if "PUPPETEER_TESTS" in os.environ: build_for_prod_or_casper(args.quiet) elif args.test: build_for_most_tests() diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py index c95473134d..63029f46d5 100644 --- a/zerver/lib/cache.py +++ b/zerver/lib/cache.py @@ -69,12 +69,12 @@ def remote_cache_stats_finish() -> None: remote_cache_total_time += (time.time() - remote_cache_time_start) def get_or_create_key_prefix() -> str: - if settings.CASPER_TESTS: - # This sets the prefix for the benefit of the Casper tests. + if settings.PUPPETEER_TESTS: + # This sets the prefix for the benefit of the Puppeteer tests. # # Having a fixed key is OK since we don't support running - # multiple copies of the casper tests at the same time anyway. - return 'casper_tests:' + # multiple copies of the puppeteer tests at the same time anyway. + return 'puppeteer_tests:' elif settings.TEST_SUITE: # The Python tests overwrite KEY_PREFIX on each test, but use # this codepath as well, just to save running the more complex diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py index 72b3529faa..53faad9712 100644 --- a/zproject/computed_settings.py +++ b/zproject/computed_settings.py @@ -99,7 +99,7 @@ TEST_SUITE = False # The new user tutorial is enabled by default, but disabled for client tests. TUTORIAL_ENABLED = True # This is overridden in test_settings.py for the test suites -CASPER_TESTS = False +PUPPETEER_TESTS = False # This is overridden in test_settings.py for the test suites RUNNING_OPENAPI_CURL_TEST = False # This is overridden in test_settings.py for the test suites diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py index 9433e7bde2..9d1a3f69d2 100644 --- a/zproject/test_extra_settings.py +++ b/zproject/test_extra_settings.py @@ -45,8 +45,8 @@ else: CAMO_URI = 'https://external-content.zulipcdn.net/external_content/' CAMO_KEY = 'dummy' -CASPER_TESTS = "CASPER_TESTS" in os.environ -if CASPER_TESTS: +PUPPETEER_TESTS = "PUPPETEER_TESTS" in os.environ +if PUPPETEER_TESTS: # Disable search pills prototype for production use SEARCH_PILLS_ENABLED = False @@ -107,7 +107,7 @@ CACHES['database'] = { SESSION_ENGINE = "django.contrib.sessions.backends.db" # Use production config from Webpack in tests -if CASPER_TESTS: +if PUPPETEER_TESTS: WEBPACK_FILE = 'webpack-stats-production.json' else: WEBPACK_FILE = os.path.join('var', 'webpack-stats-test.json') @@ -117,7 +117,7 @@ WEBPACK_LOADER['DEFAULT']['STATS_FILE'] = os.path.join(DEPLOY_ROOT, WEBPACK_FILE # Don't auto-restart Tornado server during automated tests AUTORELOAD = False -if not CASPER_TESTS: +if not PUPPETEER_TESTS: # Use local memory cache for backend tests. CACHES['default'] = { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',