More unit test fixes

pull/460/head
Piero Toffanin 2018-05-31 23:14:11 -04:00
rodzic 8306fd7539
commit b8665ad181
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -301,7 +301,6 @@ class Task(models.Model):
self.processing_node.save()
logger.info("Automatically assigned processing node {} to {}".format(self.processing_node, self))
self.status = None
self.save()
# Processing node assigned, but is offline and no errors
@ -313,7 +312,9 @@ class Task(models.Model):
logger.info("Processing node {} went offline, reassigning {}...".format(self.processing_node, self))
self.uuid = ''
self.processing_node = None
self.status = None
self.save()
elif self.status == status_codes.RUNNING:
# Task was running and processing node went offline
# It could have crashed due to low memory

Wyświetl plik

@ -580,14 +580,15 @@ class TestApiTask(BootTransactionTestCase):
# Processing node is now cleared and a new one will be assigned on the next tick
task.refresh_from_db()
self.assertTrue(task.processing_node is None)
self.assertTrue(task.status is None)
worker.tasks.process_pending_tasks()
task.refresh_from_db()
self.assertTrue(task.processing_node.id == another_pnode.id)
self.assertTrue(task.status == None)
# Set task to queued, bring node offline
task.last_error = None
task.status = status_codes.RUNNING
task.save()
another_pnode.last_refreshed = timezone.now() - timedelta(minutes=OFFLINE_MINUTES)