Scan for output errors in functional tests
In _stack_output() look for unexpected "output_error" messages.
Fix a missing output in the template resource tests.
Change-Id: I71d5d7e5800d7503d9e6015f637fe7fef5d867fe
diff --git a/common/test.py b/common/test.py
index acfe1ad..584af6d 100644
--- a/common/test.py
+++ b/common/test.py
@@ -175,10 +175,18 @@
return net
@staticmethod
- def _stack_output(stack, output_key):
+ def _stack_output(stack, output_key, validate_errors=True):
"""Return a stack output value for a given key."""
- return next((o['output_value'] for o in stack.outputs
- if o['output_key'] == output_key), None)
+ value = None
+ for o in stack.outputs:
+ if validate_errors and 'output_error' in o:
+ # scan for errors in the stack output.
+ raise ValueError(
+ 'Unexpected output errors in %s : %s' % (
+ output_key, o['output_error']))
+ if o['output_key'] == output_key:
+ value = o['output_value']
+ return value
def _ping_ip_address(self, ip_address, should_succeed=True):
cmd = ['ping', '-c1', '-w1', ip_address]