summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ci/load_images.sh8
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml9
-rw-r--r--tests/unit/benchmark/core/test_task.py28
-rw-r--r--tests/unit/benchmark/runner/__init__.py0
-rw-r--r--tests/unit/benchmark/runner/test_base.py45
-rw-r--r--tests/unit/dispatcher/test_influxdb.py4
6 files changed, 86 insertions, 8 deletions
diff --git a/tests/ci/load_images.sh b/tests/ci/load_images.sh
index 2e22b83c2..487f33e33 100755
--- a/tests/ci/load_images.sh
+++ b/tests/ci/load_images.sh
@@ -145,12 +145,6 @@ load_yardstick_image()
exit 1
fi
- if [[ "$DEPLOY_SCENARIO" == *"-lxd-"* ]]; then
- sudo rm -f -- "${RAW_IMAGE}"
- else
- sudo rm -f -- "${QCOW_IMAGE}"
- fi
-
echo "Glance image id: $GLANCE_IMAGE_ID"
}
@@ -225,7 +219,7 @@ create_nova_flavor()
echo
echo "========== Creating yardstick-flavor =========="
# Create the nova flavor used by some sample test cases
- openstack flavor create --id 100 --ram 512 --disk 3 --vcpus 1 yardstick-flavor
+ openstack flavor create --id 100 --ram 1024 --disk 3 --vcpus 1 yardstick-flavor
# DPDK-enabled OVS requires guest memory to be backed by large pages
if [[ $DEPLOY_SCENARIO == *[_-]ovs[_-]* ]]; then
openstack flavor set --property hw:mem_page_size=large yardstick-flavor
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
index 443395873..c4ee237e5 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
@@ -11,16 +11,22 @@
schema: "yardstick:task:0.1"
description: >
Sample test case for the HA of OpenStack Controll Node abnormally shutdown.
+ In order to power on the shutdown node after testing, the jumphost is
+ required to install ipmitool. Ipmi jumphost info and each nodes' ipmi ip,
+ username, password are needed in pod file (There is a sample pod file in
+ "etc/yardstick/nodes/pod.yaml.ipmi.sample").
{% set file = file or 'etc/yardstick/nodes/fuel_virtual/pod.yaml' %}
+{% set jumphost = jumphost or 'node0' %}
scenarios:
-
type: ServiceHA
options:
attackers:
- - fault_type: "host-shutdown"
+ - fault_type: "bare-metal-down"
host: node1
+ jump_host: {{jumphost}}
monitors:
- monitor_type: "openstack-cmd"
@@ -42,6 +48,7 @@ scenarios:
nodes:
node1: node1.LF
+ node0: node0.LF
runner:
type: Iteration
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index cd7ffdebb..8034392f4 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -64,6 +64,7 @@ class TaskTestCase(unittest.TestCase):
t = task.Task()
runner = mock.Mock()
runner.join.return_value = 0
+ runner.get_output.return_value = {}
mock_base_runner.Runner.get.return_value = runner
t._run([scenario], False, "yardstick.out")
self.assertTrue(runner.run.called)
@@ -155,6 +156,33 @@ class TaskTestCase(unittest.TestCase):
self.assertEqual(task_args_fnames[0], None)
self.assertEqual(task_args_fnames[1], None)
+ def test_parse_options(self):
+ options = {
+ 'openstack': {
+ 'EXTERNAL_NETWORK': '$network'
+ },
+ 'ndoes': ['node1', '$node'],
+ 'host': '$host'
+ }
+
+ t = task.Task()
+ t.outputs = {
+ 'network': 'ext-net',
+ 'node': 'node2',
+ 'host': 'server.yardstick'
+ }
+
+ idle_result = {
+ 'openstack': {
+ 'EXTERNAL_NETWORK': 'ext-net'
+ },
+ 'ndoes': ['node1', 'node2'],
+ 'host': 'server.yardstick'
+ }
+
+ actual_result = t._parse_options(options)
+ self.assertEqual(idle_result, actual_result)
+
def test_change_server_name_host_str(self):
scenario = {'host': 'demo'}
suffix = '-8'
diff --git a/tests/unit/benchmark/runner/__init__.py b/tests/unit/benchmark/runner/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/unit/benchmark/runner/__init__.py
diff --git a/tests/unit/benchmark/runner/test_base.py b/tests/unit/benchmark/runner/test_base.py
new file mode 100644
index 000000000..7880fe5a5
--- /dev/null
+++ b/tests/unit/benchmark/runner/test_base.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+##############################################################################
+# Copyright (c) 2017 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
+##############################################################################
+
+from __future__ import print_function
+from __future__ import absolute_import
+
+import unittest
+import multiprocessing
+import time
+
+from yardstick.benchmark.runners.iteration import IterationRunner
+
+
+class RunnerTestCase(unittest.TestCase):
+
+ def test_get_output(self):
+ queue = multiprocessing.Queue()
+ runner = IterationRunner({}, queue)
+ runner.output_queue.put({'case': 'opnfv_yardstick_tc002'})
+ runner.output_queue.put({'criteria': 'PASS'})
+
+ idle_result = {
+ 'case': 'opnfv_yardstick_tc002',
+ 'criteria': 'PASS'
+ }
+
+ time.sleep(1)
+ actual_result = runner.get_output()
+ self.assertEqual(idle_result, actual_result)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/dispatcher/test_influxdb.py b/tests/unit/dispatcher/test_influxdb.py
index 0c7b58135..dca3c4189 100644
--- a/tests/unit/dispatcher/test_influxdb.py
+++ b/tests/unit/dispatcher/test_influxdb.py
@@ -14,11 +14,15 @@
from __future__ import absolute_import
import unittest
+
try:
from unittest import mock
except ImportError:
import mock
+from yardstick import _init_logging
+_init_logging()
+
from yardstick.dispatcher.influxdb import InfluxdbDispatcher