Commit e79d358e 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 fda21b6b
......@@ -256,6 +256,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())
......@@ -374,6 +376,8 @@ class TestSlapOSCloudSlapOSCacheMixin(
class TestSlapOSCloudSoftwareInstance(
SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
self._makeTree()
......@@ -494,6 +498,7 @@ class TestSlapOSCloudSoftwareInstance(
class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
......@@ -700,4 +705,3 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self.assertEqual(fourth_body_fingerprint, hashData(body))
self.assertEqual(0, len(self.portal.portal_activities.getMessageList()))
......@@ -8,6 +8,8 @@ from erp5.component.module.DateUtils import addToDate
class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(
SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
self._makeTree()
......@@ -219,6 +221,8 @@ class TestSlapOSFreeComputePartitionAlarmWithSlave(SlapOSTestCaseMixin):
class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
self._makeTree()
......@@ -527,6 +531,8 @@ class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin):
class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
def createInstance(self):
instance_tree = self.portal.instance_tree_module\
.template_instance_tree.Base_createCloneDocument(batch_mode=1)
......@@ -612,6 +618,8 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
def createInstance(self):
instance_tree = self.portal.instance_tree_module\
.template_instance_tree.Base_createCloneDocument(batch_mode=1)
......
......@@ -27,6 +27,9 @@ from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
# Clone compute_node document
......@@ -791,8 +794,6 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowSupply(SlapOSTestCaseMixin):
class TestSlapOSCoreComputeNodeSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
portal = self.getPortalObject()
......
......@@ -28,6 +28,8 @@ from zExceptions import Unauthorized
class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
"""Tests instance.requestInstance"""
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
portal = self.getPortalObject()
......@@ -1045,6 +1047,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
"""Tests instance.requestTransfer"""
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
......@@ -1403,4 +1406,3 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getDestinationReference(),
another_certificate_login.getDestinationReference())
......@@ -26,6 +26,7 @@ from AccessControl.SecurityManagement import getSecurityManager, \
class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self)
......
......@@ -1075,6 +1075,7 @@ class TestSlapOSRegularisationRequest_stopInstanceTreeList(
class TestSlapOSInstanceTree_stopFromRegularisationRequest(
SlapOSTestCaseMixinWithAbort):
launch_caucase = 1
def createInstanceTree(self):
new_id = self.generateNewId()
instance_tree = self.portal.instance_tree_module\
......
......@@ -104,6 +104,8 @@ class TestCRMSkinsMixin(SlapOSTestCaseMixinWithAbort):
class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
launch_caucase = 1
def test_SupportRequestModule_getMonitoringUrlList(self):
module = self.portal.support_request_module
# We assume here that several objects created by others tests don't influentiate
......@@ -333,6 +335,8 @@ class TestSlapOSisSupportRequestCreationClosed(TestCRMSkinsMixin):
class TestSlapOSComputeNode_CheckState(TestCRMSkinsMixin):
launch_caucase = 1
def beforeTearDown(self):
self._cancelTestSupportRequestList()
transaction.abort()
......@@ -635,6 +639,8 @@ class TestSlapOSInstanceTree_createSupportRequestEvent(SlapOSTestCaseMixin):
class TestSlapOSHasError(SlapOSTestCaseMixin):
launch_caucase = 1
def _makeSoftwareRelease(self, software_release_url=None):
software_release = self.portal.software_release_module\
.template_software_release.Base_createCloneDocument(batch_mode=1)
......
......@@ -598,6 +598,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")))
......@@ -635,7 +636,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"])
......@@ -700,6 +701,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"])))
......@@ -1572,6 +1574,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)
......
......@@ -24,6 +24,9 @@ from DateTime import DateTime
import transaction
class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
launch_caucase = 1
def _makeSoftwareProductCatalog(self):
self.software_product = self._makeSoftwareProduct(self.generateNewId())
self.previous_software_release = self._makeSoftwareRelease(self.generateNewId())
......@@ -426,4 +429,4 @@ class TestSlapOSPDMCreateUpgradeDecisionSkins(TestSlapOSPDMMixinSkins):
release = decision2.UpgradeDecision_getAggregateValue("Software Release")
self.assertEqual(release.getUrlString(),
software_release3.getUrlString())
\ No newline at end of file
......@@ -23,6 +23,9 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
from erp5.component.test.testSlapOSAccountingAlarm import simulateByEditWorkflowMark
class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
def createInstance(self, url_string):
instance_tree = self.portal.instance_tree_module\
.template_instance_tree.Base_createCloneDocument(batch_mode=1)
......@@ -110,8 +113,6 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
aggregate=compute_node.getRelativeUrl())
published_software_installation.validate()
published_software_installation.requestStart()
self.tic()
# first run touches software installation
......@@ -195,8 +196,6 @@ class TestSlapOSDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm(Slap
aggregate=compute_node.getRelativeUrl())
published_software_installation.validate()
published_software_installation.requestStart()
self.tic()
# as Compute Node is manually managed, nothing happens
......
......@@ -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
......
......@@ -637,6 +637,8 @@ class TestSubscriptionRequest_createRelatedSaleInvoiceTransaction(TestSubscripti
class SubscriptionRequest_processRequest(TestSubscriptionSkinsMixin):
launch_caucase = 1
def test_process_request_person_is_none(self):
subscription_request = self.newSubscriptionRequest(quantity=1)
self.assertEqual(None, subscription_request.SubscriptionRequest_processRequest())
......@@ -1054,6 +1056,8 @@ class TestSubscriptionRequest_verifyReservationPaymentTransaction(TestSubscripti
class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
launch_caucase = 1
def test_no_sale_invoice(self):
person = self.makePerson()
subscription_request = self.newSubscriptionRequest(
......
......@@ -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()
......@@ -86,6 +88,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
......@@ -93,8 +97,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