mirror of https://github.com/zulip/zulip.git
Django 1.10: Use single cache prefix for casper tests.
There is a change in Django 1.10 due to which whenever the password of the user is changed the session hash changes. This change affects us because we cache user profile objects and these cached objects need to be refreshed. However, the signal sent by Django in which objects are refreshed fails to refresh the cache for Tornado because it uses a different cache prefix. Note: Backend tests are not affected because they don't rely on Tornado.
This commit is contained in:
parent
9f5c961a1b
commit
770a899239
|
@ -27,6 +27,7 @@ except ImportError as e:
|
|||
#
|
||||
|
||||
os.environ["TORNADO_SERVER"] = "http://127.0.0.1:9983"
|
||||
os.environ["CASPER_TESTS"] = "1"
|
||||
os.environ["PHANTOMJS_EXECUTABLE"] = os.path.join(os.path.dirname(__file__), "../node_modules/.bin/phantomjs")
|
||||
|
||||
usage = """%prog [options]
|
||||
|
|
|
@ -61,18 +61,18 @@ def remote_cache_stats_finish():
|
|||
|
||||
def get_or_create_key_prefix():
|
||||
# type: () -> text_type
|
||||
if settings.TEST_SUITE:
|
||||
if settings.CASPER_TESTS:
|
||||
# This sets the prefix for the benefit of the Casper tests.
|
||||
# The Python tests overwrite KEY_PREFIX on each test, but use
|
||||
# this codepath as well, just to save running the more complex
|
||||
# code below for reading the normal key prefix.
|
||||
#
|
||||
# Having a fixed key is OK since we don't support running
|
||||
# multiple copies of the casper tests at the same time anyway.
|
||||
if settings.TORNADO_SERVER:
|
||||
return u'casper_tests:'
|
||||
else:
|
||||
return u'django_tests:'
|
||||
return u'casper_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
|
||||
# code below for reading the normal key prefix.
|
||||
return u'django_tests_unused:'
|
||||
|
||||
# directory `var` should exist in production
|
||||
subprocess.check_call(["mkdir", "-p", os.path.join(settings.DEPLOY_ROOT, "var")])
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ else:
|
|||
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
|
||||
|
||||
# Import variables like secrets from the prod_settings file
|
||||
# Import prod_settings after determining the deployment/machine type
|
||||
|
|
|
@ -51,6 +51,9 @@ else:
|
|||
CAMO_URI = 'https://external-content.zulipcdn.net/'
|
||||
CAMO_KEY = 'dummy'
|
||||
|
||||
if "CASPER_TESTS" in os.environ:
|
||||
CASPER_TESTS = True
|
||||
|
||||
# Decrease the get_updates timeout to 1 second.
|
||||
# This allows CasperJS to proceed quickly to the next test step.
|
||||
POLL_TIMEOUT = 1000
|
||||
|
|
Loading…
Reference in New Issue