Fix SQLAlchemy use for version 1.4
The change to SQLAlchemy upper constraints has broken some of the tests in Heat. Syntax and usage needs to be updated accordingly to ensure tests work with the 1.4 version of SQLAlchemy. Reference: https://storyboard.openstack.org/#!/story/2008974 Story: 2008974 Task: 42616 Change-Id: Id4755c8c58401ebfd42a8c57f94d111de9f74ac1
This commit is contained in:
parent
25db658788
commit
f341395a46
@ -1139,7 +1139,7 @@ def _delete_event_rows(context, stack_id, limit):
|
||||
(ids, rsrc_prop_ids) = zip(*id_pairs)
|
||||
max_id = ids[-1]
|
||||
# delete the events
|
||||
retval = session.query(models.Event.id).filter(
|
||||
retval = session.query(models.Event).filter(
|
||||
models.Event.id <= max_id).filter(
|
||||
models.Event.stack_id == stack_id).delete()
|
||||
|
||||
|
@ -41,7 +41,7 @@ class StackCreateTest(common.HeatTestCase):
|
||||
super(StackCreateTest, self).setUp()
|
||||
self.ctx = utils.dummy_context()
|
||||
self.man = service.EngineService('a-host', 'a-topic')
|
||||
self.man.thread_group_mgr = service.ThreadGroupManager()
|
||||
self.man.thread_group_mgr = tools.DummyThreadGroupManager()
|
||||
cfg.CONF.set_override('convergence_engine', False)
|
||||
|
||||
@mock.patch.object(threadgroup, 'ThreadGroup')
|
||||
@ -305,7 +305,6 @@ class StackCreateTest(common.HeatTestCase):
|
||||
self.assertEqual(stk.identifier(), result)
|
||||
root_stack_id = stk.root_stack_id()
|
||||
self.assertEqual(3, stk.total_resources(root_stack_id))
|
||||
self.man.thread_group_mgr.groups[stk.id].wait()
|
||||
stk.delete()
|
||||
|
||||
def test_stack_create_total_resources_exceeds_max(self):
|
||||
|
@ -33,7 +33,7 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
self.ctx = utils.dummy_context()
|
||||
|
||||
self.engine = service.EngineService('a-host', 'a-topic')
|
||||
self.engine.thread_group_mgr = service.ThreadGroupManager()
|
||||
self.engine.thread_group_mgr = tools.DummyThreadGroupManager()
|
||||
|
||||
def _create_stack(self, stack_name, files=None):
|
||||
t = template_format.parse(tools.wp_template)
|
||||
@ -58,7 +58,6 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
stk1._persist_state()
|
||||
snapshot1 = self.engine.stack_snapshot(
|
||||
self.ctx, stk1.identifier(), 'snap1')
|
||||
self.engine.thread_group_mgr.groups[stk1.id].wait()
|
||||
snapshot_id = snapshot1['id']
|
||||
|
||||
stk2 = self._create_stack('stack_snaphot_not_belong_to_stack_2')
|
||||
@ -85,7 +84,6 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
self.assertIsNotNone(snapshot['creation_time'])
|
||||
self.assertEqual('snap1', snapshot['name'])
|
||||
self.assertEqual("IN_PROGRESS", snapshot['status'])
|
||||
self.engine.thread_group_mgr.groups[stk.id].wait()
|
||||
snapshot = self.engine.show_snapshot(
|
||||
self.ctx, stk.identifier(), snapshot['id'])
|
||||
self.assertEqual("COMPLETE", snapshot['status'])
|
||||
@ -134,7 +132,6 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
|
||||
snapshot1 = self.engine.stack_snapshot(
|
||||
self.ctx, stk1.identifier(), 'snap1')
|
||||
self.engine.thread_group_mgr.groups[stk1.id].wait()
|
||||
snapshot_id = snapshot1['id']
|
||||
|
||||
mock_load.assert_called_once_with(self.ctx, stack=mock.ANY)
|
||||
@ -181,10 +178,8 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
|
||||
snapshot = self.engine.stack_snapshot(
|
||||
self.ctx, stk.identifier(), 'snap1')
|
||||
self.engine.thread_group_mgr.groups[stk.id].wait()
|
||||
snapshot_id = snapshot['id']
|
||||
self.engine.delete_snapshot(self.ctx, stk.identifier(), snapshot_id)
|
||||
self.engine.thread_group_mgr.groups[stk.id].wait()
|
||||
|
||||
ex = self.assertRaises(dispatcher.ExpectedException,
|
||||
self.engine.show_snapshot, self.ctx,
|
||||
@ -202,7 +197,6 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
self.ctx, stk.identifier(), 'snap1')
|
||||
self.assertIsNotNone(snapshot['id'])
|
||||
self.assertEqual("IN_PROGRESS", snapshot['status'])
|
||||
self.engine.thread_group_mgr.groups[stk.id].wait()
|
||||
|
||||
snapshots = self.engine.stack_list_snapshots(
|
||||
self.ctx, stk.identifier())
|
||||
@ -224,10 +218,8 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
|
||||
snapshot = self.engine.stack_snapshot(
|
||||
self.ctx, stk.identifier(), 'snap1')
|
||||
self.engine.thread_group_mgr.groups[stk.id].wait()
|
||||
snapshot_id = snapshot['id']
|
||||
self.engine.stack_restore(self.ctx, stk.identifier(), snapshot_id)
|
||||
self.engine.thread_group_mgr.groups[stk.id].wait()
|
||||
self.assertEqual((stk.RESTORE, stk.COMPLETE), stk.state)
|
||||
self.assertEqual(2, mock_load.call_count)
|
||||
|
||||
@ -238,7 +230,6 @@ class SnapshotServiceTest(common.HeatTestCase):
|
||||
|
||||
snapshot1 = self.engine.stack_snapshot(
|
||||
self.ctx, stk1.identifier(), 'snap1')
|
||||
self.engine.thread_group_mgr.groups[stk1.id].wait()
|
||||
snapshot_id = snapshot1['id']
|
||||
|
||||
mock_load.assert_called_once_with(self.ctx, stack=mock.ANY)
|
||||
|
Loading…
x
Reference in New Issue
Block a user