Commit 94a0479e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_*: Bootstrap caucase server/connector

  Only launch caucase when needed.  Not all tests need
  caucase, this saves a bit the overhead to run it
parent a17e7ed4
......@@ -257,6 +257,8 @@ class TestSlapOSComputerConsumptionTioXMLFile_parseXml(SlapOSTestCaseMixinWithAb
class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
SlapOSTestCaseMixin):
launch_caucase = 1
def createTioXMLFile(self):
document = self.portal.consumption_document_module.newContent(
title=self.generateNewId(),
......
......@@ -30,6 +30,8 @@ from AccessControl.SecurityManagement import getSecurityManager, \
class DefaultScenarioMixin(TestSlapOSSecurityMixin):
launch_caucase = 1
def afterSetUp(self):
TestSlapOSSecurityMixin.afterSetUp(self)
preference = self.portal.portal_preferences.slapos_default_system_preference
......
......@@ -44,6 +44,8 @@ def hashData(data):
class TestSlapOSCloudSlapOSCacheMixin(
SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
self.pinDateTime(DateTime())
......@@ -375,6 +377,8 @@ class TestSlapOSCloudSlapOSCacheMixin(
class TestSlapOSCloudSoftwareInstance(
SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
self.project = self.addProject()
......@@ -496,6 +500,7 @@ class TestSlapOSCloudSoftwareInstance(
class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
......@@ -705,4 +710,3 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self.assertEqual(fourth_body_fingerprint, hashData(body))
self.assertEqual(0, len(self.portal.portal_activities.getMessageList()))
......@@ -25,6 +25,9 @@ from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
self.project = self.addProject()
......
......@@ -27,6 +27,8 @@ import transaction
class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
"""Tests instance.requestInstance"""
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
portal = self.getPortalObject()
......@@ -1050,6 +1052,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
"""Tests instance.requestTransfer"""
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
......@@ -1218,4 +1221,3 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getDestinationReference(),
another_certificate_login.getDestinationReference())
......@@ -25,6 +25,7 @@ from AccessControl.SecurityManagement import getSecurityManager, \
class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
......
......@@ -543,6 +543,7 @@ class TestPerson_newLogin(TestSlapOSHalJsonStyleMixin):
self.assertIn(person.getRelativeUrl(), result)
class TestPerson_get_Certificate(TestSlapOSHalJsonStyleMixin):
launch_caucase = 1
def test_Person_getCertificate_unauthorized(self):
person = self._makePerson(user=1)
self.assertEqual(1 , len(person.objectValues(portal_type="ERP5 Login")))
......@@ -580,7 +581,7 @@ class TestPerson_get_Certificate(TestSlapOSHalJsonStyleMixin):
self.assertSameSet(new_response_dict.keys(), ["common_name", "certificate", "id", "key"])
self.assertEqual(json.dumps(new_response_dict["common_name"]), json.dumps(new_login.getReference()))
self.assertEqual(new_response_dict["id"], new_login.getDestinationReference())
self.assertEqual(new_response_dict["id"], new_login.getSourceReference())
self.assertNotEqual(new_response_dict["common_name"], response_dict["common_name"])
self.assertNotEqual(new_response_dict["id"], response_dict["id"])
......@@ -645,6 +646,7 @@ class TestERP5Site_invalidate(TestSlapOSHalJsonStyleMixin):
class TestComputeNode_get_revoke_Certificate(TestSlapOSHalJsonStyleMixin):
launch_caucase = 1
def test_ComputeNode_getCertificate(self):
compute_node = self._makeComputeNode()
self.assertEqual(0, len(compute_node.objectValues(portal_type=["ERP5 Login", "Certificate Login"])))
......@@ -1517,6 +1519,8 @@ return []""")
class TestSoftwareInstance_getAllocationInformation(TestSlapOSHalJsonStyleMixin):
launch_caucase = 1
def test_SoftwareInstance_getAllocationInformation_not_allocated(self):
self._makeTree()
self.changeSkin('RJS')
......
......@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona
class TestSlapOSUIHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase):
foreground = 0
run_only = "slaposjs_zuite"
launch_caucase = 1
def afterSetUp(self):
ERP5TypeFunctionalTestCase.afterSetUp(self)
......
......@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona
class TestSlapOSUIZHHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase):
foreground = 0
run_only = "slaposjs_zuite"
launch_caucase = 1
def afterSetUp(self):
ERP5TypeFunctionalTestCase.afterSetUp(self)
......
......@@ -23,6 +23,8 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
class TestSlapOSPDMCreateUpgradeDecisionSkins(SlapOSTestCaseMixin):
launch_caucase = 1
def test_createUpgradeDecision_destroyed_instance(self):
instance_tree = self.portal.instance_tree_module.newContent(
portal_type="Instance Tree"
......
......@@ -49,6 +49,7 @@ def canonical_xml(xml):
class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
self.portal_slap = self.portal.portal_slap
......
......@@ -30,6 +30,7 @@ import random
import transaction
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeCaucaseTestCase import ERP5TypeCaucaseTestCase
from Products.ERP5Type.Utils import convertToUpperCase
import os
import glob
......@@ -40,9 +41,10 @@ from App.config import getConfiguration
config = getConfiguration()
class testSlapOSMixin(ERP5TypeTestCase):
class testSlapOSMixin(ERP5TypeCaucaseTestCase):
abort_transaction = 0
launch_caucase = 0
def clearCache(self):
self.portal.portal_caches.clearAllCache()
......@@ -96,6 +98,8 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.email_from_address = 'romain@nexedi.com'
self.portal.email_to_address = 'romain@nexedi.com'
if not self.isLiveTest() and self.launch_caucase:
self.setUpCaucase()
if getattr(self.portal.portal_caches, 'erp5_site_global_id', None):
# we are not on live test so multiple tests can run in parallel
......@@ -103,8 +107,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.portal_caches.erp5_site_global_id = '%s' % random.random()
self.portal.portal_caches._p_changed = 1
if self.isLiveTest():
return
self.commit()
self.portal.portal_caches.updateCache()
......
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