aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-06-29 12:07:27 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-29 12:07:27 +0000
commit9ba594fa3f34d551d34abd7582281ce081924c67 (patch)
tree43e32e6d2a5ca9c09b47ef698f24abe784d8f6cc /yardstick
parent8996240be14d6f7979a6ae02dd474b03d50e79d9 (diff)
parentda62008a0a98cb8793ea42827a7da5e149edd144 (diff)
Merge "Call core code directly in the API of run test case"
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/benchmark/core/runner.py2
-rw-r--r--yardstick/benchmark/core/scenario.py2
-rw-r--r--yardstick/benchmark/core/task.py9
-rw-r--r--yardstick/cmd/cli.py2
-rw-r--r--yardstick/cmd/commands/plugin.py2
-rw-r--r--yardstick/cmd/commands/report.py2
-rw-r--r--yardstick/cmd/commands/runner.py2
-rw-r--r--yardstick/cmd/commands/scenario.py2
-rw-r--r--yardstick/cmd/commands/task.py2
-rw-r--r--yardstick/common/constants.py3
10 files changed, 19 insertions, 9 deletions
diff --git a/yardstick/benchmark/core/runner.py b/yardstick/benchmark/core/runner.py
index b9c22cbc9..64acdaa99 100644
--- a/yardstick/benchmark/core/runner.py
+++ b/yardstick/benchmark/core/runner.py
@@ -15,7 +15,7 @@ from yardstick.benchmark.runners.base import Runner
from yardstick.benchmark.core import print_hbar
-class Runners(object):
+class Runners(object): # pragma: no cover
"""Runner commands.
Set of commands to discover and display runner types.
diff --git a/yardstick/benchmark/core/scenario.py b/yardstick/benchmark/core/scenario.py
index a9d933faf..cd119c24c 100644
--- a/yardstick/benchmark/core/scenario.py
+++ b/yardstick/benchmark/core/scenario.py
@@ -15,7 +15,7 @@ from yardstick.benchmark.scenarios.base import Scenario
from yardstick.benchmark.core import print_hbar
-class Scenarios(object):
+class Scenarios(object): # pragma: no cover
"""Scenario commands.
Set of commands to discover and display scenario types.
diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py
index 478a51f9d..9c6caf03f 100644
--- a/yardstick/benchmark/core/task.py
+++ b/yardstick/benchmark/core/task.py
@@ -20,6 +20,8 @@ import time
import logging
import uuid
import errno
+import collections
+
from six.moves import filter
from yardstick.benchmark.contexts.base import Context
@@ -51,7 +53,8 @@ class Task(object): # pragma: no cover
atexit.register(self.atexit_handler)
- self.task_id = kwargs.get('task_id', str(uuid.uuid4()))
+ task_id = getattr(args, 'task_id')
+ self.task_id = task_id if task_id else str(uuid.uuid4())
check_environment()
@@ -133,6 +136,7 @@ class Task(object): # pragma: no cover
scenario['task_id'], scenario['tc'])
print("Done, exiting")
+ return result
def _init_output_config(self, output_config):
output_config.setdefault('DEFAULT', {})
@@ -594,6 +598,9 @@ def print_invalid_header(source_name, args):
def parse_task_args(src_name, args):
+ if isinstance(args, collections.Mapping):
+ return args
+
try:
kw = args and yaml.safe_load(args)
kw = {} if kw is None else kw
diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py
index 79f66e574..d2c49e89b 100644
--- a/yardstick/cmd/cli.py
+++ b/yardstick/cmd/cli.py
@@ -53,7 +53,7 @@ def find_config_files(path_list):
return None
-class YardstickCLI():
+class YardstickCLI(): # pragma: no cover
"""Command-line interface to yardstick"""
# Command categories
diff --git a/yardstick/cmd/commands/plugin.py b/yardstick/cmd/commands/plugin.py
index f97c490b7..b90ac15e6 100644
--- a/yardstick/cmd/commands/plugin.py
+++ b/yardstick/cmd/commands/plugin.py
@@ -17,7 +17,7 @@ from yardstick.common.utils import cliargs
from yardstick.cmd.commands import change_osloobj_to_paras
-class PluginCommands(object):
+class PluginCommands(object): # pragma: no cover
"""Plugin commands.
Set of commands to manage plugins.
diff --git a/yardstick/cmd/commands/report.py b/yardstick/cmd/commands/report.py
index 87ae7d5f7..47bf22a1f 100644
--- a/yardstick/cmd/commands/report.py
+++ b/yardstick/cmd/commands/report.py
@@ -19,7 +19,7 @@ from yardstick.cmd.commands import change_osloobj_to_paras
from yardstick.common.utils import cliargs
-class ReportCommands(object):
+class ReportCommands(object): # pragma: no cover
"""Report commands.
Set of commands to manage benchmark tasks.
diff --git a/yardstick/cmd/commands/runner.py b/yardstick/cmd/commands/runner.py
index b99ae789b..9ee99cf44 100644
--- a/yardstick/cmd/commands/runner.py
+++ b/yardstick/cmd/commands/runner.py
@@ -17,7 +17,7 @@ from yardstick.common.utils import cliargs
from yardstick.cmd.commands import change_osloobj_to_paras
-class RunnerCommands(object):
+class RunnerCommands(object): # pragma: no cover
"""Runner commands.
Set of commands to discover and display runner types.
diff --git a/yardstick/cmd/commands/scenario.py b/yardstick/cmd/commands/scenario.py
index 618ed2915..0e3f2c3be 100644
--- a/yardstick/cmd/commands/scenario.py
+++ b/yardstick/cmd/commands/scenario.py
@@ -16,7 +16,7 @@ from yardstick.common.utils import cliargs
from yardstick.cmd.commands import change_osloobj_to_paras
-class ScenarioCommands(object):
+class ScenarioCommands(object): # pragma: no cover
"""Scenario commands.
Set of commands to discover and display scenario types.
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index 6384e6eb1..0f98cabdc 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -19,7 +19,7 @@ from yardstick.cmd.commands import change_osloobj_to_paras
output_file_default = "/tmp/yardstick.out"
-class TaskCommands(object):
+class TaskCommands(object): # pragma: no cover
"""Task commands.
Set of commands to manage benchmark tasks.
diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py
index f192a1b85..d445e86e6 100644
--- a/yardstick/common/constants.py
+++ b/yardstick/common/constants.py
@@ -81,6 +81,9 @@ SQLITE = 'sqlite:////tmp/yardstick.db'
API_SUCCESS = 1
API_ERROR = 2
+TASK_NOT_DONE = 0
+TASK_DONE = 1
+TASK_FAILED = 2
BASE_URL = 'http://localhost:5000'
ENV_ACTION_API = BASE_URL + '/yardstick/env/action'