Commit e172af11 authored by Romain Courteaud's avatar Romain Courteaud 🐙

slapos_json_rpc_api: drop requested_instance_list api

parent 56fa38cd
...@@ -121,14 +121,6 @@ ...@@ -121,14 +121,6 @@
"const": "Software Instance",\n "const": "Software Instance",\n
"type": "string"\n "type": "string"\n
},\n },\n
"requested_instance_list": {\n
"title": "Requested Instance List",\n
"type": "array",\n
"description": "List of the instances references requested by this instance. This is used to garbage collect instances that are no longer requested by this instance.",\n
"items": {\n
"type": "string"\n
}\n
},\n
"title": {\n "title": {\n
"title": "New Title",\n "title": "New Title",\n
"type": "string",\n "type": "string",\n
......
...@@ -42,9 +42,6 @@ if "reported_state" in data_dict: ...@@ -42,9 +42,6 @@ if "reported_state" in data_dict:
else: else:
raise WrongReportedStateError("Unexcepected Reported State: %s" % reported_state) raise WrongReportedStateError("Unexcepected Reported State: %s" % reported_state)
if "requested_instance_list" in data_dict:
software_instance.updateRequestedInstanceList(data_dict["requested_instance_list"])
if "title" in data_dict and data_dict["title"] != software_instance.getTitle(): if "title" in data_dict and data_dict["title"] != software_instance.getTitle():
software_instance.rename( software_instance.rename(
new_name=data_dict["title"], new_name=data_dict["title"],
......
...@@ -1296,108 +1296,6 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin): ...@@ -1296,108 +1296,6 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin):
finally: finally:
instance.__class__.requestInstance = requestInstance instance.__class__.requestInstance = requestInstance
def test_InstanceAccess_23_updateInstanceSuccessorList(self):
self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId())
# Atach two software instances
instance_kw = dict(
software_release='http://a.release',
software_type='type',
instance_xml=self.generateSafeXml(),
sla_xml=self.generateSafeXml(),
shared=False,
software_title='Instance0',
state='started'
)
self.start_requested_software_instance.requestInstance(**instance_kw)
instance_kw['software_title'] = 'Instance1'
self.start_requested_software_instance.requestInstance(**instance_kw)
self.tic()
self.assertEqual(len(self.start_requested_software_instance.getSuccessorList()), 2)
self.assertSameSet(['Instance0', 'Instance1'],
self.start_requested_software_instance.getSuccessorTitleList())
# Update with no changes
self.callInstancePutToApiAndCheck({
"portal_type": "Software Instance",
"reference": self.start_requested_software_instance.getReference(),
"requested_instance_list": ["Instance0", "Instance1"],
})
self.tic()
self.assertSameSet(['Instance0', 'Instance1'],
self.start_requested_software_instance.getSuccessorTitleList())
# Update Instance0 was not requested
self.callInstancePutToApiAndCheck({
"portal_type": "Software Instance",
"reference": self.start_requested_software_instance.getReference(),
"requested_instance_list": ["Instance1"],
})
self.tic()
self.assertSameSet(['Instance1'],
self.start_requested_software_instance.getSuccessorTitleList())
def test_InstanceAccess_24_updateInstanceSuccessorList_one_child(self):
self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId())
# Atach one software instance
instance_kw = dict(
software_release='http://a.release',
software_type='type',
instance_xml=self.generateSafeXml(),
sla_xml=self.generateSafeXml(),
shared=False,
software_title='Instance0',
state='started'
)
self.start_requested_software_instance.requestInstance(**instance_kw)
self.tic()
self.assertEqual(len(self.start_requested_software_instance.getSuccessorList()), 1)
self.assertSameSet(['Instance0'],
self.start_requested_software_instance.getSuccessorTitleList())
self.callInstancePutToApiAndCheck({
"portal_type": "Software Instance",
"reference": self.start_requested_software_instance.getReference(),
"requested_instance_list": [],
})
self.tic()
self.assertEqual([],
self.start_requested_software_instance.getSuccessorTitleList())
def test_InstanceAccess_25_updateInstanceSuccessorList_no_child(self):
self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId())
self.assertEqual([],
self.start_requested_software_instance.getSuccessorTitleList())
self.callInstancePutToApiAndCheck({
"portal_type": "Software Instance",
"reference": self.start_requested_software_instance.getReference(),
"requested_instance_list": [],
})
self.tic()
self.assertEqual([],
self.start_requested_software_instance.getSuccessorTitleList())
# Try with something that doesn't exist
self.callInstancePutToApiAndCheck({
"portal_type": "Software Instance",
"reference": self.start_requested_software_instance.getReference(),
"requested_instance_list": ["instance0"],
})
self.tic()
self.assertEqual([],
self.start_requested_software_instance.getSuccessorTitleList())
def test_InstanceAccess_26_stoppedComputePartition(self): def test_InstanceAccess_26_stoppedComputePartition(self):
with PinnedDateTime(self, DateTime('2020/05/19')): with PinnedDateTime(self, DateTime('2020/05/19')):
# XXX Should reported_state added to Instance returned json? # XXX Should reported_state added to Instance returned json?
......
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