From 71dec63ad1301110a09b34e8cc1ea26af1eedf35 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 2 Jul 2013 19:26:00 -0400 Subject: [PATCH] Fix regression with JS tests only working the first time. The JS tests would fail on the second run due to memcache having dirty data. This change sets a new KEY_PREFIX whenever you launch a server in test mode. (imported from commit 4d41e6b79ab3bb7cb4c96b37050f0b1c9abc6b5e) --- zephyr/lib/cache.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zephyr/lib/cache.py b/zephyr/lib/cache.py index 03bf2e7fc9..93b1e501c6 100644 --- a/zephyr/lib/cache.py +++ b/zephyr/lib/cache.py @@ -37,6 +37,11 @@ def memcached_stats_finish(): memcached_total_time += (time.time() - memcached_time_start) def get_or_create_key_prefix(): + if settings.TEST_SUITE: + # This sets the prefix mostly for the benefit of the JS tests. + # The Python tests overwrite KEY_PREFIX on each test. + return 'test_suite:' + str(os.getpid()) + ':' + filename = os.path.join(settings.DEPLOY_ROOT, "memcached_prefix") try: fd = os.open(filename, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0444)