Commit d5976297 authored by Julien Muchembled's avatar Julien Muchembled

Unit tests: add msecs to zLOG.log + improvements to _testInvalidationBug

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35574 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 46d30269
...@@ -52,12 +52,17 @@ class TestInvalidationBug(ERP5TypeTestCase): ...@@ -52,12 +52,17 @@ class TestInvalidationBug(ERP5TypeTestCase):
self.login() self.login()
def testReindex(self): def testReindex(self):
self.login() print("To reproduce bugs easily, distribution step should be skipped for"
" SQLDict, by writing messages with processing_node already at 0."
" This can be done easily by patching SQLDict_writeMessageList.")
module = self.getPortalObject().organisation_module module = self.getPortalObject().organisation_module
module.newContent()
module.setIdGenerator('_generatePerDayId') module.setIdGenerator('_generatePerDayId')
module.migrateToHBTree() #module.migrateToHBTree()
transaction.commit() transaction.commit()
self.tic() self.tic()
print 'OID(%s) = %r' % (module.getRelativeUrl(), module._p_oid)
print ' OID(_tree) = %r' % module._tree._p_oid
previous = DateTime() previous = DateTime()
skin_folder = self.getPortal().portal_skins.custom skin_folder = self.getPortal().portal_skins.custom
if 'create_script' in skin_folder.objectIds(): if 'create_script' in skin_folder.objectIds():
...@@ -71,19 +76,20 @@ for x in xrange(0, 1): ...@@ -71,19 +76,20 @@ for x in xrange(0, 1):
id_list.append(organisation.getId()) id_list.append(organisation.getId())
log('Created Organisations', (context,id_list)) log('Created Organisations', (context,id_list))
#log('All organisations', (context,[x for x in context.objectIds()])) #log('All organisations', (context,[x for x in context.objectIds()]))
context.activate(activity='SQLQueue').create_script() context.activate(activity='SQLQueue', priority=2).create_script()
count = len(context) count = len(context)
log('Organisation #', count) log('Organisation #', count)
if not (count % 500): if (count % 500) < 5:
if count == 500: start = context.getProperty('perf_start')
context.setProperty('perf_start', DateTime()) if start is None:
context.setProperty('perf_start', (count, DateTime()))
else: else:
log('creation speed: %s obj/s' % ((count - 500) / log('creation speed: %s obj/s' % ((count - start[0]) /
(86400 * (DateTime() - context.getProperty('perf_start'))))) (86400 * (DateTime() - start[1]))))
""") """)
for x in xrange(0,200): for x in xrange(0,200):
module.activate(activity='SQLQueue').create_script() module.activate(activity='SQLQueue', priority=2).create_script()
transaction.commit() transaction.commit()
self.tic() self.tic()
......
...@@ -386,7 +386,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0): ...@@ -386,7 +386,7 @@ def runUnitTestList(test_list, verbosity=1, debug=0):
from ZConfig.components.logger.logger import EventLogFactory from ZConfig.components.logger.logger import EventLogFactory
import logging import logging
section = SectionValue({'dateformat': '%Y-%m-%d %H:%M:%S', section = SectionValue({'dateformat': '%Y-%m-%d %H:%M:%S',
'format': '%(asctime)s %(levelname)s %(name)s %(message)s', 'format': '%(asctime)s.%(msecs)03d %(levelname)s %(name)s %(message)s',
'level': logging.INFO, 'level': logging.INFO,
'path': os.environ['EVENT_LOG_FILE'], 'path': os.environ['EVENT_LOG_FILE'],
'max_size': None, 'max_size': None,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment