Wait for the policy to be done in tests

As observed in the amqp job, we sometimes signal scale policy too fast,
without waiting for the medata to be set. It creates a timeout. We can
check the metadata of the policy before signaling again, to make sure
that we can move forward.

Change-Id: I9857803ef960efbd034f05985ec8fcc7272e2f70
diff --git a/functional/test_heat_autoscaling.py b/functional/test_heat_autoscaling.py
index 096c427..608fd1d 100644
--- a/functional/test_heat_autoscaling.py
+++ b/functional/test_heat_autoscaling.py
@@ -119,7 +119,8 @@
                                      self.conf.build_interval,
                                      self.check_autoscale_complete,
                                      asg.physical_resource_id,
-                                     expected_resources))
+                                     expected_resources, stack_id,
+                                     'scale_up_policy'))
 
     def test_asg_scale_down_min_size(self):
         stack_id = self.stack_create(template=self.template,
@@ -140,7 +141,8 @@
                                      self.conf.build_interval,
                                      self.check_autoscale_complete,
                                      asg.physical_resource_id,
-                                     expected_resources))
+                                     expected_resources, stack_id,
+                                     'scale_down_policy'))
 
     def test_asg_cooldown(self):
         cooldown_tmpl = self.template.replace('cooldown: 0',
@@ -162,7 +164,8 @@
                                  self.conf.build_interval,
                                  self.check_autoscale_complete,
                                  asg.physical_resource_id,
-                                 expected_resources))
+                                 expected_resources, stack_id,
+                                 'scale_up_policy'))
 
     def test_path_attrs(self):
         stack_id = self.stack_create(template=self.template)