Commit cf68ca38 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 5b7e2e2b
...@@ -13,6 +13,7 @@ def convertCategoryList(base, l): ...@@ -13,6 +13,7 @@ def convertCategoryList(base, l):
class TestSlapOSBuilderMixin(SlapOSTestCaseMixin): class TestSlapOSBuilderMixin(SlapOSTestCaseMixin):
launch_caucase = 1
def checkSimulationMovement(self, simulation_movement): def checkSimulationMovement(self, simulation_movement):
self.assertEqual(1.0, simulation_movement.getDeliveryRatio()) self.assertEqual(1.0, simulation_movement.getDeliveryRatio())
......
...@@ -28,6 +28,8 @@ def getSimulationStatePlannedDelivered(self, *args, **kwargs): ...@@ -28,6 +28,8 @@ def getSimulationStatePlannedDelivered(self, *args, **kwargs):
return 'planned' return 'planned'
class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin): class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin):
launch_caucase = 1
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -169,6 +171,8 @@ class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin): ...@@ -169,6 +171,8 @@ class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin):
class TestDefaultInvoiceRule(SlapOSTestCaseMixin): class TestDefaultInvoiceRule(SlapOSTestCaseMixin):
launch_caucase = 1
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -249,6 +253,8 @@ class TestDefaultInvoiceRule(SlapOSTestCaseMixin): ...@@ -249,6 +253,8 @@ class TestDefaultInvoiceRule(SlapOSTestCaseMixin):
class TestDefaultInvoicingRule(SlapOSTestCaseMixin): class TestDefaultInvoicingRule(SlapOSTestCaseMixin):
launch_caucase = 1
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -381,6 +387,8 @@ class TestDefaultInvoicingRule(SlapOSTestCaseMixin): ...@@ -381,6 +387,8 @@ class TestDefaultInvoicingRule(SlapOSTestCaseMixin):
.original_getSimulationState .original_getSimulationState
class TestDefaultPaymentRule(SlapOSTestCaseMixin): class TestDefaultPaymentRule(SlapOSTestCaseMixin):
launch_caucase = 1
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -857,6 +865,7 @@ class TestDefaultTradeModelRule(SlapOSTestCaseMixin): ...@@ -857,6 +865,7 @@ class TestDefaultTradeModelRule(SlapOSTestCaseMixin):
.original_getSimulationState .original_getSimulationState
class TestDefaultDeliveryRule(SlapOSTestCaseMixin): class TestDefaultDeliveryRule(SlapOSTestCaseMixin):
launch_caucase = 1
def test(self): def test(self):
resource, _, _, _, _, aggregate = self.bootstrapAllocableInstanceTree(is_accountable=True) resource, _, _, _, _, aggregate = self.bootstrapAllocableInstanceTree(is_accountable=True)
...@@ -950,6 +959,8 @@ class TestDefaultDeliveryRule(SlapOSTestCaseMixin): ...@@ -950,6 +959,8 @@ class TestDefaultDeliveryRule(SlapOSTestCaseMixin):
for q in simulation_movement.contentValues(portal_type='Applied Rule')]) for q in simulation_movement.contentValues(portal_type='Applied Rule')])
class TestDefaultDeliveryRuleConsumption(SlapOSTestCaseMixin): class TestDefaultDeliveryRuleConsumption(SlapOSTestCaseMixin):
launch_caucase = 1
def test(self): def test(self):
resource, _, _, _, _, aggregate = self.bootstrapAllocableInstanceTree(is_accountable=True) resource, _, _, _, _, aggregate = self.bootstrapAllocableInstanceTree(is_accountable=True)
project = aggregate.getFollowUpValue() project = aggregate.getFollowUpValue()
......
...@@ -257,6 +257,8 @@ class TestSlapOSComputerConsumptionTioXMLFile_parseXml(SlapOSTestCaseMixinWithAb ...@@ -257,6 +257,8 @@ class TestSlapOSComputerConsumptionTioXMLFile_parseXml(SlapOSTestCaseMixinWithAb
class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration( class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
SlapOSTestCaseMixin): SlapOSTestCaseMixin):
launch_caucase = 1
def createTioXMLFile(self): def createTioXMLFile(self):
document = self.portal.consumption_document_module.newContent( document = self.portal.consumption_document_module.newContent(
title=self.generateNewId(), title=self.generateNewId(),
......
...@@ -30,6 +30,8 @@ from AccessControl.SecurityManagement import getSecurityManager, \ ...@@ -30,6 +30,8 @@ from AccessControl.SecurityManagement import getSecurityManager, \
class DefaultScenarioMixin(TestSlapOSSecurityMixin): class DefaultScenarioMixin(TestSlapOSSecurityMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
TestSlapOSSecurityMixin.afterSetUp(self) TestSlapOSSecurityMixin.afterSetUp(self)
preference = self.portal.portal_preferences.slapos_default_system_preference preference = self.portal.portal_preferences.slapos_default_system_preference
......
...@@ -52,6 +52,8 @@ def _decode_with_json(value): ...@@ -52,6 +52,8 @@ def _decode_with_json(value):
class TestSlapOSCloudSlapOSCacheMixin( class TestSlapOSCloudSlapOSCacheMixin(
SlapOSTestCaseMixin): SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self.pinDateTime(DateTime()) self.pinDateTime(DateTime())
...@@ -430,6 +432,8 @@ class TestBase_isValidXml(SlapOSTestCaseMixinWithAbort): ...@@ -430,6 +432,8 @@ class TestBase_isValidXml(SlapOSTestCaseMixinWithAbort):
class TestSlapOSCloudSoftwareInstance( class TestSlapOSCloudSoftwareInstance(
SlapOSTestCaseMixin): SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self.project = self.addProject() self.project = self.addProject()
...@@ -659,6 +663,8 @@ class TestSlapOSCloudSoftwareInstance( ...@@ -659,6 +663,8 @@ class TestSlapOSCloudSoftwareInstance(
class TestSlapOSCloudSlaveInstance( class TestSlapOSCloudSlaveInstance(
TestSlapOSCloudSoftwareInstance): TestSlapOSCloudSoftwareInstance):
launch_caucase = 1
def _skipTest(self): def _skipTest(self):
pass pass
...@@ -677,6 +683,7 @@ class TestSlapOSCloudSlaveInstance( ...@@ -677,6 +683,7 @@ class TestSlapOSCloudSlaveInstance(
class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation( class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
SlapOSTestCaseMixin): SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
...@@ -890,6 +897,7 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation( ...@@ -890,6 +897,7 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self.assertEqual(0, len(self.portal.portal_activities.getMessageList())) self.assertEqual(0, len(self.portal.portal_activities.getMessageList()))
class TestSlapOSCloudInstanceInvalidRequest(SlapOSTestCaseMixin): class TestSlapOSCloudInstanceInvalidRequest(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
......
...@@ -7,6 +7,7 @@ from erp5.component.module.DateUtils import addToDate ...@@ -7,6 +7,7 @@ from erp5.component.module.DateUtils import addToDate
class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(SlapOSTestCaseMixin): class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_assert_instance_tree_successor # slapos_assert_instance_tree_successor
################################################################# #################################################################
...@@ -115,6 +116,7 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(SlapOSTestCaseMixin): ...@@ -115,6 +116,7 @@ class TestSlapOSCoreSlapOSAssertInstanceTreeSuccessorAlarm(SlapOSTestCaseMixin):
class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin): class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_free_compute_partition # slapos_free_compute_partition
################################################################# #################################################################
...@@ -353,6 +355,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin): ...@@ -353,6 +355,7 @@ class TestSlapOSFreeComputePartitionAlarm(SlapOSTestCaseMixin):
class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_garbage_collect_destroyed_root_tree # slapos_garbage_collect_destroyed_root_tree
################################################################# #################################################################
...@@ -470,6 +473,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -470,6 +473,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin): class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_update_compute_node_capacity_scope # slapos_update_compute_node_capacity_scope
################################################################# #################################################################
...@@ -700,6 +704,7 @@ class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin): ...@@ -700,6 +704,7 @@ class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin):
class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin): class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_stop_collect_instance # slapos_stop_collect_instance
################################################################# #################################################################
...@@ -766,6 +771,7 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -766,6 +771,7 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_garbage_collect_non_allocated_root_tree # slapos_garbage_collect_non_allocated_root_tree
################################################################# #################################################################
...@@ -980,6 +986,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -980,6 +986,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
class TestSlapOSInvalidateDestroyedInstance(SlapOSTestCaseMixin): class TestSlapOSInvalidateDestroyedInstance(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_cloud_invalidate_destroyed_instance # slapos_cloud_invalidate_destroyed_instance
################################################################# #################################################################
...@@ -1157,6 +1164,8 @@ class TestSlapOSInvalidateDestroyedInstance(SlapOSTestCaseMixin): ...@@ -1157,6 +1164,8 @@ class TestSlapOSInvalidateDestroyedInstance(SlapOSTestCaseMixin):
class TestSlapOSPropagateRemoteNodeInstance(SlapOSTestCaseMixin): class TestSlapOSPropagateRemoteNodeInstance(SlapOSTestCaseMixin):
launch_caucase = 1
################################################################# #################################################################
# slapos_cloud_propagate_remote_node_instance # slapos_cloud_propagate_remote_node_instance
################################################################# #################################################################
......
...@@ -6,6 +6,8 @@ from unittest import skip ...@@ -6,6 +6,8 @@ from unittest import skip
class TestSlapOSAllocation(SlapOSTestCaseMixin): class TestSlapOSAllocation(SlapOSTestCaseMixin):
launch_caucase = 1
def makeAllocableComputeNode(self, project, software_product, def makeAllocableComputeNode(self, project, software_product,
release_variation, type_variation): release_variation, type_variation):
with TemporaryAlarmScript(self.portal, 'SoftwareInstance_tryToAllocatePartition'): with TemporaryAlarmScript(self.portal, 'SoftwareInstance_tryToAllocatePartition'):
......
...@@ -21,9 +21,13 @@ ...@@ -21,9 +21,13 @@
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
import transaction import transaction
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from cryptography import x509
from cryptography.x509.oid import NameOID
class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self.project = self.addProject() self.project = self.addProject()
...@@ -44,6 +48,14 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -44,6 +48,14 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.portal.REQUEST['compute_node_key'] = None self.portal.REQUEST['compute_node_key'] = None
self.portal.REQUEST['compute_node_certificate'] = None self.portal.REQUEST['compute_node_certificate'] = None
def _getCommonNameList(self, ssl_certificate):
cn_list = [i.value for i in ssl_certificate.subject \
if i.oid == NameOID.COMMON_NAME and i.value != "erp5-user"]
self.assertEqual(len(cn_list), 1)
return cn_list[0]
def test_generateCertificate(self): def test_generateCertificate(self):
self.login(self.compute_node.getUserId()) self.login(self.compute_node.getUserId())
self.compute_node.generateCertificate() self.compute_node.generateCertificate()
...@@ -56,10 +68,15 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -56,10 +68,15 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0] certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertIn(serial, compute_node_certificate) ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape')) self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
# self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
def test_generateCertificate_twice(self): def test_generateCertificate_twice(self):
self.login(self.compute_node.getUserId()) self.login(self.compute_node.getUserId())
...@@ -68,17 +85,22 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -68,17 +85,22 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate') compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertNotEqual(None, compute_node_key) self.assertNotEqual(None, compute_node_key)
self.assertNotEqual(None, compute_node_certificate) self.assertNotEqual(None, compute_node_certificate)
self.assertEqual(None, self.compute_node.getDestinationReference()) self.assertEqual(None, self.compute_node.getSourceReference())
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login") certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
self.assertEqual(len(certificate_login_list), 1) self.assertEqual(len(certificate_login_list), 1)
certificate_login = certificate_login_list[0] certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertIn(serial, compute_node_certificate) ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape')) self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
# self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.assertRaises(ValueError, self.compute_node.generateCertificate) self.assertRaises(ValueError, self.compute_node.generateCertificate)
self.assertEqual(None, self.portal.REQUEST.get('compute_node_key')) self.assertEqual(None, self.portal.REQUEST.get('compute_node_key'))
...@@ -270,10 +292,16 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -270,10 +292,16 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0] certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertIn(serial, compute_node_certificate) ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape')) self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
# self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
...@@ -288,7 +316,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -288,7 +316,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertRaises(ValueError, self.compute_node.revokeCertificate) self.assertRaises(ValueError, self.compute_node.revokeCertificate)
self.assertEqual(None, self.portal.REQUEST.get('compute_node_key')) self.assertEqual(None, self.portal.REQUEST.get('compute_node_key'))
self.assertEqual(None, self.portal.REQUEST.get('compute_node_certificate')) self.assertEqual(None, self.portal.REQUEST.get('compute_node_certificate'))
self.assertEqual(None, self.compute_node.getDestinationReference()) self.assertEqual(None, self.compute_node.getSourceReference())
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login") certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
self.assertEqual(len(certificate_login_list), 0) self.assertEqual(len(certificate_login_list), 0)
...@@ -304,13 +332,18 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -304,13 +332,18 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0] certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.compute_node.revokeCertificate() self.compute_node.revokeCertificate()
self.assertEqual(None, self.portal.REQUEST.get('compute_node_key')) self.assertEqual(None, self.portal.REQUEST.get('compute_node_key'))
self.assertEqual(None, self.portal.REQUEST.get('compute_node_certificate')) self.assertEqual(None, self.portal.REQUEST.get('compute_node_certificate'))
...@@ -335,17 +368,22 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -335,17 +368,22 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login") certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
self.assertEqual(len(certificate_login_list), 1) self.assertEqual(len(certificate_login_list), 1)
certificate_login = certificate_login_list[0] certificate_login = certificate_login_list[0]
destination_reference = certificate_login.getDestinationReference() source_reference = certificate_login.getCsrId()
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertIn(serial, compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
self.assertNotEqual(None, destination_reference)
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.assertNotEqual(None, source_reference)
self.compute_node.revokeCertificate() self.compute_node.revokeCertificate()
self.compute_node.generateCertificate() self.compute_node.generateCertificate()
...@@ -356,7 +394,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -356,7 +394,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate')) self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate'))
self.assertEqual(certificate_login.getValidationState(), 'invalidated') self.assertEqual(certificate_login.getValidationState(), 'invalidated')
self.assertEqual(certificate_login.getDestinationReference(), destination_reference) self.assertEqual(certificate_login.getCsrId(), source_reference)
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login") certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
...@@ -364,21 +402,25 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -364,21 +402,25 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
new_certificate_login = [i for i in certificate_login_list \ new_certificate_login = [i for i in certificate_login_list \
if i.getId() != certificate_login.getId()][0] if i.getId() != certificate_login.getId()][0]
destination_reference = certificate_login.getDestinationReference() source_reference = certificate_login.getCsrId()
self.assertEqual(new_certificate_login.getValidationState(), 'validated') self.assertEqual(new_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(new_certificate_login.getReference(), None) self.assertNotEqual(new_certificate_login.getReference(), None)
self.assertNotEqual(new_certificate_login.getReference(), self.assertNotEqual(new_certificate_login.getReference(),
certificate_login.getReference()) certificate_login.getReference())
self.assertNotEqual(new_certificate_login.getDestinationReference(), None) self.assertNotEqual(new_certificate_login.getCsrId(), None)
self.assertNotEqual(new_certificate_login.getDestinationReference(), self.assertNotEqual(new_certificate_login.getCsrId(),
certificate_login.getDestinationReference()) certificate_login.getCsrId())
serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate') compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertIn(serial, compute_node_certificate)
self.assertIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape')) ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertNotIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape')) self.assertEqual(len(ssl_certificate.subject), 2)
cn = [i.value for i in ssl_certificate.subject if i.oid == NameOID.COMMON_NAME][-1]
self.assertEqual(new_certificate_login.getReference().decode("UTF-8"), cn)
self.assertNotEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertIn(certificate_login.getCsrId(), compute_node_certificate)
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
...@@ -394,17 +436,19 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -394,17 +436,19 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login") certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
self.assertEqual(len(certificate_login_list), 1) self.assertEqual(len(certificate_login_list), 1)
certificate_login = certificate_login_list[0] certificate_login = certificate_login_list[0]
destination_reference = certificate_login.getDestinationReference() source_reference = certificate_login.getCsrId()
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16)
self.assertIn(serial, compute_node_certificate) ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape')) self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
self.assertNotEqual(None, destination_reference) self.assertNotEqual(None, source_reference)
self.compute_node.revokeCertificate() self.compute_node.revokeCertificate()
self.compute_node.generateCertificate() self.compute_node.generateCertificate()
...@@ -415,7 +459,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -415,7 +459,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate')) self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate'))
self.assertEqual(certificate_login.getValidationState(), 'invalidated') self.assertEqual(certificate_login.getValidationState(), 'invalidated')
self.assertEqual(certificate_login.getDestinationReference(), destination_reference) self.assertEqual(certificate_login.getCsrId(), source_reference)
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login") certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
...@@ -423,22 +467,22 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -423,22 +467,22 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
new_certificate_login = [i for i in certificate_login_list \ new_certificate_login = [i for i in certificate_login_list \
if i.getId() != certificate_login.getId()][0] if i.getId() != certificate_login.getId()][0]
destination_reference = certificate_login.getDestinationReference() source_reference = certificate_login.getCsrId()
self.assertEqual(new_certificate_login.getValidationState(), 'validated') self.assertEqual(new_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(new_certificate_login.getReference(), None) self.assertNotEqual(new_certificate_login.getReference(), None)
self.assertNotEqual(new_certificate_login.getReference(), self.assertNotEqual(new_certificate_login.getReference(),
certificate_login.getReference()) certificate_login.getReference())
self.assertNotEqual(new_certificate_login.getDestinationReference(), None) self.assertNotEqual(new_certificate_login.getCsrId(), None)
self.assertNotEqual(new_certificate_login.getDestinationReference(), self.assertNotEqual(new_certificate_login.getCsrId(),
certificate_login.getDestinationReference()) certificate_login.getCsrId())
serial = '0x%x' % int(new_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate') compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertIn(serial, compute_node_certificate)
self.assertIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotIn(certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(new_certificate_login.getReference().decode("UTF-8"), cn)
self.assertNotEqual(certificate_login.getReference().decode("UTF-8"), cn)
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
...@@ -451,7 +495,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -451,7 +495,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate')) self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate'))
self.assertEqual(new_certificate_login.getValidationState(), 'invalidated') self.assertEqual(new_certificate_login.getValidationState(), 'invalidated')
self.assertNotEqual(new_certificate_login.getDestinationReference(), destination_reference) self.assertNotEqual(new_certificate_login.getCsrId(), source_reference)
self.assertNotEqual(new_certificate_login.getReference(), None) self.assertNotEqual(new_certificate_login.getReference(), None)
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login") certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
...@@ -460,22 +504,23 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -460,22 +504,23 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
third_certificate_login = [i for i in certificate_login_list \ third_certificate_login = [i for i in certificate_login_list \
if i.getId() not in [certificate_login.getId(), new_certificate_login.getId()]][0] if i.getId() not in [certificate_login.getId(), new_certificate_login.getId()]][0]
destination_reference = new_certificate_login.getDestinationReference() source_reference = new_certificate_login.getCsrId()
self.assertEqual(third_certificate_login.getValidationState(), 'validated') self.assertEqual(third_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(third_certificate_login.getReference(), None) self.assertNotEqual(third_certificate_login.getReference(), None)
self.assertNotEqual(third_certificate_login.getReference(), self.assertNotEqual(third_certificate_login.getReference(),
certificate_login.getReference()) certificate_login.getReference())
self.assertNotEqual(third_certificate_login.getDestinationReference(), None) self.assertNotEqual(third_certificate_login.getCsrId(), None)
self.assertNotEqual(third_certificate_login.getDestinationReference(), self.assertNotEqual(third_certificate_login.getCsrId(),
new_certificate_login.getDestinationReference()) new_certificate_login.getCsrId())
serial = '0x%x' % int(third_certificate_login.getDestinationReference(), 16)
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate') compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
self.assertIn(serial, compute_node_certificate)
self.assertIn(third_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
self.assertNotIn(new_certificate_login.getReference(), compute_node_certificate.decode('string_escape'))
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
cn = self._getCommonNameList(ssl_certificate)
self.assertEqual(third_certificate_login.getReference().decode("UTF-8"), cn)
self.assertNotEqual(new_certificate_login.getReference().decode("UTF-8"), cn)
self.assertNotEqual(third_certificate_login.getReference(), self.assertNotEqual(third_certificate_login.getReference(),
self.compute_node.getReference()) self.compute_node.getReference())
......
...@@ -22,11 +22,14 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin ...@@ -22,11 +22,14 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
from erp5.component.document.SoftwareInstance import SoftwareInstance, \ from erp5.component.document.SoftwareInstance import SoftwareInstance, \
DisconnectedSoftwareTree, CyclicSoftwareTree DisconnectedSoftwareTree, CyclicSoftwareTree
import transaction import transaction
from cryptography import x509
from cryptography.x509.oid import NameOID
class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin): class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
"""Tests instance.requestInstance""" """Tests instance.requestInstance"""
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
portal = self.getPortalObject() portal = self.getPortalObject()
...@@ -1050,6 +1053,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin): ...@@ -1050,6 +1053,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin): class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
"""Tests instance.requestTransfer""" """Tests instance.requestTransfer"""
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
...@@ -1142,7 +1146,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin): ...@@ -1142,7 +1146,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.software_instance.generateCertificate() self.software_instance.generateCertificate()
self.assertNotEqual(self.software_instance.getSslKey(), None) self.assertNotEqual(self.software_instance.getSslKey(), None)
self.assertNotEqual(self.software_instance.getSslCertificate(), None) self.assertNotEqual(self.software_instance.getSslCertificate(), None)
self.assertEqual(self.software_instance.getDestinationReference(), None)
certificate_login_list = self.software_instance.objectValues(portal_type="Certificate Login") certificate_login_list = self.software_instance.objectValues(portal_type="Certificate Login")
self.assertEqual(len(certificate_login_list), 1) self.assertEqual(len(certificate_login_list), 1)
...@@ -1150,11 +1153,11 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin): ...@@ -1150,11 +1153,11 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
serial = '0x%x' % int(certificate_login.getDestinationReference(), 16) ssl_certificate = x509.load_pem_x509_certificate(self.software_instance.getSslCertificate())
self.assertIn(serial, self.software_instance.getSslCertificate()) self.assertEqual(len(ssl_certificate.subject), 2)
self.assertIn(certificate_login.getReference(), \ cn = [i.value for i in ssl_certificate.subject if i.oid == NameOID.COMMON_NAME][0]
self.software_instance.getSslCertificate().decode('string_escape')) self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
self.assertRaises(ValueError, self.software_instance.generateCertificate) self.assertRaises(ValueError, self.software_instance.generateCertificate)
def test_revokeCertificate(self): def test_revokeCertificate(self):
...@@ -1183,7 +1186,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin): ...@@ -1183,7 +1186,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0] certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated') self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None) self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getDestinationReference(), None) self.assertNotEqual(certificate_login.getCsrId(), None)
self.assertNotEqual(self.software_instance.getSslKey(), self.assertNotEqual(self.software_instance.getSslKey(),
ssl_key) ssl_key)
...@@ -1210,12 +1213,11 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin): ...@@ -1210,12 +1213,11 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertEqual(another_certificate_login.getValidationState(), 'validated') self.assertEqual(another_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(another_certificate_login.getReference(), None) self.assertNotEqual(another_certificate_login.getReference(), None)
self.assertNotEqual(another_certificate_login.getDestinationReference(), None) self.assertNotEqual(another_certificate_login.getCsrId(), None)
self.assertEqual(certificate_login.getValidationState(), 'invalidated') self.assertEqual(certificate_login.getValidationState(), 'invalidated')
self.assertNotEqual(certificate_login.getReference(), self.assertNotEqual(certificate_login.getReference(),
another_certificate_login.getReference()) another_certificate_login.getReference())
self.assertNotEqual(certificate_login.getDestinationReference(), self.assertNotEqual(certificate_login.getCsrId(),
another_certificate_login.getDestinationReference()) another_certificate_login.getCsrId())
...@@ -25,6 +25,7 @@ from AccessControl.SecurityManagement import getSecurityManager, \ ...@@ -25,6 +25,7 @@ from AccessControl.SecurityManagement import getSecurityManager, \
class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin): class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
......
...@@ -1031,6 +1031,7 @@ class TestSlapOSCrmStopInstanceTree(SlapOSTestCaseMixinWithAbort): ...@@ -1031,6 +1031,7 @@ class TestSlapOSCrmStopInstanceTree(SlapOSTestCaseMixinWithAbort):
class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort): class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
launch_caucase = 1
def createRegularisationRequest(self): def createRegularisationRequest(self):
new_id = self.generateNewId() new_id = self.generateNewId()
......
...@@ -116,6 +116,7 @@ class TestSlapOSCrmMonitoringCheckComputeNodeProjectState(TestSlapOSCrmMonitorin ...@@ -116,6 +116,7 @@ class TestSlapOSCrmMonitoringCheckComputeNodeProjectState(TestSlapOSCrmMonitorin
class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin): class TestSlapOSCrmMonitoringCheckComputeNodeState(TestSlapOSCrmMonitoringMixin):
launch_caucase = 1
########################################################################## ##########################################################################
# ComputeNode_checkProjectMontoringState > ComputeNode_checkMonitoringState # ComputeNode_checkProjectMontoringState > ComputeNode_checkMonitoringState
########################################################################## ##########################################################################
......
...@@ -229,6 +229,8 @@ class TestCRMPropertySheetConstraint(SlapOSTestCaseMixin): ...@@ -229,6 +229,8 @@ class TestCRMPropertySheetConstraint(SlapOSTestCaseMixin):
class TestProject_createTicketWithCausality(TestCRMSkinsMixin): class TestProject_createTicketWithCausality(TestCRMSkinsMixin):
launch_caucase = 1
def testProject_createTicketWithCausality(self): def testProject_createTicketWithCausality(self):
self._makeComputeNode(self.project) self._makeComputeNode(self.project)
self._makeComplexComputeNode(self.project) self._makeComplexComputeNode(self.project)
......
...@@ -599,6 +599,7 @@ class TestERP5Site_invalidate(TestSlapOSHalJsonStyleMixin): ...@@ -599,6 +599,7 @@ class TestERP5Site_invalidate(TestSlapOSHalJsonStyleMixin):
class TestComputeNode_get_revoke_Certificate(TestSlapOSHalJsonStyleMixin): class TestComputeNode_get_revoke_Certificate(TestSlapOSHalJsonStyleMixin):
launch_caucase = 1
def test_ComputeNode_getCertificate(self): def test_ComputeNode_getCertificate(self):
compute_node = self._makeComputeNode() compute_node = self._makeComputeNode()
self.assertEqual(0, len(compute_node.objectValues(portal_type=["ERP5 Login", "Certificate Login"]))) self.assertEqual(0, len(compute_node.objectValues(portal_type=["ERP5 Login", "Certificate Login"])))
...@@ -1444,6 +1445,8 @@ return []""") ...@@ -1444,6 +1445,8 @@ return []""")
class TestSoftwareInstance_getAllocationInformation(TestSlapOSHalJsonStyleMixin): class TestSoftwareInstance_getAllocationInformation(TestSlapOSHalJsonStyleMixin):
launch_caucase = 1
def test_SoftwareInstance_getAllocationInformation_not_allocated(self): def test_SoftwareInstance_getAllocationInformation_not_allocated(self):
self._makeTree() self._makeTree()
self.changeSkin('RJS') self.changeSkin('RJS')
......
...@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona ...@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona
class TestSlapOSUIHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase): class TestSlapOSUIHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase):
foreground = 0 foreground = 0
run_only = "slaposjs_zuite" run_only = "slaposjs_zuite"
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
ERP5TypeFunctionalTestCase.afterSetUp(self) ERP5TypeFunctionalTestCase.afterSetUp(self)
......
...@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona ...@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona
class TestSlapOSUIZHHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase): class TestSlapOSUIZHHalStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase):
foreground = 0 foreground = 0
run_only = "slaposjs_zuite" run_only = "slaposjs_zuite"
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
ERP5TypeFunctionalTestCase.afterSetUp(self) ERP5TypeFunctionalTestCase.afterSetUp(self)
......
...@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona ...@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona
class TestSlapOSPanelStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase): class TestSlapOSPanelStyle(SlapOSTestCaseMixin, ERP5TypeFunctionalTestCase):
foreground = 0 foreground = 0
run_only = "slapos_panel_zuite" run_only = "slapos_panel_zuite"
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
ERP5TypeFunctionalTestCase.afterSetUp(self) ERP5TypeFunctionalTestCase.afterSetUp(self)
......
...@@ -23,6 +23,8 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin ...@@ -23,6 +23,8 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
class TestSlapOSPDMCreateUpgradeDecisionSkins(SlapOSTestCaseMixin): class TestSlapOSPDMCreateUpgradeDecisionSkins(SlapOSTestCaseMixin):
launch_caucase = 1
def test_createUpgradeDecision_destroyed_instance(self): def test_createUpgradeDecision_destroyed_instance(self):
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type="Instance Tree" portal_type="Instance Tree"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
class TestSlapOSDestroySoftwareInstallation(SlapOSTestCaseMixin): class TestSlapOSDestroySoftwareInstallation(SlapOSTestCaseMixin):
launch_caucase = 1
def bootstrapSoftwareInstallation(self, is_allocated=True, is_supplied=True): def bootstrapSoftwareInstallation(self, is_allocated=True, is_supplied=True):
if is_allocated: if is_allocated:
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
class TestSlapOSPDMSkins(SlapOSTestCaseMixin): class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
launch_caucase = 1
def test_requestUpgrade(self): def test_requestUpgrade(self):
software_product, _, type_variation, compute_node, _, instance_tree = self.bootstrapAllocableInstanceTree() software_product, _, type_variation, compute_node, _, instance_tree = self.bootstrapAllocableInstanceTree()
......
...@@ -49,6 +49,7 @@ def canonical_xml(xml): ...@@ -49,6 +49,7 @@ def canonical_xml(xml):
class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin): class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
launch_caucase = 1
def afterSetUp(self): def afterSetUp(self):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self.portal_slap = self.portal.portal_slap self.portal_slap = self.portal.portal_slap
......
...@@ -30,6 +30,7 @@ import random ...@@ -30,6 +30,7 @@ import random
import transaction import transaction
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeCaucaseTestCase import ERP5TypeCaucaseTestCase
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
import os import os
import glob import glob
...@@ -40,9 +41,10 @@ from App.config import getConfiguration ...@@ -40,9 +41,10 @@ from App.config import getConfiguration
config = getConfiguration() config = getConfiguration()
class testSlapOSMixin(ERP5TypeTestCase): class testSlapOSMixin(ERP5TypeCaucaseTestCase):
abort_transaction = 0 abort_transaction = 0
launch_caucase = 0
def clearCache(self): def clearCache(self):
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
...@@ -96,6 +98,8 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -96,6 +98,8 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.email_from_address = 'romain@nexedi.com' self.portal.email_from_address = 'romain@nexedi.com'
self.portal.email_to_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): if getattr(self.portal.portal_caches, 'erp5_site_global_id', None):
# we are not on live test so multiple tests can run in parallel # we are not on live test so multiple tests can run in parallel
...@@ -103,8 +107,6 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -103,8 +107,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.portal_caches.erp5_site_global_id = '%s' % random.random() self.portal.portal_caches.erp5_site_global_id = '%s' % random.random()
self.portal.portal_caches._p_changed = 1 self.portal.portal_caches._p_changed = 1
if self.isLiveTest():
return
self.commit() self.commit()
self.portal.portal_caches.updateCache() 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