TestFixture mocks were updated

Core library was updated as part of the multi-region support
effort. FormatVersion of the core library was incremented and,
as a result $dict.key expressions started to work as they are in
yaql 1.0 rather than in 0.2 and the presence of the key become
mandatory. However Network mock in the TextFixture used to
return empty dictionary and it caused Instance class to fail.
The commit adds missing keys to the dictionary returned by
the joinInstance() method.

Also the test runner was improved to print the stack trace
upon failures so that it is possible to identify where the
error happened.

Change-Id: Ia7b0f61370effe4f13fed4ec85e806f3b0fdb80b
This commit is contained in:
Stan Lagun 2016-08-29 09:58:40 -07:00
parent 1f3b1be24e
commit 2f2132350d
2 changed files with 23 additions and 7 deletions

View File

@ -43,11 +43,14 @@ Methods:
Contract:
- $.class(std:SharedIp)
Body:
- Return: {}
- Return:
template: {}
portRef:
instanceFipOutput:
generateSecurityGroupManager:
Body:
- Return: new(sys:DummySecurityGroupManager)
- Return: new(sys:DummySecurityGroupManager, $this)
describe:
Body:

View File

@ -31,6 +31,7 @@ from murano import version
from murano.common.i18n import _, _LE
from murano.common import config
from murano.common import engine
from murano.dsl import dsl_exception
from murano.dsl import dsl_types
from murano.dsl import exceptions
from murano.dsl import executor
@ -277,11 +278,20 @@ class MuranoTestRunner(object):
sys.stdout.flush()
except Exception as e:
error_count += 1
msg = '{0}{1}: {2}{3}\n'.format(FAIL_COLOR,
'FAIL!',
e,
END_COLOR)
msg = ''.join((
FAIL_COLOR, 'FAIL!', END_COLOR, '\n'))
sys.stdout.write(msg)
if isinstance(e, dsl_exception.MuranoPlException):
tb = e.format()
else:
tb = traceback.format_exc()
sys.stdout.write(''.join((
FAIL_COLOR,
tb,
END_COLOR,
'\n'
)))
sys.stdout.flush()
LOG.exception('Test {0} failed'.format(test_name))
@ -364,7 +374,10 @@ def main():
exit_code = test_runner.run_tests()
sys.exit(exit_code)
except Exception as e:
tb = traceback.format_exc()
if isinstance(e, dsl_exception.MuranoPlException):
tb = e.format()
else:
tb = traceback.format_exc()
err_msg = _LE("Command failed: {0}\n{1}").format(e, tb)
LOG.error(err_msg)
sys.exit(err_msg)