Merge "Use TransactionCollection when deleting tasks after cluster reset"
This commit is contained in:
commit
cbae64054e
|
@ -860,7 +860,7 @@ class ClearTaskHistory(TaskManager):
|
|||
TaskHelper.set_ready_if_not_finished(task)
|
||||
|
||||
# clear tasks history
|
||||
cluster_tasks = objects.TaskCollection.get_cluster_tasks(
|
||||
cluster_tasks = objects.TransactionCollection.get_transactions(
|
||||
self.cluster.id
|
||||
)
|
||||
cluster_tasks.delete(synchronize_session='fetch')
|
||||
|
|
|
@ -20,6 +20,7 @@ from oslo_serialization import jsonutils
|
|||
from nailgun.db.sqlalchemy.models import Notification
|
||||
|
||||
from nailgun import consts
|
||||
from nailgun import objects
|
||||
from nailgun.rpc.receiver import NailgunReceiver
|
||||
from nailgun.test.base import BaseIntegrationTest
|
||||
from nailgun.test.base import fake_tasks
|
||||
|
@ -44,6 +45,11 @@ class TestResetEnvironment(BaseIntegrationTest):
|
|||
"pending_addition": True}
|
||||
]
|
||||
)
|
||||
cluster_tasks = objects.TransactionCollection.get_transactions(
|
||||
cluster_db.id
|
||||
)
|
||||
self.assertEqual(cluster_tasks.count(), 0L)
|
||||
|
||||
supertask = self.env.launch_deployment()
|
||||
self.assertEqual(supertask.status, consts.TASK_STATUSES.ready)
|
||||
|
||||
|
@ -51,11 +57,24 @@ class TestResetEnvironment(BaseIntegrationTest):
|
|||
self.assertEqual(n.status, "ready")
|
||||
self.assertEqual(n.pending_addition, False)
|
||||
|
||||
cluster_tasks = objects.TransactionCollection.get_transactions(
|
||||
cluster_db.id
|
||||
)
|
||||
tasks_before_reset = list(set([task.name for task in cluster_tasks]))
|
||||
self.assertEqual(sorted(tasks_before_reset),
|
||||
['deploy', 'deployment', 'provision'])
|
||||
|
||||
reset_task = self.env.reset_environment()
|
||||
self.assertEqual(reset_task.status, consts.TASK_STATUSES.ready)
|
||||
|
||||
self.assertEqual(cluster_db.status, "new")
|
||||
|
||||
cluster_tasks = objects.TransactionCollection.get_transactions(
|
||||
cluster_db.id
|
||||
)
|
||||
tasks_after_reset = list(set([task.name for task in cluster_tasks]))
|
||||
self.assertEqual(tasks_after_reset, ['reset_environment'])
|
||||
|
||||
# FIXME(aroma): remove when stop action will be reworked for ha
|
||||
# cluster. To get more details, please, refer to [1]
|
||||
# [1]: https://bugs.launchpad.net/fuel/+bug/1529691
|
||||
|
|
Loading…
Reference in New Issue