Commit 50d38916 authored by Jérome Perrin's avatar Jérome Perrin

Tests: configure memcached for all tests

parent 5e76b157
...@@ -977,6 +977,14 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -977,6 +977,14 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
preference._setPreferredOoodocServerAddress(conversion_dict['hostname']) preference._setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference._setPreferredOoodocServerPortNumber(conversion_dict['port']) preference._setPreferredOoodocServerPortNumber(conversion_dict['port'])
def _updateMemcachedConfiguration(self):
"""Update default memcached plugin configuration
"""
portal_memcached = self.portal.portal_memcached
connection_dict = _getVolatileMemcachedServerDict()
url_string = '%(hostname)s:%(port)s' % connection_dict
portal_memcached.default_memcached_plugin.setUrlString(url_string)
def _recreateCatalog(self, quiet=0): def _recreateCatalog(self, quiet=0):
"""Clear activities and catalog and recatalog everything. """Clear activities and catalog and recatalog everything.
Test runner can set `erp5_tests_recreate_catalog` environnement variable, Test runner can set `erp5_tests_recreate_catalog` environnement variable,
...@@ -1127,6 +1135,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -1127,6 +1135,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
light_install=light_install, light_install=light_install,
quiet=quiet) quiet=quiet)
self._updateConversionServerConfiguration() self._updateConversionServerConfiguration()
self._updateMemcachedConfiguration()
# Create a Manager user at the Portal level # Create a Manager user at the Portal level
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser('ERP5TypeTestCase', '', ['Manager', 'Member', 'Assignee', uf._doAddUser('ERP5TypeTestCase', '', ['Manager', 'Member', 'Assignee',
......
...@@ -32,7 +32,7 @@ import unittest ...@@ -32,7 +32,7 @@ import unittest
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getPersistentMemcachedServerDict, _getVolatileMemcachedServerDict from Products.ERP5Type.tests.ERP5TypeTestCase import _getPersistentMemcachedServerDict
from Products.ERP5Type.CachePlugins.DummyCache import DummyCache from Products.ERP5Type.CachePlugins.DummyCache import DummyCache
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Cache import CachingMethod, DEFAULT_CACHE_SCOPE from Products.ERP5Type.Cache import CachingMethod, DEFAULT_CACHE_SCOPE
...@@ -96,12 +96,7 @@ class TestCacheTool(ERP5TypeTestCase): ...@@ -96,12 +96,7 @@ class TestCacheTool(ERP5TypeTestCase):
self.assertNotEqual(None, portal_type) self.assertNotEqual(None, portal_type)
def createPersistentMemcachedPlugin(self): def createPersistentMemcachedPlugin(self):
portal_memcached = self.getPortal().portal_memcached portal_memcached = self.portal.portal_memcached
connection_dict = _getVolatileMemcachedServerDict()
url_string = '%(hostname)s:%(port)s' % connection_dict
# setup default volatile distributed memcached
portal_memcached.default_memcached_plugin.setUrlString(url_string)
# setup persistent memcached # setup persistent memcached
memcached_plugin_id = 'flare' memcached_plugin_id = 'flare'
if getattr(portal_memcached, memcached_plugin_id, None) is None: if getattr(portal_memcached, memcached_plugin_id, None) is 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