summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/base.py3
-rw-r--r--api/resources/case_docs.py30
-rw-r--r--api/urls.py1
-rw-r--r--api/views.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash2
-rw-r--r--yardstick/common/constants.py1
6 files changed, 41 insertions, 2 deletions
diff --git a/api/base.py b/api/base.py
index bd967bbae..0f1e76a57 100644
--- a/api/base.py
+++ b/api/base.py
@@ -48,8 +48,9 @@ class ApiResource(Resource):
action, args = self._post_args()
return self._dispatch(args, action)
- def _dispatch_get(self):
+ def _dispatch_get(self, **kwargs):
args = self._get_args()
+ args.update(kwargs)
return self._dispatch(args)
def _dispatch(self, args, action='default'):
diff --git a/api/resources/case_docs.py b/api/resources/case_docs.py
new file mode 100644
index 000000000..289410d2d
--- /dev/null
+++ b/api/resources/case_docs.py
@@ -0,0 +1,30 @@
+import os
+import logging
+
+from api.utils.common import result_handler
+from yardstick.common import constants as consts
+
+LOG = logging.getLogger(__name__)
+LOG.setLevel(logging.DEBUG)
+
+
+def default(args):
+ return get_case_docs(args)
+
+
+def get_case_docs(args):
+ try:
+ case_name = args['case_name']
+ except KeyError:
+ return result_handler(consts.API_ERROR, 'case_name must be provided')
+
+ docs_path = os.path.join(consts.DOCS_DIR, '{}.rst'.format(case_name))
+
+ if not os.path.exists(docs_path):
+ return result_handler(consts.API_ERROR, 'case not exists')
+
+ LOG.info('Reading %s', case_name)
+ with open(docs_path) as f:
+ content = f.read()
+
+ return result_handler(consts.API_SUCCESS, {'docs': content})
diff --git a/api/urls.py b/api/urls.py
index b9ddd4c72..13c6c7675 100644
--- a/api/urls.py
+++ b/api/urls.py
@@ -17,6 +17,7 @@ urlpatterns = [
Url('/yardstick/testcases', views.Testcases, 'testcases'),
Url('/yardstick/testcases/release/action', views.ReleaseAction, 'release'),
Url('/yardstick/testcases/samples/action', views.SamplesAction, 'samples'),
+ Url('/yardstick/testcases/<case_name>/docs', views.CaseDocs, 'casedocs'),
Url('/yardstick/testsuites/action', views.TestsuitesAction, 'testsuites'),
Url('/yardstick/results', views.Results, 'results'),
Url('/yardstick/env/action', views.EnvAction, 'env')
diff --git a/api/views.py b/api/views.py
index 9fd236fad..9c9ca4ef9 100644
--- a/api/views.py
+++ b/api/views.py
@@ -74,3 +74,9 @@ class EnvAction(ApiResource):
def post(self):
return self._dispatch_post()
+
+
+class CaseDocs(ApiResource):
+
+ def get(self, case_name):
+ return self._dispatch_get(case_name=case_name)
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash b/yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash
index dbe8519ba..d69ebc7d5 100644
--- a/yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/disk/recovery_disk_io.bash
@@ -12,4 +12,4 @@
# recover a node from disk io block status
sudo kill `pidof dd`
-
+sudo rm -rf /test.dbf
diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py
index d445e86e6..d251341fc 100644
--- a/yardstick/common/constants.py
+++ b/yardstick/common/constants.py
@@ -39,6 +39,7 @@ ANSIBLE_DIR = join(REPOS_DIR, 'ansible')
SAMPLE_CASE_DIR = join(REPOS_DIR, 'samples')
TESTCASE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_cases/')
TESTSUITE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_suites/')
+DOCS_DIR = join(REPOS_DIR, 'docs/testing/user/userguide/')
# file
OPENRC = get_param('file.openrc', '/etc/yardstick/openstack.creds')