Fix calls to call_until_true

Some tests use call_until_true, but don't check the returned value. If
False, the check isn't actually correct.

Change-Id: I6625a2e57d1d1c1ac03647786c210a9b57490562
This commit is contained in:
Thomas Herve 2017-04-10 17:00:57 +02:00
parent e7999a9c5d
commit ffc1412ed5
2 changed files with 22 additions and 14 deletions

View File

@ -114,10 +114,12 @@ outputs:
for num in range(asg_size+1, max_size+2): for num in range(asg_size+1, max_size+2):
expected_resources = num if num <= max_size else max_size expected_resources = num if num <= max_size else max_size
self.client.resources.signal(stack_id, 'scale_up_policy') self.client.resources.signal(stack_id, 'scale_up_policy')
self.assertTrue(
test.call_until_true(self.conf.build_timeout, test.call_until_true(self.conf.build_timeout,
self.conf.build_interval, self.conf.build_interval,
self.check_autoscale_complete, self.check_autoscale_complete,
asg.physical_resource_id, expected_resources) asg.physical_resource_id,
expected_resources))
def test_asg_scale_down_min_size(self): def test_asg_scale_down_min_size(self):
stack_id = self.stack_create(template=self.template, stack_id = self.stack_create(template=self.template,
@ -133,10 +135,12 @@ outputs:
for num in range(asg_size-1, 0, -1): for num in range(asg_size-1, 0, -1):
expected_resources = num if num >= min_size else min_size expected_resources = num if num >= min_size else min_size
self.client.resources.signal(stack_id, 'scale_down_policy') self.client.resources.signal(stack_id, 'scale_down_policy')
self.assertTrue(
test.call_until_true(self.conf.build_timeout, test.call_until_true(self.conf.build_timeout,
self.conf.build_interval, self.conf.build_interval,
self.check_autoscale_complete, self.check_autoscale_complete,
asg.physical_resource_id, expected_resources) asg.physical_resource_id,
expected_resources))
def test_asg_cooldown(self): def test_asg_cooldown(self):
cooldown_tmpl = self.template.replace('cooldown: 0', cooldown_tmpl = self.template.replace('cooldown: 0',
@ -153,10 +157,12 @@ outputs:
asg = self.client.resources.get(stack_id, 'random_group') asg = self.client.resources.get(stack_id, 'random_group')
expected_resources = 3 expected_resources = 3
self.client.resources.signal(stack_id, 'scale_up_policy') self.client.resources.signal(stack_id, 'scale_up_policy')
self.assertTrue(
test.call_until_true(self.conf.build_timeout, test.call_until_true(self.conf.build_timeout,
self.conf.build_interval, self.conf.build_interval,
self.check_autoscale_complete, self.check_autoscale_complete,
asg.physical_resource_id, expected_resources) asg.physical_resource_id,
expected_resources))
def test_path_attrs(self): def test_path_attrs(self):
stack_id = self.stack_create(template=self.template) stack_id = self.stack_create(template=self.template)

View File

@ -180,12 +180,14 @@ outputs:
auto_declare=False): auto_declare=False):
requests.post(scale_up_url, verify=self.verify_cert) requests.post(scale_up_url, verify=self.verify_cert)
test.call_until_true(20, 0, self.consume_events, handler, 2) self.assertTrue(
test.call_until_true(20, 0, self.consume_events, handler, 2))
notifications += handler.notifications notifications += handler.notifications
handler.clear() handler.clear()
requests.post(scale_down_url, verify=self.verify_cert) requests.post(scale_down_url, verify=self.verify_cert)
test.call_until_true(20, 0, self.consume_events, handler, 2) self.assertTrue(
test.call_until_true(20, 0, self.consume_events, handler, 2))
notifications += handler.notifications notifications += handler.notifications
self.assertEqual(2, notifications.count(ASG_NOTIFICATIONS[0])) self.assertEqual(2, notifications.count(ASG_NOTIFICATIONS[0]))