Commit f054122a authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_configurator: Fix/Update Configurator test to check Constraints.

parent e02b451e
...@@ -11,60 +11,40 @@ import os ...@@ -11,60 +11,40 @@ import os
class TestSlapOSConfigurator(testSlapOSMixin): class TestSlapOSConfigurator(testSlapOSMixin):
def _testConfiguredPromiseViaAlarm(self, alarm_id): def testConfiguredModuleGeneratorIDViaConstraint(self):
"""
Make sue one alarm is configured.
"""
alarm = getattr(self.portal.portal_alarms, alarm_id, None)
self.assertNotEquals(alarm, None)
alarm.activeSense()
self.tic()
self.failIf(alarm.sense())
def testConfiguredPAS(self):
""" Make sure PAS is well configured, in this case
we trust on promise outcome."""
self._testConfiguredPromiseViaAlarm("promise_slapos_pas")
def testConfiguredPASExternal(self):
""" Make sure External PAS (Facebook, Google, Browser ID)
is well configured, in this case we trust on promise outcome."""
self._testConfiguredPromiseViaAlarm("promise_slapos_pas_external")
def testConfiguredModuleGeneratorID(self):
""" Make sure Generator ID is well configured, in this """ Make sure Generator ID is well configured, in this
case we trust on promise outcome.""" case we trust on promise outcome."""
self._testConfiguredPromiseViaAlarm("promise_slapos_module_id_generator") self.assertEquals(self.portal.portal_ids.checkConsistency(), [])
def testConfiguredShacacheWebSite(self): def testConfiguredShacacheWebSite(self):
""" Make sure Shacache WebSite is setuped by Alarm """ Make sure Shacache WebSite is setuped by Alarm
case we trust on promise outcome.""" case we trust on promise outcome."""
self._testConfiguredPromiseViaAlarm("promise_slapos_shacache_website") self.assertEquals(self.portal.web_site_module.checkConsistency(), [])
def testConfiguredVolatileCacheViaPromise(self):
""" Make sure Volitile Cache was configured well,
invoking the alarm to check """
self._testConfiguredPromiseViaAlarm("promise_memcached_server")
def testConfiguredPersistentCacheViaPromise(self): def testConfiguredCacheViaConstraint(self):
""" Make sure Persistent Cache was configured well, """ Make sure Volitile and Persistent Cache was configured well,
invoking the alarm to check """ invoking the consistency to check """
self._testConfiguredPromiseViaAlarm("promise_kumofs_server") self.assertEquals(self.portal.portal_memcached.checkConsistency(), [])
def testConfiguredConversionServerViaPromise(self): def testConfiguredConversionServerViaConstraint(self):
""" Make sure Conversion Server was configured well, """ Make sure Conversion Server was configured well,
invoking the alarm to check """ invoking checkConsistency """
self._testConfiguredPromiseViaAlarm("promise_conversion_server") self.assertEquals(self.portal.portal_preferences.checkConsistency(), [])
def testConfiguredCertificateAuthoringViaPromise(self): def testConfiguredCertificateAuthoringConstraint(self):
"""Make sure Certificate Authoring was configured well, """Make sure Certificate Authoring was configured well,
invoking the alarm to check. """ invoking checkConsistency.
self._testConfiguredPromiseViaAlarm("promise_certificate_autority_tool")
def testConfiguredTemplateToolViaPromise(self): Make sure PAS is well configured."""
self.assertEquals(self.portal.portal_certificate_authority.checkConsistency(), [])
def testConfiguredTemplateToolViaConstraint(self):
""" Make sure Template Tool Repositories was configured well, """ Make sure Template Tool Repositories was configured well,
invoking the alarm to check """ invoking checkConsistency """
self._testConfiguredPromiseViaAlarm("promise_template_tool_configuration") self.assertEquals(
[ i for i in self.portal.portal_templates.checkConsistency()
if "(reinstall)" not in i.message], [])
def testConfiguredVolatileCache(self): def testConfiguredVolatileCache(self):
""" Make sure Memcached is configured """ Make sure Memcached is configured
...@@ -79,7 +59,7 @@ class TestSlapOSConfigurator(testSlapOSMixin): ...@@ -79,7 +59,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
memcached_tool = self.getPortal().portal_memcached memcached_tool = self.getPortal().portal_memcached
connection_dict = _getVolatileMemcachedServerDict() connection_dict = _getVolatileMemcachedServerDict()
url_string = '%(hostname)s:%(port)s' % connection_dict url_string = 'erp5-memcached-volatile:%(port)s' % connection_dict
self.assertEquals(memcached_tool.default_memcached_plugin.getUrlString(), self.assertEquals(memcached_tool.default_memcached_plugin.getUrlString(),
url_string) url_string)
...@@ -96,7 +76,7 @@ class TestSlapOSConfigurator(testSlapOSMixin): ...@@ -96,7 +76,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
_getPersistentMemcachedServerDict _getPersistentMemcachedServerDict
memcached_tool = self.getPortal().portal_memcached memcached_tool = self.getPortal().portal_memcached
connection_dict = _getPersistentMemcachedServerDict() connection_dict = _getPersistentMemcachedServerDict()
url_string = '%(hostname)s:%(port)s' % connection_dict url_string = 'erp5-memcached-persistent:%(port)s' % connection_dict
self.assertEquals(memcached_tool.persistent_memcached_plugin.getUrlString(), self.assertEquals(memcached_tool.persistent_memcached_plugin.getUrlString(),
url_string) url_string)
...@@ -104,18 +84,17 @@ class TestSlapOSConfigurator(testSlapOSMixin): ...@@ -104,18 +84,17 @@ class TestSlapOSConfigurator(testSlapOSMixin):
""" Make sure Conversion Server (Cloudooo) is """ Make sure Conversion Server (Cloudooo) is
well configured """ well configured """
if self.isLiveTest(): if self.isLiveTest():
# This test is redundant with testConfiguredVolatileCacheViaPromise # This test is redundant with testConfiguredConversionServerViaConstraint
# and it is only aims to verify if test environment is behaving as # and it is only aims to verify if test environment is behaving as
# expected, nothing else, and if alamrs were invoked. # expected, nothing else, and if alamrs were invoked.
return return
from Products.ERP5Type.tests.ERP5TypeTestCase import\ from Products.ERP5Type.tests.ERP5TypeTestCase import\
_getConversionServerDict _getConversionServerUrl
# set preference # set preference
preference_tool = self.portal.portal_preferences preference_tool = self.portal.portal_preferences
conversion_dict = _getConversionServerDict() conversion_url = _getConversionServerUrl()
self.assertEquals(preference_tool.getPreferredOoodocServerAddress(),conversion_dict['hostname']) self.assertEquals(preference_tool.getPreferredDocumentConversionServerUrl(), conversion_url)
self.assertEquals(preference_tool.getPreferredOoodocServerPortNumber(), conversion_dict['port'])
def testConfiguredCertificateAuthoring(self): def testConfiguredCertificateAuthoring(self):
""" Make sure Certificate Authoting is """ Make sure Certificate Authoting is
......
...@@ -39,6 +39,9 @@ from functools import wraps ...@@ -39,6 +39,9 @@ from functools import wraps
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from AccessControl.SecurityManagement import getSecurityManager, \ from AccessControl.SecurityManagement import getSecurityManager, \
setSecurityManager setSecurityManager
from App.config import getConfiguration
config = getConfiguration()
def changeSkin(skin_name): def changeSkin(skin_name):
def decorator(func): def decorator(func):
...@@ -190,18 +193,25 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -190,18 +193,25 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.portal_caches._p_changed = 1 self.portal.portal_caches._p_changed = 1
self.commit() self.commit()
self.portal.portal_caches.updateCache() self.portal.portal_caches.updateCache()
if getattr(self.portal, 'is_site_bootstrapped', 0):
for alarm in self.portal.portal_alarms.contentValues(): try:
if alarm.getId().startswith("promise_slapos"): initsite = config.product_config["initsite"]
alarm.solve() except KeyError:
return initsite = {}
else:
if initsite.get("cloudooo_url", None) is None:
from Products.ERP5Type.tests.ERP5TypeTestCase import\
_getConversionServerUrl
initsite["cloudooo_url"] = _getConversionServerUrl()
config.product_config["initsite"] = initsite
if not getattr(self.portal, 'is_site_bootstrapped', 0):
self.portal.is_site_bootstrapped = 1 self.portal.is_site_bootstrapped = 1
self.bootstrapSite() self.bootstrapSite()
self.portal._p_changed = 1 self.portal._p_changed = 1
self.commit() self.commit()
def deSetUpPersistentDummyMailHost(self): def deSetUpPersistentDummyMailHost(self):
if 'MailHost' in self.portal.objectIds(): if 'MailHost' in self.portal.objectIds():
self.portal.manage_delObjects(['MailHost']) self.portal.manage_delObjects(['MailHost'])
...@@ -237,6 +247,8 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -237,6 +247,8 @@ class testSlapOSMixin(ERP5TypeTestCase):
def bootstrapSite(self): def bootstrapSite(self):
self.setupPortalAlarms() self.setupPortalAlarms()
self.createCertificateAuthorityFile() self.createCertificateAuthorityFile()
self.getDefaultSystemPreference().setPreferredHateoasUrl("http://dummy/")
self.getBusinessConfiguration().BusinessConfiguration_invokeSlapOSMasterPromiseAlarmList()
self.clearCache() self.clearCache()
self.tic() self.tic()
......
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