From: chenjiankun Date: Tue, 20 Mar 2018 08:11:39 +0000 (+0000) Subject: Running Test Case in Latest Yardstick Docker Image shows Error X-Git-Tag: opnfv-6.0.0~51^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F71%2F54171%2F1;p=yardstick.git Running Test Case in Latest Yardstick Docker Image shows Error JIRA: YARDSTICK-1080 This bug will only occur in kubernetes test case. In openstack, we use 'stack_name.context', but some kubernetes resources(pod, etc) do not support this format. So we use 'name-context'. Change-Id: I87d61c027d55449914bc283672eb98be3d3fe22f Signed-off-by: chenjiankun --- diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py index e7acde696..88497c811 100644 --- a/yardstick/benchmark/core/task.py +++ b/yardstick/benchmark/core/task.py @@ -613,15 +613,25 @@ class TaskParser(object): # pragma: no cover vnf__0: vnf_0.yardstick """ def qualified_name(name): - node_name, context_name = name.split('.') + try: + # for openstack + node_name, context_name = name.split('.') + sep = '.' + except ValueError: + # for kubernetes, some kubernetes resources don't support + # name format like 'xxx.xxx', so we use '-' instead + # need unified later + node_name, context_name = name.split('-') + sep = '-' + try: ctx = next((context for context in contexts - if context.assigned_name == context_name)) + if context.assigned_name == context_name)) except StopIteration: raise y_exc.ScenarioConfigContextNameNotFound( context_name=context_name) - return '{}.{}'.format(node_name, ctx.name) + return '{}{}{}'.format(node_name, sep, ctx.name) if 'host' in scenario: scenario['host'] = qualified_name(scenario['host'])