aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorliang gao <jean.gaoliang@huawei.com>2016-07-20 06:27:50 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-07-20 06:27:50 +0000
commitebb9bc33134a90ea707f163950487056dc64e729 (patch)
treea41e270b43648e6d99f4836bfce778f0a88ea04b /tests
parente14fbf021bdf90dc160685c23b3cbbb320e9cfbf (diff)
parent7e9b180b0d10e84450eb2990549c02c106b0302e (diff)
Merge "add support for suite to support constraints and task_args"
Diffstat (limited to 'tests')
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml10
-rw-r--r--tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml23
-rw-r--r--tests/unit/cmd/commands/no_constraint_no_args_scenario_sample.yaml13
-rw-r--r--tests/unit/cmd/commands/no_constraint_with_args_scenario_sample.yaml15
-rw-r--r--tests/unit/cmd/commands/test_task.py77
-rw-r--r--tests/unit/cmd/commands/with_constraint_no_args_scenario_sample.yaml16
-rw-r--r--tests/unit/cmd/commands/with_constraint_with_args_scenario_sample.yaml18
7 files changed, 161 insertions, 11 deletions
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml
index 6f2952f97..d5754b966 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml
@@ -3,14 +3,16 @@
# Measure latency between NFVI nodes using ping
schema: "yardstick:task:0.1"
-
+{% set host = host or "node1.LF" %}
+{% set target = target or "node2.LF" %}
+{% set pod_info = pod_info or "etc/yardstick/nodes/compass_sclab_physical/pod.yaml" %}
scenarios:
-
type: Ping
options:
packetsize: 100
- host: node4.LF
- target: node5.LF
+ host: {{host}}
+ target: {{target}}
runner:
type: Duration
@@ -25,5 +27,5 @@ scenarios:
context:
type: Node
name: LF
- file: etc/yardstick/nodes/compass_sclab_physical/pod.yaml
+ file: {{pod_info}}
diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml
index d5f7bf824..c6dadac20 100644
--- a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml
+++ b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml
@@ -7,16 +7,25 @@ name: "os-nosdn-nofeature-ha"
test_cases_dir: "tests/opnfv/test_cases/"
test_cases:
-
- file_name: opnfv_yardstick_tc002.yaml
+ file_name: opnfv_yardstick_tc002.yaml
-
- file_name: opnfv_yardstick_tc005.yaml
+ file_name: opnfv_yardstick_tc005.yaml
-
- file_name: opnfv_yardstick_tc010.yaml
+ file_name: opnfv_yardstick_tc010.yaml
-
- file_name: opnfv_yardstick_tc011.yaml
+ file_name: opnfv_yardstick_tc011.yaml
-
- file_name: opnfv_yardstick_tc012.yaml
+ file_name: opnfv_yardstick_tc012.yaml
-
- file_name: opnfv_yardstick_tc014.yaml
+ file_name: opnfv_yardstick_tc014.yaml
-
- file_name: opnfv_yardstick_tc037.yaml
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc043.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei_pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node4.LF","target": "node5.LF"}'
+
diff --git a/tests/unit/cmd/commands/no_constraint_no_args_scenario_sample.yaml b/tests/unit/cmd/commands/no_constraint_no_args_scenario_sample.yaml
new file mode 100644
index 000000000..4933b93ae
--- /dev/null
+++ b/tests/unit/cmd/commands/no_constraint_no_args_scenario_sample.yaml
@@ -0,0 +1,13 @@
+---
+# Huawei US bare daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-nofeature-ha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc043.yaml
+
diff --git a/tests/unit/cmd/commands/no_constraint_with_args_scenario_sample.yaml b/tests/unit/cmd/commands/no_constraint_with_args_scenario_sample.yaml
new file mode 100644
index 000000000..f39df7346
--- /dev/null
+++ b/tests/unit/cmd/commands/no_constraint_with_args_scenario_sample.yaml
@@ -0,0 +1,15 @@
+---
+# Huawei US bare daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-nofeature-ha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc043.yaml
+ task_args:
+ huawei-pod1: '{"host": "node1.LF","target": "node2.LF"}'
+
diff --git a/tests/unit/cmd/commands/test_task.py b/tests/unit/cmd/commands/test_task.py
index ccb0f2aec..0177fd08a 100644
--- a/tests/unit/cmd/commands/test_task.py
+++ b/tests/unit/cmd/commands/test_task.py
@@ -11,6 +11,7 @@
# Unittest for yardstick.cmd.commands.task
+import os
import mock
import unittest
@@ -71,3 +72,79 @@ class TaskCommandsTestCase(unittest.TestCase):
mock_os.environ.get.side_effect = ['compass', 'os-nosdn', 'huawei-pod1']
result = t._check_precondition(cfg)
self.assertTrue(result)
+
+ @mock.patch('yardstick.cmd.commands.task.os.environ')
+ def test_parse_suite_no_constraint_no_args(self, mock_environ):
+ SAMPLE_SCENARIO_PATH = "no_constraint_no_args_scenario_sample.yaml"
+ t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
+ mock_environ.get.side_effect = ['huawei-pod1', 'compass']
+ task_files, task_args, task_args_fnames = t.parse_suite()
+ print ("files=%s, args=%s, fnames=%s" % (task_files, task_args,
+ task_args_fnames))
+ self.assertEqual(task_files[0],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
+ self.assertEqual(task_files[1],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_args[0], None)
+ self.assertEqual(task_args[1], None)
+ self.assertEqual(task_args_fnames[0], None)
+ self.assertEqual(task_args_fnames[1], None)
+
+ @mock.patch('yardstick.cmd.commands.task.os.environ')
+ def test_parse_suite_no_constraint_with_args(self, mock_environ):
+ SAMPLE_SCENARIO_PATH = "no_constraint_with_args_scenario_sample.yaml"
+ t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
+ mock_environ.get.side_effect = ['huawei-pod1', 'compass']
+ task_files, task_args, task_args_fnames = t.parse_suite()
+ print ("files=%s, args=%s, fnames=%s" % (task_files, task_args,
+ task_args_fnames))
+ self.assertEqual(task_files[0],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
+ self.assertEqual(task_files[1],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_args[0], None)
+ self.assertEqual(task_args[1],
+ '{"host": "node1.LF","target": "node2.LF"}')
+ self.assertEqual(task_args_fnames[0], None)
+ self.assertEqual(task_args_fnames[1], None)
+
+ @mock.patch('yardstick.cmd.commands.task.os.environ')
+ def test_parse_suite_with_constraint_no_args(self, mock_environ):
+ SAMPLE_SCENARIO_PATH = "with_constraint_no_args_scenario_sample.yaml"
+ t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
+ mock_environ.get.side_effect = ['huawei-pod1', 'compass']
+ task_files, task_args, task_args_fnames = t.parse_suite()
+ print ("files=%s, args=%s, fnames=%s" % (task_files, task_args,
+ task_args_fnames))
+ self.assertEqual(task_files[0],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
+ self.assertEqual(task_files[1],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_args[0], None)
+ self.assertEqual(task_args[1], None)
+ self.assertEqual(task_args_fnames[0], None)
+ self.assertEqual(task_args_fnames[1], None)
+
+ @mock.patch('yardstick.cmd.commands.task.os.environ')
+ def test_parse_suite_with_constraint_with_args(self, mock_environ):
+ SAMPLE_SCENARIO_PATH = "with_constraint_with_args_scenario_sample.yaml"
+ t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
+ mock_environ.get.side_effect = ['huawei-pod1', 'compass']
+ task_files, task_args, task_args_fnames = t.parse_suite()
+ print ("files=%s, args=%s, fnames=%s" % (task_files, task_args,
+ task_args_fnames))
+ self.assertEqual(task_files[0],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml')
+ self.assertEqual(task_files[1],
+ 'tests/opnfv/test_cases/opnfv_yardstick_tc043.yaml')
+ self.assertEqual(task_args[0], None)
+ self.assertEqual(task_args[1],
+ '{"host": "node1.LF","target": "node2.LF"}')
+ self.assertEqual(task_args_fnames[0], None)
+ self.assertEqual(task_args_fnames[1], None)
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
diff --git a/tests/unit/cmd/commands/with_constraint_no_args_scenario_sample.yaml b/tests/unit/cmd/commands/with_constraint_no_args_scenario_sample.yaml
new file mode 100644
index 000000000..8194a2361
--- /dev/null
+++ b/tests/unit/cmd/commands/with_constraint_no_args_scenario_sample.yaml
@@ -0,0 +1,16 @@
+---
+# Huawei US bare daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-nofeature-ha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc043.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+
diff --git a/tests/unit/cmd/commands/with_constraint_with_args_scenario_sample.yaml b/tests/unit/cmd/commands/with_constraint_with_args_scenario_sample.yaml
new file mode 100644
index 000000000..86c9b2800
--- /dev/null
+++ b/tests/unit/cmd/commands/with_constraint_with_args_scenario_sample.yaml
@@ -0,0 +1,18 @@
+---
+# Huawei US bare daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-nofeature-ha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc043.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"host": "node1.LF","target": "node2.LF"}'
+