Commit abf7e090 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Verbose if why instance isn't allocated or with error

parent fc99981d
......@@ -8,13 +8,19 @@ software_instance_list = portal.portal_catalog(
# Check if at least one software Instance is Allocated
for instance in software_instance_list:
# All partitions should be allocated
computer_partition = instance.getAggregateValue()
if computer_partition is None:
if instance.getAggregate() is None:
if verbose:
return "%s isn't allocated" % instance.getRelativeUrl()
return False
if instance.getPortalType() == "Software Instance":
if instance.getSlapState() == "start_requested" and \
instance.SoftwareInstance_hasReportedError():
if verbose:
return "Instance %s has reported errors: %s" % (
instance.getRelativeUrl(),
instance.SoftwareInstance_hasReportedError(
include_message=True))
return False
return True
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>verbose=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -265,6 +265,11 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
payment = subscription_request.SubscriptionRequest_verifyPaymentBalanceIsReady()
self.assertNotEqual(payment, None)
self.assertEqual(payment.getSimulationState(), 'started')
# Assert instance is allocated and without error
self.assertEqual(True,
subscription_request.SubscriptionRequest_verifyInstanceIsAllocated(verbose=True))
self.assertEqual(subscription_request.getSimulationState(), "confirmed",
"%s != confirmed (%s)" % (subscription_request.getSimulationState(),
subscription_request.SubscriptionRequest_processOrdered()))
......
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