aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/resources/v1/testsuites.py3
-rw-r--r--tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha_daily.yaml (renamed from tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha.yaml)0
-rw-r--r--tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha_daily.yaml (renamed from tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha.yaml)0
-rw-r--r--yardstick/tests/unit/apiserver/resources/v1/__init__.py0
-rw-r--r--yardstick/tests/unit/apiserver/resources/v1/test_testsuites.py35
5 files changed, 37 insertions, 1 deletions
diff --git a/api/resources/v1/testsuites.py b/api/resources/v1/testsuites.py
index 5f72c2ea6..3e14670b4 100644
--- a/api/resources/v1/testsuites.py
+++ b/api/resources/v1/testsuites.py
@@ -20,6 +20,7 @@ from yardstick.common.utils import result_handler
from yardstick.benchmark.core import Param
from yardstick.benchmark.core.task import Task
from api.swagger import models
+from api.database.v1.handlers import TasksHandler
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.DEBUG)
@@ -58,7 +59,7 @@ class V1Testsuite(ApiResource):
task_args.update(args.get('opts', {}))
param = Param(task_args)
- task_thread = TaskThread(Task().start, param)
+ task_thread = TaskThread(Task().start, param, TasksHandler())
task_thread.start()
return result_handler(consts.API_SUCCESS, {'task_id': task_id})
diff --git a/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha.yaml b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha_daily.yaml
index cb2b1311d..cb2b1311d 100644
--- a/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha.yaml
+++ b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-ha_daily.yaml
diff --git a/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha.yaml b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha_daily.yaml
index 961b8da89..961b8da89 100644
--- a/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha.yaml
+++ b/tests/opnfv/test_suites/opnfv_k8-nosdn-stor4nfv-noha_daily.yaml
diff --git a/yardstick/tests/unit/apiserver/resources/v1/__init__.py b/yardstick/tests/unit/apiserver/resources/v1/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/yardstick/tests/unit/apiserver/resources/v1/__init__.py
diff --git a/yardstick/tests/unit/apiserver/resources/v1/test_testsuites.py b/yardstick/tests/unit/apiserver/resources/v1/test_testsuites.py
new file mode 100644
index 000000000..85c045f44
--- /dev/null
+++ b/yardstick/tests/unit/apiserver/resources/v1/test_testsuites.py
@@ -0,0 +1,35 @@
+##############################################################################
+# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import mock
+
+import unittest
+
+from yardstick.tests.unit.apiserver import APITestCase
+from api.utils.thread import TaskThread
+
+
+class TestsuiteTestCase(APITestCase):
+
+ def test_run_test_suite(self):
+ if self.app is None:
+ unittest.skip('host config error')
+ return
+
+ TaskThread.start = mock.MagicMock()
+
+ url = 'yardstick/testsuites/action'
+ data = {
+ 'action': 'run_test_suite',
+ 'args': {
+ 'opts': {},
+ 'testsuite': 'opnfv_smoke'
+ }
+ }
+ resp = self._post(url, data)
+ self.assertEqual(resp.get('status'), 1)