Commit 22545fe1 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: method to request and allocate slave instance from an instance tree

parent 74a6cab5
...@@ -417,6 +417,66 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin): ...@@ -417,6 +417,66 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
portal_type='Internet Protocol Address')], portal_type='Internet Protocol Address')],
connection_dict.values()) connection_dict.values())
def checkInstanceTreeSlaveInstanceAllocation(
self,
person_user_id,
person_reference,
instance_tree_title, instance_title, software_release, software_type,
server,
project_reference
):
self.login(person_user_id)
# let's find instance of user
instance_tree_list = [q.getObject() for q in
self._getCurrentInstanceTreeList()
if q.getTitle() == instance_tree_title]
self.assertEqual(1, len(instance_tree_list))
instance_tree = instance_tree_list[0]
software_instance = instance_tree.getSuccessorValue()
self.login()
instance_user_id = software_instance.getUserId()
compute_partition = software_instance.getAggregateValue()
computer_id = compute_partition.getParentValue().getReference()
computer_partition_id = compute_partition.getTitle()
self.login(instance_user_id)
response = self.portal.portal_slap.requestComputerPartition(
computer_id=computer_id,
computer_partition_id=computer_partition_id,
software_release=software_release,
software_type=software_type,
partition_reference=instance_title,
shared_xml='<marshal><bool>2</bool></marshal>',
project_reference=project_reference
)
status = getattr(response, 'status', None)
self.assertEqual(408, status)
self.tic()
self.stepCallSlaposAllocateInstanceAlarm()
self.tic()
# now instantiate it on compute_node and set some nice connection dict
self.simulateSlapgridCP(server)
# let's find instances of user and check connection strings
slave_instance = software_instance.getSuccessorValue()
connection_dict = slave_instance.getConnectionXmlAsDict()
self.assertSameSet(('url_1', 'url_2'), connection_dict.keys())
self.login()
partition = slave_instance.getAggregateValue()
self.assertSameSet(
['http://%s/%s' % (q.getIpAddress(), slave_instance.getReference())
for q in partition.contentValues(
portal_type='Internet Protocol Address')],
connection_dict.values())
def checkSlaveInstanceUnallocation(self, person_user_id, def checkSlaveInstanceUnallocation(self, person_user_id,
person_reference, instance_title, person_reference, instance_title,
software_release, software_type, server, software_release, software_type, server,
......
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