Commit 9da008b1 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: (test) pin Datetime to prevent flakly failures

  After the 25 of the month, the simulation generate extra SPL for discounts,
  pin DateTime to have stable assertions regardless the date the test runs.
parent 032ce4cf
...@@ -325,118 +325,120 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin): ...@@ -325,118 +325,120 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_without_accounting_scenario(self): def test_virtual_master_without_accounting_scenario(self):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False) with PinnedDateTime(self, DateTime('2024/02/17')):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
self.tic() self.tic()
self.logout() self.logout()
# lets join as slapos administrator, which will own few compute_nodes # lets join as slapos administrator, which will own few compute_nodes
owner_reference = 'owner-%s' % self.generateNewId() owner_reference = 'owner-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, owner_reference) self.joinSlapOS(self.web_site, owner_reference)
self.login() self.login()
owner_person = self.portal.portal_catalog.getResultValue( owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference=owner_reference).getParentValue() reference=owner_reference).getParentValue()
# owner_person.setCareerSubordinationValue(seller_organisation) # owner_person.setCareerSubordinationValue(seller_organisation)
self.tic() self.tic()
# hooray, now it is time to create compute_nodes # hooray, now it is time to create compute_nodes
self.logout() self.logout()
self.login(sale_person.getUserId()) self.login(sale_person.getUserId())
# create a default project # create a default project
project_relative_url = self.addProject(person=owner_person, currency=currency) project_relative_url = self.addProject(person=owner_person, currency=currency)
self.logout() self.logout()
self.login() self.login()
project = self.portal.restrictedTraverse(project_relative_url) project = self.portal.restrictedTraverse(project_relative_url)
preference = self.portal.portal_preferences.slapos_default_system_preference preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit( preference.edit(
preferred_subscription_assignment_category_list=[ preferred_subscription_assignment_category_list=[
'function/customer', 'function/customer',
'role/client', 'role/client',
'destination_project/%s' % project.getRelativeUrl() 'destination_project/%s' % project.getRelativeUrl()
] ]
) )
self.tic() self.tic()
self.logout() self.logout()
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
public_server_title = 'Public Server for %s' % owner_reference public_server_title = 'Public Server for %s' % owner_reference
public_server_id = self.requestComputeNode(public_server_title, project.getReference()) public_server_id = self.requestComputeNode(public_server_title, project.getReference())
public_server = self.portal.portal_catalog.getResultValue( public_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=public_server_id) portal_type='Compute Node', reference=public_server_id)
self.setAccessToMemcached(public_server) self.setAccessToMemcached(public_server)
self.assertNotEqual(None, public_server) self.assertNotEqual(None, public_server)
self.setServerOpenPublic(public_server) self.setServerOpenPublic(public_server)
public_server.generateCertificate() public_server.generateCertificate()
# and install some software on them # and install some software on them
public_server_software = self.generateNewSoftwareReleaseUrl() public_server_software = self.generateNewSoftwareReleaseUrl()
public_instance_type = 'public type' public_instance_type = 'public type'
self.supplySoftware(public_server, public_server_software) self.supplySoftware(public_server, public_server_software)
# format the compute_nodes # format the compute_nodes
self.formatComputeNode(public_server) self.formatComputeNode(public_server)
software_product, release_variation, type_variation = self.addSoftwareProduct( software_product, release_variation, type_variation = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type "instance product", project, public_server_software, public_instance_type
) )
self.addAllocationSupply("for compute node", public_server, software_product, self.addAllocationSupply("for compute node", public_server, software_product,
release_variation, type_variation) release_variation, type_variation)
self.tic() self.tic()
self.logout() self.logout()
self.login() self.login()
self.checkServiceSubscriptionRequest(public_server) self.checkServiceSubscriptionRequest(public_server)
# join as the another visitor and request software instance on public # join as the another visitor and request software instance on public
# compute_node # compute_node
self.logout() self.logout()
public_reference = 'public-%s' % self.generateNewId() public_reference = 'public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, public_reference) self.joinSlapOS(self.web_site, public_reference)
self.login() self.login()
public_person = self.portal.portal_catalog.getResultValue( public_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference=public_reference).getParentValue() reference=public_reference).getParentValue()
public_instance_title = 'Public title %s' % self.generateNewId() with PinnedDateTime(self, DateTime('2024/02/17 01:01')):
self.checkInstanceAllocation(public_person.getUserId(), public_instance_title = 'Public title %s' % self.generateNewId()
public_reference, public_instance_title, self.checkInstanceAllocation(public_person.getUserId(),
public_server_software, public_instance_type, public_reference, public_instance_title,
public_server, project.getReference()) public_server_software, public_instance_type,
public_server, project.getReference())
self.login() self.login()
public_person = self.portal.portal_catalog.getResultValue( public_person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=public_reference).getParentValue() portal_type='ERP5 Login', reference=public_reference).getParentValue()
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
# and the instances # and the instances
self.checkInstanceUnallocation(public_person.getUserId(), self.checkInstanceUnallocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server, public_server_software, public_instance_type, public_server,
project.getReference()) project.getReference())
# and uninstall some software on them # and uninstall some software on them
self.logout() self.logout()
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
self.supplySoftware(public_server, public_server_software, self.supplySoftware(public_server, public_server_software,
state='destroyed') state='destroyed')
self.logout() self.logout()
# Uninstall from compute_node # Uninstall from compute_node
self.login() self.login()
self.simulateSlapgridSR(public_server) self.simulateSlapgridSR(public_server)
self.tic() self.tic()
self.login() self.login()
# Ensure no unexpected object has been created # Ensure no unexpected object has been created
...@@ -500,13 +502,13 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -500,13 +502,13 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# object. It requires to be created under shadow user for security reasons. # object. It requires to be created under shadow user for security reasons.
tmp_subscription_request = createTempSubscription(person, source_section, total_price, currency) tmp_subscription_request = createTempSubscription(person, source_section, total_price, currency)
return person.Entity_createDepositPaymentTransaction([tmp_subscription_request]) return person.Entity_createDepositPaymentTransaction([tmp_subscription_request])
payment_transaction = owner_person.Person_restrictMethodAsShadowUser( payment_transaction = owner_person.Person_restrictMethodAsShadowUser(
shadow_document=owner_person, shadow_document=owner_person,
callable_object=wrapWithShadow, callable_object=wrapWithShadow,
argument_list=[owner_person, seller_organisation.getRelativeUrl(), argument_list=[owner_person, seller_organisation.getRelativeUrl(),
total_price, currency.getRelativeUrl()]) total_price, currency.getRelativeUrl()])
self.tic() self.tic()
self.logout() self.logout()
self.login() self.login()
...@@ -699,9 +701,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -699,9 +701,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
# Pay deposit to validate virtual master + one computer, for the organisation # Pay deposit to validate virtual master + one computer, for the organisation
# For now we cannot rely on user payments # For now we cannot rely on user payments
deposit_amount = 42.0 + 99.0 deposit_amount = 42.0 + 99.0
ledger = self.portal.portal_categories.ledger.automated ledger = self.portal.portal_categories.ledger.automated
outstanding_amount_list = customer_section_organisation.Entity_getOutstandingDepositAmountList( outstanding_amount_list = customer_section_organisation.Entity_getOutstandingDepositAmountList(
currency.getUid(), ledger_uid=ledger.getUid()) currency.getUid(), ledger_uid=ledger.getUid())
amount = sum([i.total_price for i in outstanding_amount_list]) amount = sum([i.total_price for i in outstanding_amount_list])
...@@ -907,14 +909,14 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -907,14 +909,14 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
self.login(project_owner_person.getUserId()) self.login(project_owner_person.getUserId())
# Pay deposit to validate virtual master + one computer # Pay deposit to validate virtual master + one computer
deposit_amount = 42.0 + 99.0 deposit_amount = 42.0 + 99.0
ledger = self.portal.portal_categories.ledger.automated ledger = self.portal.portal_categories.ledger.automated
outstanding_amount_list = project_owner_person.Entity_getOutstandingDepositAmountList( outstanding_amount_list = project_owner_person.Entity_getOutstandingDepositAmountList(
currency.getUid(), ledger_uid=ledger.getUid()) currency.getUid(), ledger_uid=ledger.getUid())
amount = sum([i.total_price for i in outstanding_amount_list]) amount = sum([i.total_price for i in outstanding_amount_list])
self.assertEqual(amount, deposit_amount) self.assertEqual(amount, deposit_amount)
# Ensure to pay from the website # Ensure to pay from the website
outstanding_amount = self.web_site.restrictedTraverse(outstanding_amount_list[0].getRelativeUrl()) outstanding_amount = self.web_site.restrictedTraverse(outstanding_amount_list[0].getRelativeUrl())
outstanding_amount.Base_createExternalPaymentTransactionFromOutstandingAmountAndRedirect() outstanding_amount.Base_createExternalPaymentTransactionFromOutstandingAmountAndRedirect()
...@@ -1036,142 +1038,149 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -1036,142 +1038,149 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_slave_without_accounting_scenario(self): def test_virtual_master_slave_without_accounting_scenario(self):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False) with PinnedDateTime(self, DateTime('2024/02/17')):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
self.web_site = self.portal.web_site_module.slapos_master_panel self.web_site = self.portal.web_site_module.slapos_master_panel
# some preparation # some preparation
self.logout() self.logout()
# lets join as slapos administrator, which will own few compute_nodes # lets join as slapos administrator, which will own few compute_nodes
owner_reference = 'owner-%s' % self.generateNewId() owner_reference = 'owner-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, owner_reference) self.joinSlapOS(self.web_site, owner_reference)
self.login() self.login()
owner_person = self.portal.portal_catalog.getResultValue( owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference=owner_reference).getParentValue() reference=owner_reference).getParentValue()
self.tic() self.tic()
self.logout() self.logout()
self.login(sale_person.getUserId()) self.login(sale_person.getUserId())
# create a default project # create a default project
project_relative_url = self.addProject(person=owner_person, currency=currency) project_relative_url = self.addProject(person=owner_person, currency=currency)
self.logout() self.logout()
self.login() self.login()
project = self.portal.restrictedTraverse(project_relative_url) project = self.portal.restrictedTraverse(project_relative_url)
preference = self.portal.portal_preferences.slapos_default_system_preference preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit( preference.edit(
preferred_subscription_assignment_category_list=[ preferred_subscription_assignment_category_list=[
'function/customer', 'function/customer',
'role/client', 'role/client',
'destination_project/%s' % project.getRelativeUrl() 'destination_project/%s' % project.getRelativeUrl()
] ]
) )
self.tic() self.tic()
# hooray, now it is time to create compute_nodes # hooray, now it is time to create compute_nodes
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
public_server_title = 'Public Server for %s' % owner_reference public_server_title = 'Public Server for %s' % owner_reference
public_server_id = self.requestComputeNode(public_server_title, project.getReference()) public_server_id = self.requestComputeNode(public_server_title, project.getReference())
public_server = self.portal.portal_catalog.getResultValue( public_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=public_server_id) portal_type='Compute Node', reference=public_server_id)
self.setAccessToMemcached(public_server) self.setAccessToMemcached(public_server)
self.assertNotEqual(None, public_server) self.assertNotEqual(None, public_server)
self.setServerOpenPublic(public_server) self.setServerOpenPublic(public_server)
public_server.generateCertificate() public_server.generateCertificate()
# and install some software on them
public_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(public_server, public_server_software)
#software_product, release_variation, type_variation = self.addSoftwareProduct(
public_instance_type = 'public type'
software_product, software_release, software_type = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
self.addAllocationSupply("for compute node", public_server, software_product, # and install some software on them
software_release, software_type) public_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(public_server, public_server_software)
# format the compute_nodes #software_product, release_variation, type_variation = self.addSoftwareProduct(
self.formatComputeNode(public_server) public_instance_type = 'public type'
software_product, software_release, software_type = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
# join as the another visitor and request software instance on public self.addAllocationSupply("for compute node", public_server, software_product,
# compute_node software_release, software_type)
self.logout()
public_reference = 'public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, public_reference)
self.login() # format the compute_nodes
public_person = self.portal.portal_catalog.getResultValue( self.formatComputeNode(public_server)
portal_type="ERP5 Login",
reference=public_reference).getParentValue()
public_instance_title = 'Public title %s' % self.generateNewId() # join as the another visitor and request software instance on public
self.checkInstanceAllocation(public_person.getUserId(), # compute_node
public_reference, public_instance_title, self.logout()
public_server_software, public_instance_type, public_reference = 'public-%s' % self.generateNewId()
public_server, project.getReference()) self.joinSlapOS(self.web_site, public_reference)
# hooray, now it is time to create compute_nodes self.login()
self.login(owner_person.getUserId()) public_person = self.portal.portal_catalog.getResultValue(
instance_node_title = 'Shared Instance for %s' % owner_reference portal_type="ERP5 Login",
# Convert the Software Instance into an Instance Node reference=public_reference).getParentValue()
# to explicitely mark it as accepting Slave Instance
software_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=public_instance_title)
instance_node = self.addInstanceNode(instance_node_title, software_instance)
slave_server_software = self.generateNewSoftwareReleaseUrl()
slave_instance_type = 'slave type'
software_product, software_release, software_type = self.addSoftwareProduct(
'share product', project, slave_server_software, slave_instance_type
)
self.addAllocationSupply("for instance node", instance_node, software_product,
software_release, software_type)
slave_instance_title = 'Slave title %s' % self.generateNewId() with PinnedDateTime(self, DateTime('2024/02/17 00:05')):
self.checkSlaveInstanceAllocation(public_person.getUserId(), public_instance_title = 'Public title %s' % self.generateNewId()
public_reference, slave_instance_title, self.checkInstanceAllocation(public_person.getUserId(),
slave_server_software, slave_instance_type, public_reference, public_instance_title,
public_server, project.getReference()) public_server_software, public_instance_type,
public_server, project.getReference())
self.login() # hooray, now it is time to create compute_nodes
public_person = self.portal.portal_catalog.getResultValue( self.login(owner_person.getUserId())
portal_type='ERP5 Login', reference=public_reference).getParentValue() instance_node_title = 'Shared Instance for %s' % owner_reference
self.login(owner_person.getUserId()) # Convert the Software Instance into an Instance Node
# to explicitely mark it as accepting Slave Instance
software_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=public_instance_title)
instance_node = self.addInstanceNode(instance_node_title, software_instance)
slave_server_software = self.generateNewSoftwareReleaseUrl()
slave_instance_type = 'slave type'
software_product, software_release, software_type = self.addSoftwareProduct(
'share product', project, slave_server_software, slave_instance_type
)
self.addAllocationSupply("for instance node", instance_node, software_product,
software_release, software_type)
# and the instances self.login()
self.checkSlaveInstanceUnallocation(public_person.getUserId(), public_person = self.portal.portal_catalog.getResultValue(
public_reference, slave_instance_title, portal_type="ERP5 Login",
slave_server_software, slave_instance_type, public_server, reference=public_reference).getParentValue()
project.getReference())
# and uninstall some software on them slave_instance_title = 'Slave title %s' % self.generateNewId()
self.logout() self.checkSlaveInstanceAllocation(public_person.getUserId(),
self.login(owner_person.getUserId()) public_reference, slave_instance_title,
self.supplySoftware(public_server, public_server_software, slave_server_software, slave_instance_type,
state='destroyed') public_server, project.getReference())
self.logout() self.login()
# Uninstall from compute_node public_person = self.portal.portal_catalog.getResultValue(
self.login() portal_type='ERP5 Login', reference=public_reference).getParentValue()
self.simulateSlapgridSR(public_server) self.login(owner_person.getUserId())
self.tic() # and the instances
self.checkSlaveInstanceUnallocation(public_person.getUserId(),
public_reference, slave_instance_title,
slave_server_software, slave_instance_type, public_server,
project.getReference())
self.login() # and uninstall some software on them
# Ensure no unexpected object has been created self.logout()
# 6 allocation supply/line/cell self.login(owner_person.getUserId())
# 2 compute/instance node self.supplySoftware(public_server, public_server_software,
# 1 credential request state='destroyed')
# 2 instance tree
# 9 open sale order / line self.logout()
# 3 assignment # Uninstall from compute_node
self.login()
self.simulateSlapgridSR(public_server)
self.tic()
self.login()
# Ensure no unexpected object has been created
# 6 allocation supply/line/cell
# 2 compute/instance node
# 1 credential request
# 2 instance tree
# 9 open sale order / line
# 3 assignment
# 4 simulation movement # 4 simulation movement
# 4 sale packing list # 4 sale packing list
# 2 sale trade condition # 2 sale trade condition
...@@ -1185,100 +1194,102 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -1185,100 +1194,102 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_slave_on_same_tree_without_accounting_scenario(self): def test_virtual_master_slave_on_same_tree_without_accounting_scenario(self):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False) with PinnedDateTime(self, DateTime('2024/02/17')):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
self.web_site = self.portal.web_site_module.slapos_master_panel self.web_site = self.portal.web_site_module.slapos_master_panel
# some preparation # some preparation
self.logout() self.logout()
# lets join as slapos administrator, which will own few compute_nodes # lets join as slapos administrator, which will own few compute_nodes
owner_reference = 'owner-%s' % self.generateNewId() owner_reference = 'owner-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, owner_reference) self.joinSlapOS(self.web_site, owner_reference)
self.login() self.login()
owner_person = self.portal.portal_catalog.getResultValue( owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference=owner_reference).getParentValue() reference=owner_reference).getParentValue()
self.tic() self.tic()
self.logout() self.logout()
self.login(sale_person.getUserId()) self.login(sale_person.getUserId())
# create a default project # create a default project
project_relative_url = self.addProject(person=owner_person, currency=currency) project_relative_url = self.addProject(person=owner_person, currency=currency)
self.logout() self.logout()
self.login() self.login()
project = self.portal.restrictedTraverse(project_relative_url) project = self.portal.restrictedTraverse(project_relative_url)
preference = self.portal.portal_preferences.slapos_default_system_preference preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit( preference.edit(
preferred_subscription_assignment_category_list=[ preferred_subscription_assignment_category_list=[
'function/customer', 'function/customer',
'role/client', 'role/client',
'destination_project/%s' % project.getRelativeUrl() 'destination_project/%s' % project.getRelativeUrl()
] ]
) )
self.tic() self.tic()
# hooray, now it is time to create compute_nodes # hooray, now it is time to create compute_nodes
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
public_server_title = 'Public Server for %s' % owner_reference public_server_title = 'Public Server for %s' % owner_reference
public_server_id = self.requestComputeNode(public_server_title, project.getReference()) public_server_id = self.requestComputeNode(public_server_title, project.getReference())
public_server = self.portal.portal_catalog.getResultValue( public_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=public_server_id) portal_type='Compute Node', reference=public_server_id)
self.setAccessToMemcached(public_server) self.setAccessToMemcached(public_server)
self.assertNotEqual(None, public_server) self.assertNotEqual(None, public_server)
self.setServerOpenPublic(public_server) self.setServerOpenPublic(public_server)
public_server.generateCertificate() public_server.generateCertificate()
# and install some software on them
public_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(public_server, public_server_software)
#software_product, release_variation, type_variation = self.addSoftwareProduct(
public_instance_type = 'public type'
software_product, software_release, software_type = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
self.addAllocationSupply("for compute node", public_server, software_product, # and install some software on them
software_release, software_type, public_server_software = self.generateNewSoftwareReleaseUrl()
is_slave_on_same_instance_tree_allocable=True) self.supplySoftware(public_server, public_server_software)
# format the compute_nodes #software_product, release_variation, type_variation = self.addSoftwareProduct(
self.formatComputeNode(public_server) public_instance_type = 'public type'
software_product, software_release, software_type = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
# join as the another visitor and request software instance on public self.addAllocationSupply("for compute node", public_server, software_product,
# compute_node software_release, software_type,
self.logout() is_slave_on_same_instance_tree_allocable=True)
public_reference = 'public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, public_reference)
self.login() # format the compute_nodes
public_person = self.portal.portal_catalog.getResultValue( self.formatComputeNode(public_server)
portal_type="ERP5 Login",
reference=public_reference).getParentValue()
public_instance_title = 'Public title %s' % self.generateNewId() # join as the another visitor and request software instance on public
self.checkInstanceAllocation(public_person.getUserId(), # compute_node
public_reference, public_instance_title, self.logout()
public_server_software, public_instance_type, public_reference = 'public-%s' % self.generateNewId()
public_server, project.getReference()) self.joinSlapOS(self.web_site, public_reference)
self.tic() self.login()
public_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login",
reference=public_reference).getParentValue()
# request slave instance on the same instance tree with PinnedDateTime(self, DateTime('2024/02/17 00:05')):
self.login(public_person.getUserId()) public_instance_title = 'Public title %s' % self.generateNewId()
slave_instance_title = 'Slave title %s' % self.generateNewId() self.checkInstanceAllocation(public_person.getUserId(),
self.checkInstanceTreeSlaveInstanceAllocation( public_reference, public_instance_title,
public_person.getUserId(), public_server_software, public_instance_type,
public_reference, public_instance_title, public_server, project.getReference())
slave_instance_title,
public_server_software, public_instance_type, self.tic()
public_server, project.getReference()
) # request slave instance on the same instance tree
self.login(public_person.getUserId())
slave_instance_title = 'Slave title %s' % self.generateNewId()
self.checkInstanceTreeSlaveInstanceAllocation(
public_person.getUserId(),
public_reference, public_instance_title,
slave_instance_title,
public_server_software, public_instance_type,
public_server, project.getReference()
)
self.login() self.login()
# Ensure no unexpected object has been created # Ensure no unexpected object has been created
...@@ -1301,201 +1312,203 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -1301,201 +1312,203 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_on_remote_tree_without_accounting_scenario(self): def test_virtual_master_on_remote_tree_without_accounting_scenario(self):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False) with PinnedDateTime(self, DateTime('2024/02/17')):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
self.web_site = self.portal.web_site_module.slapos_master_panel self.web_site = self.portal.web_site_module.slapos_master_panel
# some preparation # some preparation
self.logout() self.logout()
# lets join as slapos administrator, which will own few compute_nodes
remote_owner_reference = 'remote-owner-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, remote_owner_reference)
self.login() # lets join as slapos administrator, which will own few compute_nodes
remote_owner_person = self.portal.portal_catalog.getResultValue( remote_owner_reference = 'remote-owner-%s' % self.generateNewId()
portal_type="ERP5 Login", self.joinSlapOS(self.web_site, remote_owner_reference)
reference=remote_owner_reference).getParentValue()
self.tic()
self.logout() self.login()
self.login(sale_person.getUserId()) remote_owner_person = self.portal.portal_catalog.getResultValue(
# create a default project portal_type="ERP5 Login",
remote_project_relative_url = self.addProject(person=remote_owner_person, currency=currency) reference=remote_owner_reference).getParentValue()
self.tic()
self.logout() self.logout()
self.login() self.login(sale_person.getUserId())
remote_project = self.portal.restrictedTraverse(remote_project_relative_url) # create a default project
remote_project_relative_url = self.addProject(person=remote_owner_person, currency=currency)
preference = self.portal.portal_preferences.slapos_default_system_preference self.logout()
preference.edit( self.login()
preferred_subscription_assignment_category_list=[ remote_project = self.portal.restrictedTraverse(remote_project_relative_url)
'function/customer',
'role/client',
'destination_project/%s' % remote_project.getRelativeUrl()
]
)
self.tic()
# hooray, now it is time to create compute_nodes preference = self.portal.portal_preferences.slapos_default_system_preference
self.login(remote_owner_person.getUserId()) preference.edit(
preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % remote_project.getRelativeUrl()
]
)
self.tic()
remote_server_title = 'Remote Server for %s' % remote_owner_person # hooray, now it is time to create compute_nodes
remote_server_id = self.requestComputeNode(remote_server_title, remote_project.getReference()) self.login(remote_owner_person.getUserId())
remote_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=remote_server_id)
self.setAccessToMemcached(remote_server)
self.assertNotEqual(None, remote_server)
self.setServerOpenPublic(remote_server)
remote_server.generateCertificate()
# and install some software on them remote_server_title = 'Remote Server for %s' % remote_owner_person
remote_server_software = self.generateNewSoftwareReleaseUrl() remote_server_id = self.requestComputeNode(remote_server_title, remote_project.getReference())
remote_instance_type = 'public type' remote_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=remote_server_id)
self.setAccessToMemcached(remote_server)
self.assertNotEqual(None, remote_server)
self.setServerOpenPublic(remote_server)
remote_server.generateCertificate()
self.supplySoftware(remote_server, remote_server_software) # and install some software on them
remote_server_software = self.generateNewSoftwareReleaseUrl()
remote_instance_type = 'public type'
# format the compute_nodes self.supplySoftware(remote_server, remote_server_software)
self.formatComputeNode(remote_server)
remote_software_product, remote_release_variation, remote_type_variation = self.addSoftwareProduct( # format the compute_nodes
"remote product", remote_project, remote_server_software, remote_instance_type self.formatComputeNode(remote_server)
)
self.addAllocationSupply("for compute node", remote_server, remote_software_product, remote_software_product, remote_release_variation, remote_type_variation = self.addSoftwareProduct(
remote_release_variation, remote_type_variation) "remote product", remote_project, remote_server_software, remote_instance_type
)
# join as the another visitor and request software instance on public self.addAllocationSupply("for compute node", remote_server, remote_software_product,
# compute_node remote_release_variation, remote_type_variation)
self.logout()
remote_public_reference = 'remote-public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, remote_public_reference)
self.login() # join as the another visitor and request software instance on public
remote_public_person = self.portal.portal_catalog.getResultValue( # compute_node
portal_type="ERP5 Login", self.logout()
reference=remote_public_reference).getParentValue() remote_public_reference = 'remote-public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, remote_public_reference)
#################################### self.login()
# Create a local project remote_public_person = self.portal.portal_catalog.getResultValue(
#################################### portal_type="ERP5 Login",
self.logout() reference=remote_public_reference).getParentValue()
self.login(sale_person.getUserId())
# create a default project
project_relative_url = self.addProject(person=remote_public_person, currency=currency)
self.logout() ####################################
self.login() # Create a local project
project = self.portal.restrictedTraverse(project_relative_url) ####################################
self.logout()
self.login(sale_person.getUserId())
# create a default project
project_relative_url = self.addProject(person=remote_public_person, currency=currency)
preference.edit( self.logout()
preferred_subscription_assignment_category_list=[ self.login()
'function/customer', project = self.portal.restrictedTraverse(project_relative_url)
'role/client',
'destination_project/%s' % project.getRelativeUrl()
]
)
self.tic()
owner_person = remote_public_person preference.edit(
self.logout() preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % project.getRelativeUrl()
]
)
self.tic()
# hooray, now it is time to create compute_nodes owner_person = remote_public_person
self.login(owner_person.getUserId()) self.logout()
remote_compute_node = self.requestRemoteNode(project, remote_project, # hooray, now it is time to create compute_nodes
remote_public_person) self.login(owner_person.getUserId())
# and install some software on them remote_compute_node = self.requestRemoteNode(project, remote_project,
public_server_software = remote_server_software remote_public_person)
#software_product, release_variation, type_variation = self.addSoftwareProduct( # and install some software on them
public_instance_type = remote_instance_type public_server_software = remote_server_software
software_product, software_release, software_type = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
self.addAllocationSupply("for remote node", remote_compute_node, software_product, #software_product, release_variation, type_variation = self.addSoftwareProduct(
software_release, software_type) public_instance_type = remote_instance_type
self.tic() software_product, software_release, software_type = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
# join as the another visitor and request software instance on public self.addAllocationSupply("for remote node", remote_compute_node, software_product,
# compute_node software_release, software_type)
self.logout() self.tic()
public_reference = 'public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, public_reference)
self.login() # join as the another visitor and request software instance on public
public_person = self.portal.portal_catalog.getResultValue( # compute_node
portal_type="ERP5 Login", self.logout()
reference=public_reference).getParentValue() public_reference = 'public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, public_reference)
public_instance_title = 'Public title %s' % self.generateNewId() self.login()
self.checkRemoteInstanceAllocation(public_person.getUserId(), public_person = self.portal.portal_catalog.getResultValue(
public_reference, public_instance_title, portal_type="ERP5 Login",
public_server_software, public_instance_type, reference=public_reference).getParentValue()
remote_compute_node, project.getReference())
# XXX Do this for every scenario tests with PinnedDateTime(self, DateTime('2024/02/17 01:01')):
self.logout() public_instance_title = 'Public title %s' % self.generateNewId()
self.tic() self.checkRemoteInstanceAllocation(public_person.getUserId(),
# now instantiate it on compute_node and set some nice connection dict public_reference, public_instance_title,
self.simulateSlapgridCP(remote_server) public_server_software, public_instance_type,
self.tic() remote_compute_node, project.getReference())
self.login()
# owner_person should have one Instance Tree created by alarm # XXX Do this for every scenario tests
owner_instance_tree_list = self.portal.portal_catalog( self.logout()
portal_type='Instance Tree', self.tic()
destination_section__uid=owner_person.getUid() # now instantiate it on compute_node and set some nice connection dict
) self.simulateSlapgridCP(remote_server)
self.assertEqual(1, len(owner_instance_tree_list)) self.tic()
owner_software_instance = owner_instance_tree_list[0].getSuccessorValue() self.login()
self.assertEqual('Software Instance', owner_software_instance.getPortalType())
self.assertEqual(
remote_server.getRelativeUrl(),
owner_software_instance.getAggregateValue().getParentValue().getRelativeUrl()
)
# public_person should have one Instance Tree # owner_person should have one Instance Tree created by alarm
public_instance_tree_list = self.portal.portal_catalog( owner_instance_tree_list = self.portal.portal_catalog(
portal_type='Instance Tree', portal_type='Instance Tree',
destination_section__uid=public_person.getUid() destination_section__uid=owner_person.getUid()
) )
self.assertEqual(1, len(public_instance_tree_list)) self.assertEqual(1, len(owner_instance_tree_list))
owner_software_instance = owner_instance_tree_list[0].getSuccessorValue()
self.assertEqual('Software Instance', owner_software_instance.getPortalType())
self.assertEqual(
remote_server.getRelativeUrl(),
owner_software_instance.getAggregateValue().getParentValue().getRelativeUrl()
)
self.assertEqual( # public_person should have one Instance Tree
'_remote_%s_%s' % (project.getReference(), public_instance_tree_list = self.portal.portal_catalog(
public_instance_tree_list[0].getSuccessorReference()), portal_type='Instance Tree',
owner_software_instance.getTitle() destination_section__uid=public_person.getUid()
) )
connection_dict = owner_software_instance.getConnectionXmlAsDict() self.assertEqual(1, len(public_instance_tree_list))
self.assertSameSet(('url_1', 'url_2'), connection_dict.keys())
self.assertSameSet(
['http://%s/' % q.getIpAddress() for q in
owner_software_instance.getAggregateValue().contentValues(portal_type='Internet Protocol Address')],
connection_dict.values())
self.checkRemoteInstanceAllocation(public_person.getUserId(), self.assertEqual(
public_reference, public_instance_title, '_remote_%s_%s' % (project.getReference(),
public_server_software, public_instance_type, public_instance_tree_list[0].getSuccessorReference()),
remote_compute_node, project.getReference(), owner_software_instance.getTitle()
connection_dict_to_check=owner_software_instance.getConnectionXmlAsDict()) )
connection_dict = owner_software_instance.getConnectionXmlAsDict()
self.assertSameSet(('url_1', 'url_2'), connection_dict.keys())
self.assertSameSet(
['http://%s/' % q.getIpAddress() for q in
owner_software_instance.getAggregateValue().contentValues(portal_type='Internet Protocol Address')],
connection_dict.values())
self.checkRemoteInstanceAllocation(public_person.getUserId(),
public_reference, public_instance_title,
public_server_software, public_instance_type,
remote_compute_node, project.getReference(),
connection_dict_to_check=owner_software_instance.getConnectionXmlAsDict())
# Destroy the instance, and ensure the remote one is destroyed too # Destroy the instance, and ensure the remote one is destroyed too
self.checkRemoteInstanceUnallocation(public_person.getUserId(), self.checkRemoteInstanceUnallocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server_software, public_instance_type,
remote_compute_node, project.getReference()) remote_compute_node, project.getReference())
self.login() self.login()
# Report destruction from compute_node # Report destruction from compute_node
self.simulateSlapgridUR(remote_server) self.simulateSlapgridUR(remote_server)
self.assertEqual( self.assertEqual(
"", "",
owner_software_instance.getAggregate("") owner_software_instance.getAggregate("")
) )
# Ensure no unexpected object has been created # Ensure no unexpected object has been created
# 3 allocation supply/line/cell # 3 allocation supply/line/cell
...@@ -1532,241 +1545,243 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin): ...@@ -1532,241 +1545,243 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def test_virtual_master_slave_instance_on_remote_tree_without_accounting_scenario(self): def test_virtual_master_slave_instance_on_remote_tree_without_accounting_scenario(self):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False) with PinnedDateTime(self, DateTime('2024/02/17')):
currency, _, _, sale_person = self.bootstrapVirtualMasterTest(is_virtual_master_accountable=False)
self.web_site = self.portal.web_site_module.slapos_master_panel self.web_site = self.portal.web_site_module.slapos_master_panel
# some preparation # some preparation
self.logout() self.logout()
# lets join as slapos administrator, which will own few compute_nodes # lets join as slapos administrator, which will own few compute_nodes
remote_owner_reference = 'remote-owner-%s' % self.generateNewId() remote_owner_reference = 'remote-owner-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, remote_owner_reference) self.joinSlapOS(self.web_site, remote_owner_reference)
self.login() self.login()
remote_owner_person = self.portal.portal_catalog.getResultValue( remote_owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference=remote_owner_reference).getParentValue() reference=remote_owner_reference).getParentValue()
self.tic() self.tic()
self.logout() self.logout()
self.login(sale_person.getUserId()) self.login(sale_person.getUserId())
# create a default project # create a default project
remote_project_relative_url = self.addProject(person=remote_owner_person, currency=currency) remote_project_relative_url = self.addProject(person=remote_owner_person, currency=currency)
self.logout() self.logout()
self.login() self.login()
remote_project = self.portal.restrictedTraverse(remote_project_relative_url) remote_project = self.portal.restrictedTraverse(remote_project_relative_url)
preference = self.portal.portal_preferences.slapos_default_system_preference preference = self.portal.portal_preferences.slapos_default_system_preference
preference.edit( preference.edit(
preferred_subscription_assignment_category_list=[ preferred_subscription_assignment_category_list=[
'function/customer', 'function/customer',
'role/client', 'role/client',
'destination_project/%s' % remote_project.getRelativeUrl() 'destination_project/%s' % remote_project.getRelativeUrl()
] ]
) )
self.tic() self.tic()
# hooray, now it is time to create compute_nodes # hooray, now it is time to create compute_nodes
self.login(remote_owner_person.getUserId()) self.login(remote_owner_person.getUserId())
remote_server_title = 'Remote Server for %s' % remote_owner_person remote_server_title = 'Remote Server for %s' % remote_owner_person
remote_server_id = self.requestComputeNode(remote_server_title, remote_project.getReference()) remote_server_id = self.requestComputeNode(remote_server_title, remote_project.getReference())
remote_server = self.portal.portal_catalog.getResultValue( remote_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=remote_server_id) portal_type='Compute Node', reference=remote_server_id)
self.setAccessToMemcached(remote_server) self.setAccessToMemcached(remote_server)
self.assertNotEqual(None, remote_server) self.assertNotEqual(None, remote_server)
self.setServerOpenPublic(remote_server) self.setServerOpenPublic(remote_server)
remote_server.generateCertificate() remote_server.generateCertificate()
# and install some software on them # and install some software on them
remote_server_software = self.generateNewSoftwareReleaseUrl() remote_server_software = self.generateNewSoftwareReleaseUrl()
remote_instance_type = 'public type' remote_instance_type = 'public type'
self.supplySoftware(remote_server, remote_server_software) self.supplySoftware(remote_server, remote_server_software)
# format the compute_nodes # format the compute_nodes
self.formatComputeNode(remote_server) self.formatComputeNode(remote_server)
remote_software_product, remote_release_variation, remote_type_variation = self.addSoftwareProduct( remote_software_product, remote_release_variation, remote_type_variation = self.addSoftwareProduct(
"remote product", remote_project, remote_server_software, remote_instance_type "remote product", remote_project, remote_server_software, remote_instance_type
) )
self.addAllocationSupply("for compute node", remote_server, remote_software_product, self.addAllocationSupply("for compute node", remote_server, remote_software_product,
remote_release_variation, remote_type_variation, remote_release_variation, remote_type_variation,
destination_value=remote_owner_person) destination_value=remote_owner_person)
private_instance_title = 'Private title %s' % self.generateNewId()
self.checkInstanceAllocation(remote_owner_person.getUserId(),
remote_owner_reference, private_instance_title,
remote_server_software, remote_instance_type,
remote_server, remote_project.getReference())
# Convert the Software Instance into an Instance Node
# to explicitely mark it as accepting Slave Instance
private_software_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=private_instance_title)
instance_node_title = 'Shared Instance for %s' % remote_owner_reference
instance_node = self.addInstanceNode(instance_node_title, private_software_instance)
self.addAllocationSupply(
"for instance node", instance_node, remote_software_product,
remote_release_variation, remote_type_variation)
# join as the another visitor and request software instance on public
# compute_node
self.logout()
remote_public_reference = 'remote-public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, remote_public_reference)
self.login() with PinnedDateTime(self, DateTime('2024/02/17 00:05')):
remote_public_person = self.portal.portal_catalog.getResultValue( private_instance_title = 'Private title %s' % self.generateNewId()
portal_type="ERP5 Login", self.checkInstanceAllocation(remote_owner_person.getUserId(),
reference=remote_public_reference).getParentValue() remote_owner_reference, private_instance_title,
remote_server_software, remote_instance_type,
remote_server, remote_project.getReference())
#################################### # Convert the Software Instance into an Instance Node
# Create a local project # to explicitely mark it as accepting Slave Instance
#################################### private_software_instance = self.portal.portal_catalog.getResultValue(
self.logout() portal_type='Software Instance', title=private_instance_title)
self.login(sale_person.getUserId()) instance_node_title = 'Shared Instance for %s' % remote_owner_reference
# create a default project instance_node = self.addInstanceNode(instance_node_title, private_software_instance)
project_relative_url = self.addProject(person=remote_public_person, currency=currency)
self.logout() self.addAllocationSupply(
self.login() "for instance node", instance_node, remote_software_product,
project = self.portal.restrictedTraverse(project_relative_url) remote_release_variation, remote_type_variation)
preference.edit( # join as the another visitor and request software instance on public
preferred_subscription_assignment_category_list=[ # compute_node
'function/customer', self.logout()
'role/client', remote_public_reference = 'remote-public-%s' % self.generateNewId()
'destination_project/%s' % project.getRelativeUrl() self.joinSlapOS(self.web_site, remote_public_reference)
]
)
self.tic()
owner_person = remote_public_person self.login()
self.logout() remote_public_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login",
reference=remote_public_reference).getParentValue()
# hooray, now it is time to create compute_nodes ####################################
self.login(owner_person.getUserId()) # Create a local project
####################################
self.logout()
self.login(sale_person.getUserId())
# create a default project
project_relative_url = self.addProject(person=remote_public_person, currency=currency)
remote_compute_node = self.requestRemoteNode(project, remote_project, self.logout()
remote_public_person) self.login()
project = self.portal.restrictedTraverse(project_relative_url)
# and install some software on them preference.edit(
public_server_software = remote_server_software preferred_subscription_assignment_category_list=[
'function/customer',
'role/client',
'destination_project/%s' % project.getRelativeUrl()
]
)
self.tic()
#software_product, release_variation, type_variation = self.addSoftwareProduct( owner_person = remote_public_person
public_instance_type = remote_instance_type self.logout()
software_product, software_release, software_type = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
self.addAllocationSupply("for remote node", remote_compute_node, software_product, # hooray, now it is time to create compute_nodes
software_release, software_type) self.login(owner_person.getUserId())
self.tic()
# join as the another visitor and request software instance on public remote_compute_node = self.requestRemoteNode(project, remote_project,
# compute_node remote_public_person)
self.logout()
public_reference = 'public-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, public_reference)
self.login() # and install some software on them
public_person = self.portal.portal_catalog.getResultValue( public_server_software = remote_server_software
portal_type="ERP5 Login",
reference=public_reference).getParentValue()
public_instance_title = 'Public title %s' % self.generateNewId() #software_product, release_variation, type_variation = self.addSoftwareProduct(
self.checkRemoteInstanceAllocation(public_person.getUserId(), public_instance_type = remote_instance_type
public_reference, public_instance_title, software_product, software_release, software_type = self.addSoftwareProduct(
public_server_software, public_instance_type, "instance product", project, public_server_software, public_instance_type
remote_compute_node, project.getReference(), )
slave=True)
# XXX Do this for every scenario tests self.addAllocationSupply("for remote node", remote_compute_node, software_product,
self.logout() software_release, software_type)
self.tic() self.tic()
# now instantiate it on compute_node and set some nice connection dict
self.simulateSlapgridCP(remote_server)
self.tic()
self.login() # join as the another visitor and request software instance on public
# owner_person should have one Instance Tree created by alarm # compute_node
owner_instance_tree_list = self.portal.portal_catalog( self.logout()
portal_type='Instance Tree', public_reference = 'public-%s' % self.generateNewId()
destination_section__uid=owner_person.getUid() self.joinSlapOS(self.web_site, public_reference)
)
self.assertEqual(1, len(owner_instance_tree_list))
owner_software_instance = owner_instance_tree_list[0].getSuccessorValue()
self.assertEqual('Slave Instance', owner_software_instance.getPortalType())
self.assertEqual(
remote_server.getRelativeUrl(),
owner_software_instance.getAggregateValue().getParentValue().getRelativeUrl()
)
# public_person should have one Instance Tree self.login()
public_instance_tree_list = self.portal.portal_catalog( public_person = self.portal.portal_catalog.getResultValue(
portal_type='Instance Tree', portal_type="ERP5 Login",
destination_section__uid=public_person.getUid() reference=public_reference).getParentValue()
)
self.assertEqual(1, len(public_instance_tree_list))
self.assertEqual( public_instance_title = 'Public title %s' % self.generateNewId()
'_remote_%s_%s' % (project.getReference(), self.checkRemoteInstanceAllocation(public_person.getUserId(),
public_instance_tree_list[0].getSuccessorReference()), public_reference, public_instance_title,
owner_software_instance.getTitle() public_server_software, public_instance_type,
) remote_compute_node, project.getReference(),
connection_dict = owner_software_instance.getConnectionXmlAsDict() slave=True)
self.assertSameSet(('url_1', 'url_2'), connection_dict.keys())
self.assertSameSet(
['http://%s/%s' % (q.getIpAddress(), owner_software_instance.getReference()) for q in
owner_software_instance.getAggregateValue().contentValues(portal_type='Internet Protocol Address')],
connection_dict.values())
self.checkRemoteInstanceAllocation(public_person.getUserId(), # XXX Do this for every scenario tests
public_reference, public_instance_title, self.logout()
public_server_software, public_instance_type, self.tic()
remote_compute_node, project.getReference(), # now instantiate it on compute_node and set some nice connection dict
connection_dict_to_check=owner_software_instance.getConnectionXmlAsDict(), self.simulateSlapgridCP(remote_server)
slave=True) self.tic()
self.login() self.login()
# owner_person should have one Instance Tree created by alarm
owner_instance_tree_list = self.portal.portal_catalog(
portal_type='Instance Tree',
destination_section__uid=owner_person.getUid()
)
self.assertEqual(1, len(owner_instance_tree_list))
owner_software_instance = owner_instance_tree_list[0].getSuccessorValue()
self.assertEqual('Slave Instance', owner_software_instance.getPortalType())
self.assertEqual(
remote_server.getRelativeUrl(),
owner_software_instance.getAggregateValue().getParentValue().getRelativeUrl()
)
# Ensure no unexpected object has been created # public_person should have one Instance Tree
# 6 allocation supply/line/cell public_instance_tree_list = self.portal.portal_catalog(
# 3 compute/remote/instance node portal_type='Instance Tree',
# 1 credential request destination_section__uid=public_person.getUid()
# 2 instance tree )
# 9 open sale order / line self.assertEqual(1, len(public_instance_tree_list))
# 3 assignment
# 4 simulation movements
# 4 sale packing list / line
# 2 sale trade condition
# 1 software installation
# 2 software instance
# 1 software product
# 4 subscription requests
self.assertRelatedObjectCount(remote_project, 42)
# Ensure no unexpected object has been created self.assertEqual(
# 3 allocation supply/line/cell '_remote_%s_%s' % (project.getReference(),
# 1 compute node public_instance_tree_list[0].getSuccessorReference()),
# 1 credential request owner_software_instance.getTitle()
# 1 instance tree )
# 4 open sale order / line connection_dict = owner_software_instance.getConnectionXmlAsDict()
# 3 assignment self.assertSameSet(('url_1', 'url_2'), connection_dict.keys())
# 2 simulation movements self.assertSameSet(
# 2 sale packing list / line ['http://%s/%s' % (q.getIpAddress(), owner_software_instance.getReference()) for q in
# 2 sale trade condition owner_software_instance.getAggregateValue().contentValues(portal_type='Internet Protocol Address')],
# 1 software instance connection_dict.values())
# 1 software product
# 2 subscription requests self.checkRemoteInstanceAllocation(public_person.getUserId(),
self.assertRelatedObjectCount(project, 23) public_reference, public_instance_title,
public_server_software, public_instance_type,
remote_compute_node, project.getReference(),
connection_dict_to_check=owner_software_instance.getConnectionXmlAsDict(),
slave=True)
self.checkERP5StateBeforeExit() self.login()
# Ensure no unexpected object has been created
# 6 allocation supply/line/cell
# 3 compute/remote/instance node
# 1 credential request
# 2 instance tree
# 9 open sale order / line
# 3 assignment
# 4 simulation movements
# 4 sale packing list / line
# 2 sale trade condition
# 1 software installation
# 2 software instance
# 1 software product
# 4 subscription requests
self.assertRelatedObjectCount(remote_project, 42)
# Ensure no unexpected object has been created
# 3 allocation supply/line/cell
# 1 compute node
# 1 credential request
# 1 instance tree
# 4 open sale order / line
# 3 assignment
# 2 simulation movements
# 2 sale packing list / line
# 2 sale trade condition
# 1 software instance
# 1 software product
# 2 subscription requests
self.assertRelatedObjectCount(project, 23)
self.checkERP5StateBeforeExit()
""" """
def test_open_order_with_service_scenario(self): def test_open_order_with_service_scenario(self):
......
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