comparison test/test_liveserver.py @ 7819:0fe2b9f6e19f

issue2551212 - enable wsgi cache_tracker by default Switch the code so the wsgi cache_tracker optimization is enabled by default. Leave the unoptimized/uncached code path available in case it breaks something. The feature flag can be set to False to disable caching. Updated tests to test the disabled (non-cache) code path. Updated upgrading.txt with info on how to disable caching.
author John Rouillard <rouilj@ieee.org>
date Wed, 20 Mar 2024 17:13:30 -0400
parents 1b5daee24dc7
children 80cf6098ea65
comparison
equal deleted inserted replaced
7818:a44c5da250fa 7819:0fe2b9f6e19f
125 if error.errno not in (errno.ENOENT, errno.ESRCH): raise 125 if error.errno not in (errno.ENOENT, errno.ESRCH): raise
126 i18n.LOCALE_DIRS = cls.backup_locale_dirs 126 i18n.LOCALE_DIRS = cls.backup_locale_dirs
127 i18n.DOMAIN = cls.backup_domain 127 i18n.DOMAIN = cls.backup_domain
128 128
129 def create_app(self): 129 def create_app(self):
130 '''The wsgi app to start - no feature_flags set.''' 130 '''The wsgi app to start - no feature_flags set.
131 Post 2.3.0 this enables the cache_tracker feature.
132 '''
131 133
132 if _py3: 134 if _py3:
133 return validator(RequestDispatcher(self.dirname)) 135 return validator(RequestDispatcher(self.dirname))
134 else: 136 else:
135 # wsgiref/validator.py InputWrapper::readline is broke and 137 # wsgiref/validator.py InputWrapper::readline is broke and
1213 1215
1214 def test_fts(self): 1216 def test_fts(self):
1215 f = requests.get(self.url_base() + "?@search_text=RESULT") 1217 f = requests.get(self.url_base() + "?@search_text=RESULT")
1216 self.assertIn("foo bar", f.text) 1218 self.assertIn("foo bar", f.text)
1217 1219
1218 class TestFeatureFlagCacheTrackerOn(BaseTestCases, WsgiSetup): 1220 class TestFeatureFlagCacheTrackerOff(BaseTestCases, WsgiSetup):
1219 """Class to run all test in BaseTestCases with the cache_tracker 1221 """Class to run all test in BaseTestCases with the cache_tracker
1220 feature flag enabled when starting the wsgi server 1222 feature flag disabled when starting the wsgi server
1221 """ 1223 """
1222 def create_app(self): 1224 def create_app(self):
1223 '''The wsgi app to start with feature flag enabled''' 1225 '''The wsgi app to start with feature flag disabled'''
1224 ff = { "cache_tracker": "" } 1226 ff = { "cache_tracker": False }
1225 if _py3: 1227 if _py3:
1226 return validator(RequestDispatcher(self.dirname, feature_flags=ff)) 1228 return validator(RequestDispatcher(self.dirname, feature_flags=ff))
1227 else: 1229 else:
1228 # wsgiref/validator.py InputWrapper::readline is broke and 1230 # wsgiref/validator.py InputWrapper::readline is broke and
1229 # doesn't support the max bytes to read argument. 1231 # doesn't support the max bytes to read argument.
1230 return RequestDispatcher(self.dirname, feature_flags=ff) 1232 return RequestDispatcher(self.dirname, feature_flags=ff)
1231 1233
1232 @skip_postgresql 1234 @skip_postgresql
1233 class TestPostgresWsgiServer(BaseTestCases, WsgiSetup): 1235 class TestPostgresWsgiServer(BaseTestCases, WsgiSetup):
1234 """Class to run all test in BaseTestCases with the cache_tracker 1236 """Class to run all test in BaseTestCases with the cache_tracker
1235 feature flag enabled when starting the wsgi server 1237 feature enabled when starting the wsgi server
1236 """ 1238 """
1237 1239
1238 backend = 'postgresql' 1240 backend = 'postgresql'
1239 1241
1240 @classmethod 1242 @classmethod

Roundup Issue Tracker: http://roundup-tracker.org/