Commit cd9c93f8 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

slapgrid: get Partition before processing it in report

parent 8e9be604
......@@ -2019,6 +2019,12 @@ stderr_logfile_backups=1
# Try to process it anyway, it may need to be deleted.
software_path = None
if not self.api_backward_compatibility:
computer_partition = self.slap.jio_api_connector.get({
"portal_type": "Software Instance",
"reference": computer_partition["reference"]
})
local_partition = Partition(
software_path=software_path,
instance_path=os.path.join(self.instance_root,
......
......@@ -2150,10 +2150,11 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertEqual(computer.sequence,
['/api/allDocs/',
'/api/get/',
'/api/put/',
'/api/put/'])
self.assertEqual(instance.sequence[0][1]["reported_state"], 'stopped')
self.assertEqual(instance.sequence[1][1]["reported_state"], 'destroyed')
self.assertEqual(instance.sequence[1][1]["reported_state"], 'stopped')
self.assertEqual(instance.sequence[2][1]["reported_state"], 'destroyed')
self.assertEqual(instance.state, 'destroyed')
def test_partition_list_is_complete_if_empty_destroyed_partition(self):
......@@ -2184,10 +2185,11 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertEqual(computer.sequence,
['/api/allDocs/',
'/api/get/',
'/api/put/',
'/api/put/'])
self.assertEqual(instance.sequence[0][1]["reported_state"], 'stopped')
self.assertEqual(instance.sequence[1][1]["reported_state"], 'destroyed')
self.assertEqual(instance.sequence[1][1]["reported_state"], 'stopped')
self.assertEqual(instance.sequence[2][1]["reported_state"], 'destroyed')
self.assertEqual(instance.state, 'destroyed')
def test_slapgrid_not_destroy_bad_instance(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