Commit 91d4b423 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Fix broken tests

Fix tests that were broken by commit #7ef05bd.
parent 8ea93aef
......@@ -126,7 +126,9 @@ class BackendReconciler(object):
if job_id in self.gnt_jobs:
job = self.gnt_jobs[job_id]
gnt_job_status = job["status"]
end_timestamp = merge_time(job["end_ts"])
end_timestamp = job["end_ts"]
if end_timestamp is not None:
end_timestamp = merge_time(end_timestamp)
if gnt_job_status == rapi.JOB_STATUS_ERROR:
return "ERROR", end_timestamp
elif gnt_job_status not in rapi.JOB_STATUS_FINALIZED:
......
......@@ -59,14 +59,16 @@ class ServerReconciliationTest(TestCase):
backendjobid=1,
operstate="BUILD")
for status in ["queued", "waiting", "running"]:
mrapi().GetJobs.return_value = [{"id": "1", "status": status}]
mrapi().GetJobs.return_value = [{"id": "1", "status": status,
"end_ts": None}]
with mocked_quotaholder():
self.reconciler.reconcile()
vm1 = VirtualMachine.objects.get(id=vm1.id)
self.assertFalse(vm1.deleted)
self.assertEqual(vm1.operstate, "BUILD")
mrapi().GetJobs.return_value = [{"id": "1", "status": "error"}]
mrapi().GetJobs.return_value = [{"id": "1", "status": "error",
"end_ts": [44123, 1]}]
with mocked_quotaholder():
self.reconciler.reconcile()
vm1 = VirtualMachine.objects.get(id=vm1.id)
......@@ -77,7 +79,8 @@ class ServerReconciliationTest(TestCase):
vm1.operstate = "BUILD"
vm1.deleted = False
vm1.save()
mrapi().GetJobs.return_value = [{"id": "1", "status": status}]
mrapi().GetJobs.return_value = [{"id": "1", "status": status,
"end_ts": [44123, 1]}]
with mocked_quotaholder():
self.reconciler.reconcile()
vm1 = VirtualMachine.objects.get(id=vm1.id)
......
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