Makes two tests wait for the instance to go ACTIVE

In environments with limited resources, these two
tests can fail intermittently because of some timing
related to resizing. Waiting for the instance to
return to active resolves the resulting 422s.

Change-Id: Ib82f7dcd43f1f7fbba5c5ade44785243d9d1186d
This commit is contained in:
Ed Cranford 2013-07-17 10:28:41 -05:00
parent 1815d5d566
commit 9678ecef3b

@ -424,6 +424,14 @@ class ResizeInstanceTest(ActionTestBase):
flavor_name = CONFIG.values.get('instance_bigger_eph_flavor_name',
'eph.rd-smaller')
flavors = self.dbaas.find_flavors_by_name(flavor_name)
def is_active():
return self.instance.status == 'ACTIVE'
poll_until(is_active, time_out=TIME_OUT_TIME)
assert_equal(self.instance.status, 'ACTIVE')
old_flavor_href = self.get_flavor_href(
flavor_id=self.expected_old_flavor_id)
assert_raises(HTTPNotImplemented, self.dbaas.instances.resize_instance,
self.instance_id, flavors[0].id)
@ -531,9 +539,16 @@ class ResizeInstanceTest(ActionTestBase):
@time_out(TIME_OUT_TIME)
def test_resize_down(self):
expected_dbaas_flavor = self.expected_dbaas_flavor
self.dbaas.instances.resize_instance(
self.instance_id,
self.get_flavor_href(flavor_id=self.expected_old_flavor_id))
def is_active():
return self.instance.status == 'ACTIVE'
poll_until(is_active, time_out=TIME_OUT_TIME)
assert_equal(self.instance.status, 'ACTIVE')
old_flavor_href = self.get_flavor_href(
flavor_id=self.expected_old_flavor_id)
self.dbaas.instances.resize_instance(self.instance_id, old_flavor_href)
assert_equal(202, self.dbaas.last_http_code)
self.old_dbaas_flavor = instance_info.dbaas_flavor
instance_info.dbaas_flavor = expected_dbaas_flavor