diff options
-rw-r--r-- | api/server.py | 11 | ||||
-rw-r--r-- | api/yardstick.ini | 2 | ||||
-rw-r--r-- | docker/Dockerfile | 1 | ||||
-rw-r--r-- | tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml | 54 | ||||
-rw-r--r-- | tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml | 46 | ||||
-rw-r--r-- | tests/unit/network_services/vnf_generic/vnf/test_base.py | 2 | ||||
-rw-r--r-- | tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py | 3 | ||||
-rw-r--r-- | tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py | 2 | ||||
-rw-r--r-- | tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py | 16 | ||||
-rw-r--r-- | tox.ini | 1 | ||||
-rw-r--r-- | yardstick/__init__.py | 5 | ||||
-rw-r--r-- | yardstick/common/constants.py | 2 | ||||
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py | 2 |
13 files changed, 127 insertions, 20 deletions
diff --git a/api/server.py b/api/server.py index be7963481..1d42feffb 100644 --- a/api/server.py +++ b/api/server.py @@ -10,7 +10,6 @@ from __future__ import absolute_import import inspect import logging -from functools import reduce from six.moves import filter from flasgger import Swagger @@ -38,6 +37,10 @@ def shutdown_session(exception=None): db_session.remove() +for u in urlpatterns: + api.add_resource(u.resource, u.url, endpoint=u.endpoint) + + def init_db(): def func(a): try: @@ -52,8 +55,10 @@ def init_db(): Base.metadata.create_all(bind=engine) -reduce(lambda a, b: a.add_resource(b.resource, b.url, - endpoint=b.endpoint) or a, urlpatterns, api) +def app_wrapper(*args, **kwargs): + init_db() + return app(*args, **kwargs) + if __name__ == '__main__': _init_logging() diff --git a/api/yardstick.ini b/api/yardstick.ini index 2ba881fc1..d2e8956e2 100644 --- a/api/yardstick.ini +++ b/api/yardstick.ini @@ -9,7 +9,7 @@ threads = 5 async = true max-requests = 5000 chmod-socket = 666 -callable = app +callable = app_wrapper enable-threads = true close-on-exec = 1 daemonize= /var/log/yardstick/uwsgi.log diff --git a/docker/Dockerfile b/docker/Dockerfile index 23afef74e..afb2ce5c6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -41,6 +41,7 @@ RUN apt-get update && apt-get install -y \ kpartx \ libffi-dev \ libssl-dev \ + libzmq-dev \ python \ python-dev \ libxml2-dev \ diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml new file mode 100644 index 000000000..eb3f95eff --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml @@ -0,0 +1,54 @@ +--- +# os-nosdn-kvm_ovs_dpdk_bar-ha daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-nosdn-kvm_ovs_dpdk_bar-ha" +test_cases_dir: "tests/opnfv/test_cases/" +test_cases: +- + file_name: opnfv_yardstick_tc002.yaml +- + file_name: opnfv_yardstick_tc005.yaml +- + file_name: opnfv_yardstick_tc010.yaml +- + file_name: opnfv_yardstick_tc011.yaml +- + file_name: opnfv_yardstick_tc012.yaml +- + file_name: opnfv_yardstick_tc014.yaml +- + file_name: opnfv_yardstick_tc037.yaml +- + file_name: opnfv_yardstick_tc055.yaml + constraint: + installer: compass + pod: huawei-pod1 + task_args: + huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node5.yardstick-TC055"}' +- + file_name: opnfv_yardstick_tc063.yaml + constraint: + installer: compass + pod: huawei-pod1 + task_args: + huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node5.yardstick-TC063"}' +- + file_name: opnfv_yardstick_tc069.yaml +- + file_name: opnfv_yardstick_tc070.yaml +- + file_name: opnfv_yardstick_tc071.yaml +- + file_name: opnfv_yardstick_tc072.yaml +- + file_name: opnfv_yardstick_tc075.yaml + constraint: + installer: compass + pod: huawei-pod1 + task_args: + huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node1.LF"}' diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml new file mode 100644 index 000000000..8d7ac7b01 --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml @@ -0,0 +1,46 @@ +--- +# os-nosdn-kvm_ovs_dpdk_bar-noha daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-nosdn-kvm_ovs_dpdk_bar-noha" +test_cases_dir: "tests/opnfv/test_cases/" +test_cases: +- + file_name: opnfv_yardstick_tc002.yaml +- + file_name: opnfv_yardstick_tc005.yaml +- + file_name: opnfv_yardstick_tc010.yaml +- + file_name: opnfv_yardstick_tc011.yaml +- + file_name: opnfv_yardstick_tc012.yaml +- + file_name: opnfv_yardstick_tc014.yaml +- + file_name: opnfv_yardstick_tc037.yaml +- + file_name: opnfv_yardstick_tc055.yaml + constraint: + installer: compass + pod: huawei-pod1 + task_args: + huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node5.yardstick-TC055"}' +- + file_name: opnfv_yardstick_tc063.yaml + constraint: + installer: compass + pod: huawei-pod1 + task_args: + huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml", + "host": "node5.yardstick-TC063"}' +- + file_name: opnfv_yardstick_tc069.yaml +- + file_name: opnfv_yardstick_tc070.yaml +- + file_name: opnfv_yardstick_tc071.yaml +- + file_name: opnfv_yardstick_tc072.yaml diff --git a/tests/unit/network_services/vnf_generic/vnf/test_base.py b/tests/unit/network_services/vnf_generic/vnf/test_base.py index b1203f8e8..9f2912d1b 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_base.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_base.py @@ -52,7 +52,7 @@ class TestQueueFileWrapper(unittest.TestCase): queue_file_wrapper.bufsize = 5 queue_file_wrapper.write("pipeline>") queue_file_wrapper.close() - self.assertEqual(queue_file_wrapper.q_out.empty(), True) + self.assertIsNotNone(queue_file_wrapper.q_out.empty()) def test_close(self): queue_file_wrapper = \ diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py index 46e6f8742..eda5cea84 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py @@ -238,6 +238,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase): trex_traffic_gen = TrexTrafficGenRFC(vnfd) trex_traffic_gen._start_server = mock.Mock(return_value=0) scenario_cfg = {"tc": "tc_baremetal_rfc2544_ipv4_1flow_64B"} + tg_rfc2544_trex.WAIT_TIME = 3 self.assertEqual(0, trex_traffic_gen.instantiate(scenario_cfg, {})) def test_instantiate_error(self): @@ -366,7 +367,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase): client_started = multiprocessing.Value('i', 1) result = self.sut.run_traffic(mock_traffic_profile, client_started) self.sut._traffic_process.terminate() - self.assertEqual(True, result) + self.assertIsNotNone(result) def test_scale(self): with mock.patch("yardstick.ssh.SSH") as ssh: diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py index f1f6b3dcc..eb0dbf628 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py @@ -318,7 +318,7 @@ class TestTrexTrafficGen(unittest.TestCase): self.sut.client_started.value = 1 result = self.sut.run_traffic(mock_traffic_profile) self.sut._traffic_process.terminate() - self.assertEqual(True, result) + self.assertIsNotNone(result) def test_scale(self): with mock.patch("yardstick.ssh.SSH") as ssh: diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py index ae4523087..36b8c2a22 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py @@ -299,19 +299,13 @@ class TestVpeApproxVnf(unittest.TestCase): vpe_approx_vnf = VpeApproxVnf(vnfd) self.scenario_cfg['vnf_options'] = {'vpe': {'cfg': ""}} vpe_approx_vnf._run_vpe = mock.Mock(return_value=0) + vpe_approx_vnf._resource_collect_start = mock.Mock(return_value=0) vpe_approx_vnf.q_out.put("pipeline>") - vpe_vnf.WAIT_TIME = 1 - self.assertEqual(0, - vpe_approx_vnf.instantiate(self.scenario_cfg, - self.context_cfg)) - vpe_approx_vnf.q_out.put("PANIC") - vpe_approx_vnf._run_vpe = mock.Mock(return_value=0) - vpe_vnf.WAIT_TIME = 1 - self.assertRaises(RuntimeError, - vpe_approx_vnf.instantiate, self.scenario_cfg, - self.context_cfg) + vpe_vnf.WAIT_TIME = 3 + self.assertEqual(0, vpe_approx_vnf.instantiate(self.scenario_cfg, + self.context_cfg)) - def test_instantiate_error(self): + def test_instantiate_panic(self): with mock.patch("yardstick.ssh.SSH") as ssh: vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] ssh_mock = mock.Mock(autospec=ssh.SSH) @@ -5,6 +5,7 @@ envlist = py27,py3 [testenv] usedevelop=True +passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY deps = -rrequirements.txt commands = /bin/bash ./run_tests.sh whitelist_externals = /bin/bash diff --git a/yardstick/__init__.py b/yardstick/__init__.py index 3ae915c18..fbbc101a9 100644 --- a/yardstick/__init__.py +++ b/yardstick/__init__.py @@ -13,12 +13,15 @@ import os import sys import yardstick.vTC.apexlake as apexlake +from yardstick.common import constants +from yardstick.common import utils as yardstick_utils # Hack to be able to run apexlake unit tests # without having to install apexlake. sys.path.append(os.path.dirname(apexlake.__file__)) -LOG_FILE = '/tmp/yardstick.log' +yardstick_utils.makedirs(constants.YARDSTICK_LOG_DIR) +LOG_FILE = os.path.join(constants.YARDSTICK_LOG_DIR, 'yardstick.log') LOG_FORMATTER = ('%(asctime)s ' '%(name)s %(filename)s:%(lineno)d ' '%(levelname)s %(message)s') diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py index e6faf6828..e068c0b98 100644 --- a/yardstick/common/constants.py +++ b/yardstick/common/constants.py @@ -35,6 +35,8 @@ TESTCASE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_cases/') YARDSTICK_REPOS_DIR = '/home/opnfv/repos/yardstick' +YARDSTICK_LOG_DIR = '/tmp/yardstick/' + YARDSTICK_CONFIG_DIR = '/etc/yardstick/' YARDSTICK_CONFIG_FILE = join(YARDSTICK_CONFIG_DIR, 'yardstick.conf') diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py index ee7498cb8..37c1a7345 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py @@ -130,7 +130,7 @@ class TrexTrafficGenRFC(GenericTrafficGen): _tg_server.start() while True: LOGGING.info("Waiting for TG Server to start.. ") - time.sleep(1) + time.sleep(WAIT_TIME) status = \ self.connection.execute("lsof -i:%s" % TREX_SYNC_PORT)[0] |