summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.pylintrc1
-rw-r--r--INFO4
-rw-r--r--docker/Dockerfile2
-rw-r--r--docker/Dockerfile.aarch64.patch30
-rw-r--r--docs/testing/user/userguide/opnfv_yardstick_tc081.rst4
-rw-r--r--docs/testing/user/userguide/opnfv_yardstick_tc084.rst140
-rw-r--r--requirements.txt91
-rw-r--r--test-requirements.txt4
-rwxr-xr-xtests/ci/load_images.sh2
-rw-r--r--tests/unit/benchmark/contexts/standalone/test_model.py27
-rw-r--r--[-rwxr-xr-x]tests/unit/test_cmd/__init__.py (renamed from tests/functional/__init__.py)0
-rw-r--r--tests/unit/test_cmd/commands/__init__.py (renamed from tests/unit/apiserver/resources/__init__.py)0
-rw-r--r--tests/unit/test_cmd/commands/test_env.py (renamed from tests/unit/cmd/commands/test_env.py)6
-rw-r--r--tests/unit/test_cmd/commands/test_testcase.py (renamed from tests/unit/cmd/commands/test_testcase.py)0
-rw-r--r--tests/unit/test_cmd/test_NSBperf.py (renamed from tests/unit/cmd/test_NSBperf.py)3
-rw-r--r--tools/coding-checks.sh9
-rw-r--r--tools/cover.sh32
-rwxr-xr-xtools/run_tests.sh11
-rw-r--r--tox.ini2
-rw-r--r--yardstick/benchmark/contexts/standalone/model.py3
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_ixload.py7
-rw-r--r--yardstick/tests/__init__.py (renamed from tests/unit/cmd/__init__.py)0
-rw-r--r--yardstick/tests/functional/__init__.py (renamed from tests/unit/cmd/commands/__init__.py)0
-rwxr-xr-xyardstick/tests/functional/test_cli_runner.py (renamed from tests/functional/test_cli_runner.py)4
-rwxr-xr-xyardstick/tests/functional/test_cli_scenario.py (renamed from tests/functional/test_cli_scenario.py)4
-rwxr-xr-xyardstick/tests/functional/utils.py (renamed from tests/functional/utils.py)0
-rw-r--r--yardstick/tests/unit/__init__.py76
-rw-r--r--yardstick/tests/unit/apiserver/__init__.py (renamed from tests/unit/apiserver/__init__.py)17
-rw-r--r--yardstick/tests/unit/apiserver/resources/__init__.py (renamed from tests/unit/common/__init__.py)0
-rw-r--r--yardstick/tests/unit/apiserver/resources/test_env_action.py (renamed from tests/unit/apiserver/resources/test_env_action.py)3
-rw-r--r--yardstick/tests/unit/apiserver/utils/test_influx.py (renamed from tests/unit/apiserver/utils/test_influx.py)8
-rw-r--r--yardstick/tests/unit/common/__init__.py0
-rw-r--r--yardstick/tests/unit/common/config_sample.yaml (renamed from tests/unit/common/config_sample.yaml)0
-rw-r--r--yardstick/tests/unit/common/test_ansible_common.py (renamed from tests/unit/common/test_ansible_common.py)12
-rw-r--r--yardstick/tests/unit/common/test_httpClient.py (renamed from tests/unit/common/test_httpClient.py)0
-rw-r--r--yardstick/tests/unit/common/test_openstack_utils.py (renamed from tests/unit/common/test_openstack_utils.py)2
-rw-r--r--yardstick/tests/unit/common/test_process.py (renamed from tests/unit/common/test_process.py)0
-rw-r--r--yardstick/tests/unit/common/test_template_format.py (renamed from tests/unit/common/test_template_format.py)3
-rw-r--r--yardstick/tests/unit/common/test_utils.py (renamed from tests/unit/common/test_utils.py)0
-rw-r--r--yardstick/tests/unit/common/test_yaml_loader.py (renamed from tests/unit/common/test_yaml_loader.py)0
-rw-r--r--yardstick/tests/unit/test_ssh.py (renamed from tests/unit/test_ssh.py)2
41 files changed, 381 insertions, 128 deletions
diff --git a/.pylintrc b/.pylintrc
index f5dd77665..78f656269 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -36,6 +36,7 @@ disable=
dangerous-default-value,
deprecated-lambda,
expression-not-assigned,
+ fixme,
global-statement,
literal-comparison,
no-init,
diff --git a/INFO b/INFO
index c19a9d518..35b282845 100644
--- a/INFO
+++ b/INFO
@@ -13,13 +13,15 @@ Repository: yardstick
Committers:
jorgen.w.karlsson@ericsson.com
jean.gaoliang@huawei.com
-vincenzo.m.riccobene@intel.com
lvjing5@huawei.com
wu.zhihui1@zte.com.cn
14_ykl@tongji.edu.cn
limingjiang@huawei.com
trevor.cooper@intel.com
ross.b.brattain@intel.com
+chenjiankun1@huawei.com
+rodolfo.alonso.hernandez@intel.com
+emma.l.foley@intel.com
Link to TSC approval: http://meetbot.opnfv.org/meetings/
Link to approval of additional submitters:
diff --git a/docker/Dockerfile b/docker/Dockerfile
index b1eb50592..2ee5b4c06 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -26,7 +26,7 @@ ENV YARDSTICK_REPO_DIR="${REPOS_DIR}/yardstick" \
RUN apt-get update && apt-get install -y git python-setuptools python-pip && apt-get -y autoremove && apt-get clean
RUN easy_install -U setuptools==30.0.0
-RUN pip install appdirs==1.4.0
+RUN pip install appdirs==1.4.0 pyopenssl==17.5.0
RUN mkdir -p ${REPOS_DIR}
diff --git a/docker/Dockerfile.aarch64.patch b/docker/Dockerfile.aarch64.patch
index 33c352a1b..ca933514a 100644
--- a/docker/Dockerfile.aarch64.patch
+++ b/docker/Dockerfile.aarch64.patch
@@ -1,14 +1,15 @@
-From: Alexandru Nemes <alexandru.nemes@enea.com>
-Date: Mon, 19 Jun 2017 14:18:24 +0300
+From: Cristina Pauna <cristina.pauna@enea.com>
+Date: Thu, 11 Jan 2018 19:06:26 +0200
Subject: [PATCH] Patch for Yardstick AARCH64 Docker file
+Signed-off-by: Cristina Pauna <cristina.pauna@enea.com>
Signed-off-by: Alexandru Nemes <alexandru.nemes@enea.com>
---
- docker/Dockerfile | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
+ docker/Dockerfile | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
-index 96a5d77..03307a2 100644
+index 2ee5b4c..23e5ea5 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,5 +1,5 @@
@@ -22,15 +23,25 @@ index 96a5d77..03307a2 100644
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
--FROM ubuntu:14.04
-+FROM aarch64/ubuntu:14.04
+-FROM ubuntu:16.04
++FROM arm64v8/ubuntu:16.04
-LABEL image=opnfv/yardstick
+LABEL image=opnfv/yardstick_aarch64
ARG BRANCH=master
-@@ -40,8 +40,8 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf
+@@ -24,7 +24,8 @@ ENV YARDSTICK_REPO_DIR="${REPOS_DIR}/yardstick" \
+ RELENG_REPO_DIR="${REPOS_DIR}/releng" \
+ STORPERF_REPO_DIR="${REPOS_DIR}/storperf"
+
+-RUN apt-get update && apt-get install -y git python-setuptools python-pip && apt-get -y autoremove && apt-get clean
++RUN apt-get update && apt-get install -y git python-setuptools python-pip && apt-get -y autoremove && \
++ apt-get install -y libssl-dev && apt-get -y install libffi-dev && apt-get clean
+ RUN easy_install -U setuptools==30.0.0
+ RUN pip install appdirs==1.4.0 pyopenssl==17.5.0
+
+@@ -43,8 +44,8 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf
EXPOSE 5000
@@ -39,4 +50,5 @@ index 96a5d77..03307a2 100644
+ADD http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img ${IMAGE_DIR}
+ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-disk1.img ${IMAGE_DIR}
- COPY ./exec_tests.sh /usr/local/bin/ \ No newline at end of file
+ COPY ./exec_tests.sh /usr/local/bin/
+
diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc081.rst b/docs/testing/user/userguide/opnfv_yardstick_tc081.rst
index 90af8a382..793c3fdd5 100644
--- a/docs/testing/user/userguide/opnfv_yardstick_tc081.rst
+++ b/docs/testing/user/userguide/opnfv_yardstick_tc081.rst
@@ -4,7 +4,7 @@
.. (c) OPNFV, Huawei Technologies Co.,Ltd and others.
*************************************
-Yardstick Test Case Description TC080
+Yardstick Test Case Description TC081
*************************************
.. _cirros-image: https://download.cirros-cloud.net
@@ -21,7 +21,7 @@ Yardstick Test Case Description TC080
|metric | RTT (Round Trip Time) |
| | |
+--------------+--------------------------------------------------------------+
-|test purpose | The purpose of TC080 is to do a basic verification that |
+|test purpose | The purpose of TC081 is to do a basic verification that |
| | network latency is within acceptable boundaries when packets |
| | travel between a containers and a VM. |
| | |
diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc084.rst b/docs/testing/user/userguide/opnfv_yardstick_tc084.rst
new file mode 100644
index 000000000..2e7b28e25
--- /dev/null
+++ b/docs/testing/user/userguide/opnfv_yardstick_tc084.rst
@@ -0,0 +1,140 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International
+.. License.
+.. http://creativecommons.org/licenses/by/4.0
+.. (c) OPNFV, Huawei Technologies Co.,Ltd and others.
+
+*************************************
+Yardstick Test Case Description TC084
+*************************************
+
+.. _spec_cpu_2006: https://www.spec.org/cpu2006/
+
++-----------------------------------------------------------------------------+
+|Compute Performance |
+| |
++--------------+--------------------------------------------------------------+
+|test case id | OPNFV_YARDSTICK_TC084_SPEC CPU 2006 FOR VM |
+| | |
++--------------+--------------------------------------------------------------+
+|metric | compute-intensive performance |
+| | |
++--------------+--------------------------------------------------------------+
+|test purpose | The purpose of TC084 is to evaluate the IaaS compute |
+| | performance by using SPEC CPU 2006 benchmark. The SPEC CPU |
+| | 2006 benchmark has several different ways to measure |
+| | computer performance. One way is to measure how fast the |
+| | computer completes a single task; this is called a speed |
+| | measurement. Another way is to measure how many tasks |
+| | computer can accomplish in a certain amount of time; this is |
+| | called a throughput, capacity or rate measurement. |
+| | |
++--------------+--------------------------------------------------------------+
+|test tool | SPEC CPU 2006 |
+| | |
+| | The SPEC CPU 2006 benchmark is SPEC's industry-standardized, |
+| | CPU-intensive benchmark suite, stressing a system's |
+| | processor, memory subsystem and compiler. This benchmark |
+| | suite includes the SPECint benchmarks and the SPECfp |
+| | benchmarks. The SPECint 2006 benchmark contains 12 different |
+| | benchmark tests and the SPECfp 2006 benchmark contains 19 |
+| | different benchmark tests. |
+| | |
+| | SPEC CPU 2006 is not always part of a Linux distribution. |
+| | SPEC requires that users purchase a license and agree with |
+| | their terms and conditions. For this test case, users must |
+| | manually download cpu2006-1.2.iso from the SPEC website and |
+| | save it under the yardstick/resources folder (e.g. /home/ |
+| | opnfv/repos/yardstick/yardstick/resources/cpu2006-1.2.iso) |
+| | SPEC CPU® 2006 benchmark is available for purchase via the |
+| | SPEC order form (https://www.spec.org/order.html). |
+| | |
++--------------+--------------------------------------------------------------+
+|test | This test case uses SPEC CPU 2006 benchmark to measure |
+|description | compute-intensive performance of VMs. |
+| | |
++--------------+--------------------------------------------------------------+
+|configuration | file: opnfv_yardstick_tc084.yaml |
+| | |
+| | benchmark_subset is set to int. |
+| | |
+| | SLA is not available in this test case. |
+| | |
++--------------+--------------------------------------------------------------+
+|applicability | Test can be configured with different: |
+| | |
+| | * benchmark_subset - a subset of SPEC CPU 2006 benchmarks |
+| | to run; |
+| | * SPECint_benchmark - a SPECint benchmark to run; |
+| | * SPECint_benchmark - a SPECfp benchmark to run; |
+| | * output_format - desired report format; |
+| | * runspec_config - SPEC CPU 2006 config file provided to |
+| | the runspec binary; |
+| | * runspec_iterations - the number of benchmark iterations |
+| | to execute. For a reportable run, must be 3; |
+| | * runspec_tune - tuning to use (base, peak, or all). For a |
+| | reportable run, must be either base or all. Reportable |
+| | runs do base first, then (optionally) peak; |
+| | * runspec_size - size of input data to run (test, train, or |
+| | ref). Reportable runs ensure that your binaries can |
+| | produce correct results with the test and train workloads |
+| | |
++--------------+--------------------------------------------------------------+
+|usability | This test case is used for executing SPEC CPU 2006 benchmark |
+| | on virtual machines. The SPECint 2006 benchmark takes |
+| | approximately 5 hours. (The time may vary due to different |
+| | VM cpu configurations) |
+| | |
++--------------+--------------------------------------------------------------+
+|references | spec_cpu_2006_ |
+| | |
+| | ETSI-NFV-TST001 |
+| | |
++--------------+--------------------------------------------------------------+
+|pre-test | To run and install SPEC CPU 2006, the following are |
+|conditions | required: |
+| | * For SPECint 2006: Both C99 and C++98 compilers are |
+| | installed in VM images; |
+| | * For SPECfp 2006: All three of C99, C++98 and Fortran-95 |
+| | compilers installed in VM images; |
+| | * At least 4GB of disk space availabile on VM. |
+| | |
+| | gcc 4.8.* and g++ 4.8.* version have been tested in Ubuntu |
+| | 14.04, Ubuntu 16.04 and Redhat Enterprise Linux 7.4 image. |
+| | Higher gcc and g++ version may cause compiling error. |
+| | |
+| | For more SPEC CPU 2006 dependencies please visit |
+| | (https://www.spec.org/cpu2006/Docs/techsupport.html) |
+| | |
++--------------+--------------------------------------------------------------+
+|test sequence | description and expected result |
+| | |
++--------------+--------------------------------------------------------------+
+|step 1 | cpu2006-1.2.iso has been saved under the yardstick/resources |
+| | folder (e.g. /home/opnfv/repos/yardstick/yardstick/resources |
+| | /cpu2006-1.2.iso). Additionally, to use your custom runspec |
+| | config file you can save it under the yardstick/resources/ |
+| | files folder and specify the config file name in the |
+| | runspec_config parameter. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 2 | Upload SPEC CPU 2006 ISO to the target VM using scp and |
+| | install SPEC CPU 2006. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 3 | Connect to the target server using SSH. |
+| | If custom runspec config file is used, copy this file from |
+| | yardstick to the target VM via the SSH tunnel. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 4 | SPEC CPU 2006 benchmark is invoked and SPEC CPU 2006 metrics |
+| | are generated. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 5 | Text, HTML, CSV, PDF, and Configuration file outputs for the |
+| | SPEC CPU 2006 metrics are fetched from the VM and stored |
+| | under /tmp/result folder. |
+| | |
++--------------+--------------------------------------------------------------+
+|test verdict | None. SPEC CPU 2006 results are collected and stored. |
+| | |
++--------------+--------------------------------------------------------------+
diff --git a/requirements.txt b/requirements.txt
index dec58b6b6..88c0e659a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,80 +8,59 @@
##############################################################################
Babel==2.3.4 # BSD; OSI Approved BSD License
-Jinja2==2.8.1 # BSD; OSI Approved BSD License
-MarkupSafe==0.23 # BSD; OSI Approved BSD License
+Jinja2==2.9.6 # BSD; OSI Approved BSD License
+SQLAlchemy==1.1.12 # MIT License; OSI Approved MIT License
PTable==0.9.2 # BSD (3 clause); OSI Approved BSD License
-PyYAML==3.12 # MIT; OSI Approved MIT License
-SQLAlchemy==1.1.4 # MIT License; OSI Approved MIT License
-ansible==2.3.2 # GPLv3; OSI Approved GNU General Public License v3 or later (GPLv3+)
-appdirs==1.4.3 # MIT; OSI Approved MIT License
+ansible==2.4.2 # GPLv3; OSI Approved GNU General Public License v3 or later (GPLv3+)
backport-ipaddress==0.1; python_version <= "2.7" # OSI Approved Python Software Foundation License
chainmap==1.0.2 # Python Software Foundation License; OSI Approved Python Software Foundation License
-cliff==2.4.0 # OSI Approved Apache Software License
-cmd2==0.6.9 # MIT; OSI Approved MIT License
-debtcollector==1.11.0 # OSI Approved Apache Software License
django==1.8.17 # BSD; OSI Approved BSD License
+ # NOTE(ralonsoh): django must be bumped to 1.11.8; consider the migration notes [1]
+ # [1] https://docs.djangoproject.com/ja/1.11/ref/templates/upgrading/
docker-py==1.10.6 # OSI Approved Apache Software License
-ecdsa==0.13 # MIT
extras==1.0.0 # OSI Approved MIT License
flasgger==0.5.13 # MIT
-flask-restful-swagger==0.19 # MIT
+flask-restful-swagger==0.19 # MIT
flask-restful==0.3.5 # BSD; OSI Approved BSD License
flask==0.11.1 # BSD; OSI Approved BSD License
-funcsigs==1.0.2 # ASL; OSI Approved Apache Software License
functools32==3.2.3.post2; python_version <= "2.7" # PSF license
-futures==3.0.5 # BSD; OSI Approved BSD License
-influxdb==4.0.0 # MIT License; OSI Approved MIT License
-iso8601==0.1.11 # MIT; OSI Approved MIT License
-jsonpatch==1.15 # Modified BSD License; OSI Approved BSD License
-jsonpointer==1.10 # Modified BSD License; OSI Approved BSD License
-jsonschema==2.5.1 # MIT; OSI Approved MIT License
+futures==3.1.1;python_version=='2.7' # BSD; OSI Approved BSD License
+influxdb==4.1.1 # MIT License; OSI Approved MIT License
jinja2schema==0.1.4 # OSI Approved BSD License
-keystoneauth1==2.18.0 # OSI Approved Apache Software License
+keystoneauth1==3.1.0 # OSI Approved Apache Software License
kubernetes==3.0.0a1 # OSI Approved Apache Software License
-linecache2==1.0.0 # OSI Approved Python Software Foundation License
-lxml==3.7.2 # OSI Approved BSD License
-# upgrade to version 2.0.0 to match python3 unittest.mock features
mock==2.0.0 # OSI Approved BSD License; `BSD License`_; http://github.com/testing-cabal/mock/blob/master/LICENSE.txt
-monotonic==1.2 # Apache; OSI Approved Apache Software License
msgpack-python==0.4.8 # OSI Approved Apache Software License
netaddr==0.7.19 # BSD License; OSI Approved BSD License; OSI Approved MIT License
-netifaces==0.10.5 # MIT License; OSI Approved MIT License
-openstacksdk==0.9.13 # OSI Approved Apache Software License
-os-client-config==1.26.0 # OSI Approved Apache Software License
-osc-lib==1.3.0 # OSI Approved Apache Software License
-oslo.config==3.22.0 # OSI Approved Apache Software License
-oslo.i18n==3.12.0 # OSI Approved Apache Software License
-oslo.serialization==2.16.0 # OSI Approved Apache Software License
-oslo.utils==3.22.0 # OSI Approved Apache Software License
-paramiko==2.1.1 # LGPL; OSI Approved GNU Library or Lesser General Public License (LGPL)
-pbr==1.10.0 # OSI Approved Apache Software License; Apache License, Version 2.0
-# version 14.5.0 for compatibility with trex traffic generator
+netifaces==0.10.6 # MIT License; OSI Approved MIT License
+os-client-config==1.28.0 # OSI Approved Apache Software License
+osc-lib==1.7.0 # OSI Approved Apache Software License
+oslo.config==4.11.1 # OSI Approved Apache Software License
+oslo.i18n==3.17.0 # OSI Approved Apache Software License
+oslo.serialization==2.20.1 # OSI Approved Apache Software License
+oslo.utils==3.28.0 # OSI Approved Apache Software License
+paramiko==2.2.1 # LGPL; OSI Approved GNU Library or Lesser General Public License (LGPL)
+pbr==3.1.1 # OSI Approved Apache Software License; Apache License, Version 2.0
pika==0.10.0 # BSD; OSI Approved BSD License
-positional==1.1.1 # OSI Approved Apache Software License
+positional==1.1.2 # OSI Approved Apache Software License
pycrypto==2.6.1 # Public Domain
-pyparsing==2.1.10 # MIT License; OSI Approved MIT License
-pyroute2==0.4.12 # dual license GPLv2+ and Apache v2; OSI Approved GNU General Public License v2 or later (GPLv2+); OSI Approved Apache Software License
-pyrsistent==0.11.12 # LICENSE.mit; OSI Approved MIT License
-python-cinderclient==1.11.0 # OSI Approved Apache Software License
-python-glanceclient==2.6.0 # OSI Approved Apache Software License
-python-heatclient==1.8.1 # OSI Approved Apache Software License
-python-keystoneclient==3.10.0 # OSI Approved Apache Software License
-python-mimeparse==1.6.0 # OSI Approved MIT License
-python-neutronclient==6.1.0 # OSI Approved Apache Software License
-python-novaclient==7.1.1 # OSI Approved Apache Software License
-python-openstackclient==3.8.1 # OSI Approved Apache Software License
-python-swiftclient==3.3.0 # OSI Approved Apache Software License
-pytz==2016.10 # MIT; OSI Approved MIT License
-pyzmq==14.5.0 # LGPL+BSD; OSI Approved GNU Library or Lesser General Public License (LGPL); OSI Approved BSD License
-requests==2.13.0 # Apache 2.0; OSI Approved Apache Software License
-requestsexceptions==1.1.3 # OSI Approved Apache Software License
+pyparsing==2.2.0 # MIT License; OSI Approved MIT License
+pyroute2==0.4.21 # dual license GPLv2+ and Apache v2; OSI Approved GNU General Public License v2 or later (GPLv2+); OSI Approved Apache Software License
+pyrsistent==0.14.1 # LICENSE.mit; OSI Approved MIT License
+python-cinderclient==3.1.0 # OSI Approved Apache Software License
+python-glanceclient==2.8.0 # OSI Approved Apache Software License
+python-heatclient==1.11.1 # OSI Approved Apache Software License
+python-keystoneclient==3.13.0 # OSI Approved Apache Software License
+python-neutronclient==6.5.0 # OSI Approved Apache Software License
+python-novaclient==9.1.1 # OSI Approved Apache Software License
+pyzmq==16.0.2 # LGPL+BSD; OSI Approved GNU Library or Lesser General Public License (LGPL); OSI Approved BSD License
+requests==2.18.2 # Apache 2.0; OSI Approved Apache Software License
+requestsexceptions==1.3.0 # OSI Approved Apache Software License
scp==0.10.2 # LGPL
-shade==1.17.0 # OSI Approved Apache Software License
-simplejson==3.10.0 # MIT License; OSI Approved MIT License; OSI Approved Academic Free License (AFL)
+shade==1.22.2 # OSI Approved Apache Software License
+simplejson==3.13.2 # MIT License; OSI Approved MIT License; OSI Approved Academic Free License (AFL)
six==1.10.0 # MIT; OSI Approved MIT License
-stevedore==1.20.0 # OSI Approved Apache Software License
+stevedore==1.25.0 # OSI Approved Apache Software License
traceback2==1.4.0 # OSI Approved Python Software Foundation License
unicodecsv==0.14.1 # BSD License; OSI Approved BSD License
-warlock==1.2.0 # OSI Approved Apache Software License
-wrapt==1.10.8 # BSD
+wrapt==1.10.10 # BSD
diff --git a/test-requirements.txt b/test-requirements.txt
index 8c59e4595..f933df29a 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,14 +2,14 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-coverage==4.3.4 # Apache 2.0; OSI Approved Apache Software License; http://www.apache.org/licenses/LICENSE-2.0; http://www.apache.org/licenses/LICENSE-2.0
+coverage==4.4.2 # Apache 2.0; OSI Approved Apache Software License; http://www.apache.org/licenses/LICENSE-2.0; http://www.apache.org/licenses/LICENSE-2.0
fixtures==3.0.0 # OSI Approved BSD License; OSI Approved Apache Software License
packaging==16.8.0 # BSD or Apache License, Version 2.0
pyflakes==1.0.0 # MIT; OSI Approved MIT License
pylint==1.8.1 # GPLv2
python-subunit==1.2.0 # OSI Approved Apache Software License; OSI Approved BSD License
testrepository==0.0.20 # OSI Approved BSD License; OSI Approved Apache Software License
-testtools==2.2.0 # OSI Approved MIT License
+testtools==2.3.0 # OSI Approved MIT License
unittest2==1.1.0 # OSI Approved BSD License
# Yardstick F release <-> OpenStack Pike release
diff --git a/tests/ci/load_images.sh b/tests/ci/load_images.sh
index 80caf07ae..caaba9e8b 100755
--- a/tests/ci/load_images.sh
+++ b/tests/ci/load_images.sh
@@ -133,7 +133,7 @@ load_cirros_image()
CIRROS_IMAGE_PATH="/home/opnfv/images/cirros-d161201-aarch64-disk.img"
EXTRA_PARAMS="--property hw_video_model=vga --property short_id=ubuntu16.04"
else
- CIRROS_IMAGE_VERSION="Cirros-0.3.5"
+ CIRROS_IMAGE_VERSION="cirros-0.3.5"
CIRROS_IMAGE_PATH="/home/opnfv/images/cirros-0.3.5-x86_64-disk.img"
fi
diff --git a/tests/unit/benchmark/contexts/standalone/test_model.py b/tests/unit/benchmark/contexts/standalone/test_model.py
index 31ec2b7d1..a8c54f193 100644
--- a/tests/unit/benchmark/contexts/standalone/test_model.py
+++ b/tests/unit/benchmark/contexts/standalone/test_model.py
@@ -134,9 +134,9 @@ class ModelLibvirtTestCase(unittest.TestCase):
as mock_parse:
xml = copy.deepcopy(self.xml)
mock_parse.return_value = xml
- vf_pci = '0001:05:04.2'
+ vm_pci = '0001:05:04.2'
model.Libvirt.add_sriov_interfaces(
- self.pci_address_str, vf_pci, self.mac, xml_input)
+ vm_pci, self.pci_address_str, self.mac, xml_input)
mock_parse.assert_called_once_with(xml_input)
self.mock_write_xml.assert_called_once_with(xml_input)
interface = xml.find('devices').find('interface')
@@ -145,8 +145,29 @@ class ModelLibvirtTestCase(unittest.TestCase):
mac = interface.find('mac')
self.assertEqual(self.mac, mac.get('address'))
source = interface.find('source')
+ source_address = source.find('address')
self.assertIsNotNone(source.find('address'))
- self.assertIsNotNone(interface.find('address'))
+
+ self.assertEqual('pci', source_address.get('type'))
+ self.assertEqual('0x' + self.pci_address_str.split(':')[0],
+ source_address.get('domain'))
+ self.assertEqual('0x' + self.pci_address_str.split(':')[1],
+ source_address.get('bus'))
+ self.assertEqual('0x' + self.pci_address_str.split(':')[2].split('.')[0],
+ source_address.get('slot'))
+ self.assertEqual('0x' + self.pci_address_str.split(':')[2].split('.')[1],
+ source_address.get('function'))
+
+ interface_address = interface.find('address')
+ self.assertEqual('pci', interface_address.get('type'))
+ self.assertEqual('0x' + vm_pci.split(':')[0],
+ interface_address.get('domain'))
+ self.assertEqual('0x' + vm_pci.split(':')[1],
+ interface_address.get('bus'))
+ self.assertEqual('0x' + vm_pci.split(':')[2].split('.')[0],
+ interface_address.get('slot'))
+ self.assertEqual('0x' + vm_pci.split(':')[2].split('.')[1],
+ interface_address.get('function'))
def test_create_snapshot_qemu(self):
result = "/var/lib/libvirt/images/0.qcow2"
diff --git a/tests/functional/__init__.py b/tests/unit/test_cmd/__init__.py
index e69de29bb..e69de29bb 100755..100644
--- a/tests/functional/__init__.py
+++ b/tests/unit/test_cmd/__init__.py
diff --git a/tests/unit/apiserver/resources/__init__.py b/tests/unit/test_cmd/commands/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/apiserver/resources/__init__.py
+++ b/tests/unit/test_cmd/commands/__init__.py
diff --git a/tests/unit/cmd/commands/test_env.py b/tests/unit/test_cmd/commands/test_env.py
index 73cd5af47..13c3ed44a 100644
--- a/tests/unit/cmd/commands/test_env.py
+++ b/tests/unit/test_cmd/commands/test_env.py
@@ -49,6 +49,9 @@ class EnvCommandTestCase(unittest.TestCase):
@mock.patch('yardstick.cmd.commands.env.HttpClient.get')
@mock.patch('yardstick.cmd.commands.env.EnvCommand._print_status')
def test_check_status(self, print_mock, get_mock):
+ # pylint: disable=unused-argument
+ # NOTE(ralonsoh): the pylint exception must be removed. The mocked
+ # command call must be tested.
task_id = str(uuid.uuid4())
get_mock.return_value = {'status': 2, 'result': 'error'}
status = EnvCommand()._check_status(task_id, 'hello world')
@@ -57,7 +60,8 @@ class EnvCommandTestCase(unittest.TestCase):
def test_print_status(self):
try:
EnvCommand()._print_status('hello', 'word')
- except Exception as e:
+ except Exception as e: # pylint: disable=broad-except
+ # NOTE(ralonsoh): try to reduce the scope of this exception.
self.assertIsInstance(e, IndexError)
diff --git a/tests/unit/cmd/commands/test_testcase.py b/tests/unit/test_cmd/commands/test_testcase.py
index 7ef157c19..7ef157c19 100644
--- a/tests/unit/cmd/commands/test_testcase.py
+++ b/tests/unit/test_cmd/commands/test_testcase.py
diff --git a/tests/unit/cmd/test_NSBperf.py b/tests/unit/test_cmd/test_NSBperf.py
index e1b4da7fc..19eb0afa0 100644
--- a/tests/unit/cmd/test_NSBperf.py
+++ b/tests/unit/test_cmd/test_NSBperf.py
@@ -27,7 +27,8 @@ from yardstick.cmd import NSBperf
@mock.patch('six.moves.input', return_value='0')
class TestHandler(unittest.TestCase):
- def test_handler(self, test):
+
+ def test_handler(self, *args):
subprocess.call = mock.Mock(return_value=0)
self.assertRaises(SystemExit, NSBperf.sigint_handler)
diff --git a/tools/coding-checks.sh b/tools/coding-checks.sh
index 4ee909988..615f2c3de 100644
--- a/tools/coding-checks.sh
+++ b/tools/coding-checks.sh
@@ -28,6 +28,7 @@ process_options () {
run_pylint () {
local target="${scriptargs:-all}"
+ local output_format=""
if [ "$target" = "all" ]; then
files="ansible api tests yardstick"
@@ -37,11 +38,15 @@ run_pylint () {
*) echo "$target is an unrecognized basecommit"; exit 1;;
esac
fi
-
+ # make Jenkins output parseable because Jenkins doesn't handle color
+ # enventually we should use the Jenkins Pylint plugin or other tools
+ if [ -n "${BRANCH:-}" ] ; then
+ output_format="--output-format=parseable"
+ fi
echo "Running pylint..."
echo "You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~0, this change only)..."
if [ -n "${files}" ]; then
- pylint --rcfile=.pylintrc ${files}
+ pylint --rcfile=.pylintrc ${output_format} ${files}
else
echo "No python changes in this commit, pylint check not required."
exit 0
diff --git a/tools/cover.sh b/tools/cover.sh
index 780a85a22..c6e928d1a 100644
--- a/tools/cover.sh
+++ b/tools/cover.sh
@@ -42,17 +42,17 @@ run_coverage_test() {
git checkout HEAD^
baseline_report=$(mktemp -t yardstick_coverageXXXXXXX)
- ls -l .testrepository
- # workaround 'db type could not be determined' bug
- # https://bugs.launchpad.net/testrepository/+bug/1229445
- rm -rf .testrepository
find . -type f -name "*.pyc" -delete
- #python setup.py testr --coverage --testr-args=""
- python setup.py testr --coverage --slowest --testr-args="$*"
- testr failing
- coverage report > ${baseline_report}
+ # Temporarily run tests from two directories, until all tests have moved
+ coverage run -p -m unittest discover ./tests/unit
+ coverage run -p -m unittest discover ./yardstick/tests/unit
+ coverage combine
+
+ # Temporarily omit yardstick/tests from the report
+ coverage report --omit=yardstick/tests/*/* > ${baseline_report}
+ coverage erase
# debug awk
tail -1 ${baseline_report}
@@ -69,17 +69,17 @@ run_coverage_test() {
# Generate and save coverage report
current_report=$(mktemp -t yardstick_coverageXXXXXXX)
- ls -l .testrepository
- # workaround 'db type could not be determined' bug
- # https://bugs.launchpad.net/testrepository/+bug/1229445
- rm -rf .testrepository
find . -type f -name "*.pyc" -delete
- #python setup.py testr --coverage --testr-args=""
- python setup.py testr --coverage --slowest --testr-args="$*"
- testr failing
- coverage report > ${current_report}
+ # Temporarily run tests from two directories, until all tests have moved
+ coverage run -p -m unittest discover ./tests/unit
+ coverage run -p -m unittest discover ./yardstick/tests/unit
+ coverage combine
+
+ # Temporarily omit yardstick/tests from the report
+ coverage report --omit=yardstick/tests/*/* > ${current_report}
+ coverage erase
rm -rf cover-$PY_VER
coverage html -d cover-$PY_VER
diff --git a/tools/run_tests.sh b/tools/run_tests.sh
index f253327e5..32c4f19e4 100755
--- a/tools/run_tests.sh
+++ b/tools/run_tests.sh
@@ -29,8 +29,17 @@ run_tests() {
echo "Running unittest ... "
if [ $FILE_OPTION == "f" ]; then
python -m unittest discover -v -s tests/unit > $logfile 2>&1
+ if [ $? -ne 0 ]; then
+ echo "FAILED, results in $logfile"
+ exit 1
+ fi
+ python -m unittest discover -v -s yardstick/tests/unit >> $logfile 2>&1
else
python -m unittest discover -v -s tests/unit
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ python -m unittest discover -v -s yardstick/tests/unit
fi
if [ $? -ne 0 ]; then
@@ -53,7 +62,7 @@ run_coverage() {
run_functional_test() {
mkdir -p .testrepository
- python -m subunit.run discover tests/functional > .testrepository/subunit.log
+ python -m subunit.run discover yardstick/tests/functional > .testrepository/subunit.log
subunit2pyunit < .testrepository/subunit.log
EXIT_CODE=$?
diff --git a/tox.ini b/tox.ini
index 9a82878b0..822ffdab4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,7 +5,7 @@ envlist = py{27,3},pep8,functional{,-py3},coverage
[testenv]
usedevelop=True
-passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
+passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY BRANCH
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
diff --git a/yardstick/benchmark/contexts/standalone/model.py b/yardstick/benchmark/contexts/standalone/model.py
index 85ae14b1d..0d58e91b0 100644
--- a/yardstick/benchmark/contexts/standalone/model.py
+++ b/yardstick/benchmark/contexts/standalone/model.py
@@ -212,9 +212,8 @@ class Libvirt(object):
mac.set('address', vf_mac)
source = ET.SubElement(interface, 'source')
- addr = ET.SubElement(source, 'address')
pci_address = PciAddress(vf_pci.strip())
- cls._add_interface_address(addr, pci_address)
+ cls._add_interface_address(source, pci_address)
pci_vm_address = PciAddress(vm_pci.strip())
cls._add_interface_address(interface, pci_vm_address)
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
index 61c045405..3ab30b53e 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py
@@ -91,7 +91,7 @@ class IxLoadResourceHelper(ClientResourceHelper):
self.result[key].append(value)
def setup(self):
- # TODO: fixupt scenario_helper to hanlde ixia
+ # NOTE: fixup scenario_helper to hanlde ixia
self.resource_file_name = \
find_relative_file(self.scenario_helper.scenario_cfg['ixia_profile'],
self.scenario_helper.scenario_cfg["task_path"])
@@ -113,7 +113,7 @@ class IxLoadResourceHelper(ClientResourceHelper):
def collect_kpi(self):
if self.data:
self._result.update(self.data)
- LOG.info("Collect {0} KPIs {1}".format(self.RESOURCE_WORD, self._result))
+ LOG.info("Collect %s KPIs %s", self.RESOURCE_WORD, self._result)
return self._result
def log(self):
@@ -170,9 +170,6 @@ class IxLoadTrafficGen(SampleVNFTrafficGen):
self.resource_helper.log()
self.resource_helper.data = self.resource_helper.make_aggregates()
- def instantiate(self, scenario_cfg, context_cfg):
- super(IxLoadTrafficGen, self).instantiate(scenario_cfg, context_cfg)
-
def terminate(self):
call(["pkill", "-9", "http_ixload.py"])
super(IxLoadTrafficGen, self).terminate()
diff --git a/tests/unit/cmd/__init__.py b/yardstick/tests/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/cmd/__init__.py
+++ b/yardstick/tests/__init__.py
diff --git a/tests/unit/cmd/commands/__init__.py b/yardstick/tests/functional/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/cmd/commands/__init__.py
+++ b/yardstick/tests/functional/__init__.py
diff --git a/tests/functional/test_cli_runner.py b/yardstick/tests/functional/test_cli_runner.py
index 620edc396..2f2d7fef2 100755
--- a/tests/functional/test_cli_runner.py
+++ b/yardstick/tests/functional/test_cli_runner.py
@@ -7,11 +7,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
-from __future__ import absolute_import
import unittest
-from tests.functional import utils
+from yardstick.tests.functional import utils
class RunnerTestCase(unittest.TestCase):
diff --git a/tests/functional/test_cli_scenario.py b/yardstick/tests/functional/test_cli_scenario.py
index 63b533b85..7aaacad0a 100755
--- a/tests/functional/test_cli_scenario.py
+++ b/yardstick/tests/functional/test_cli_scenario.py
@@ -7,11 +7,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
-from __future__ import absolute_import
import unittest
-from tests.functional import utils
+from yardstick.tests.functional import utils
class ScenarioTestCase(unittest.TestCase):
diff --git a/tests/functional/utils.py b/yardstick/tests/functional/utils.py
index d889c0dfa..d889c0dfa 100755
--- a/tests/functional/utils.py
+++ b/yardstick/tests/functional/utils.py
diff --git a/yardstick/tests/unit/__init__.py b/yardstick/tests/unit/__init__.py
new file mode 100644
index 000000000..a468b272b
--- /dev/null
+++ b/yardstick/tests/unit/__init__.py
@@ -0,0 +1,76 @@
+# Copyright (c) 2017 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import absolute_import
+import mock
+
+
+STL_MOCKS = {
+ 'trex_stl_lib': mock.MagicMock(),
+ 'trex_stl_lib.base64': mock.MagicMock(),
+ 'trex_stl_lib.binascii': mock.MagicMock(),
+ 'trex_stl_lib.collections': mock.MagicMock(),
+ 'trex_stl_lib.copy': mock.MagicMock(),
+ 'trex_stl_lib.datetime': mock.MagicMock(),
+ 'trex_stl_lib.functools': mock.MagicMock(),
+ 'trex_stl_lib.imp': mock.MagicMock(),
+ 'trex_stl_lib.inspect': mock.MagicMock(),
+ 'trex_stl_lib.json': mock.MagicMock(),
+ 'trex_stl_lib.linecache': mock.MagicMock(),
+ 'trex_stl_lib.math': mock.MagicMock(),
+ 'trex_stl_lib.os': mock.MagicMock(),
+ 'trex_stl_lib.platform': mock.MagicMock(),
+ 'trex_stl_lib.pprint': mock.MagicMock(),
+ 'trex_stl_lib.random': mock.MagicMock(),
+ 'trex_stl_lib.re': mock.MagicMock(),
+ 'trex_stl_lib.scapy': mock.MagicMock(),
+ 'trex_stl_lib.socket': mock.MagicMock(),
+ 'trex_stl_lib.string': mock.MagicMock(),
+ 'trex_stl_lib.struct': mock.MagicMock(),
+ 'trex_stl_lib.sys': mock.MagicMock(),
+ 'trex_stl_lib.threading': mock.MagicMock(),
+ 'trex_stl_lib.time': mock.MagicMock(),
+ 'trex_stl_lib.traceback': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'trex_stl_lib.types': mock.MagicMock(),
+ 'trex_stl_lib.utils': mock.MagicMock(),
+ 'trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'trex_stl_lib.utils.common': mock.MagicMock(),
+ 'trex_stl_lib.utils.json': mock.MagicMock(),
+ 'trex_stl_lib.utils.os': mock.MagicMock(),
+ 'trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'trex_stl_lib.utils.random': mock.MagicMock(),
+ 'trex_stl_lib.utils.re': mock.MagicMock(),
+ 'trex_stl_lib.utils.string': mock.MagicMock(),
+ 'trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'trex_stl_lib.warnings': mock.MagicMock(),
+ 'trex_stl_lib.yaml': mock.MagicMock(),
+ 'trex_stl_lib.zlib': mock.MagicMock(),
+ 'trex_stl_lib.zmq': mock.MagicMock(),
+}
diff --git a/tests/unit/apiserver/__init__.py b/yardstick/tests/unit/apiserver/__init__.py
index 5e1ed2ea1..44d163429 100644
--- a/tests/unit/apiserver/__init__.py
+++ b/yardstick/tests/unit/apiserver/__init__.py
@@ -1,3 +1,12 @@
+##############################################################################
+# Copyright (c) 2017
+#
+# 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
+##############################################################################
+"""Tests for yardstick/api/server.py"""
from __future__ import absolute_import
import mock
@@ -12,14 +21,16 @@ from yardstick.common import constants as consts
class APITestCase(unittest.TestCase):
-
+ """Tests for the YardStick API server"""
def setUp(self):
self.db_fd, self.db_path = tempfile.mkstemp()
consts.SQLITE = 'sqlite:///{}'.format(self.db_path)
- # server calls gethostbyname which takes 4 seconds, and we should mock it anyway
+ # server calls gethostbyname which takes 4 seconds, and we should mock
+ # it anyway
self.socket_mock = mock.patch.dict("sys.modules", {"socket": mock.MagicMock(
- **{"gethostbyname.return_value": "127.0.0.1", "gethostname.return_value": "localhost"})})
+ **{"gethostbyname.return_value": "127.0.0.1",
+ "gethostname.return_value": "localhost"})})
self.socket_mock.start()
try:
from api import server
diff --git a/tests/unit/common/__init__.py b/yardstick/tests/unit/apiserver/resources/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/common/__init__.py
+++ b/yardstick/tests/unit/apiserver/resources/__init__.py
diff --git a/tests/unit/apiserver/resources/test_env_action.py b/yardstick/tests/unit/apiserver/resources/test_env_action.py
index 5417ad953..b7bfe294d 100644
--- a/tests/unit/apiserver/resources/test_env_action.py
+++ b/yardstick/tests/unit/apiserver/resources/test_env_action.py
@@ -6,12 +6,11 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from __future__ import absolute_import
import time
import unittest
-from tests.unit.apiserver import APITestCase
+from yardstick.tests.unit.apiserver import APITestCase
class EnvTestCase(APITestCase):
diff --git a/tests/unit/apiserver/utils/test_influx.py b/yardstick/tests/unit/apiserver/utils/test_influx.py
index aff0cab5c..883608bb2 100644
--- a/tests/unit/apiserver/utils/test_influx.py
+++ b/yardstick/tests/unit/apiserver/utils/test_influx.py
@@ -6,13 +6,11 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from __future__ import absolute_import
import unittest
import mock
from api.utils import influx
-
-import six.moves.configparser as ConfigParser
+from six.moves import configparser as ConfigParser
class GetDataDbClientTestCase(unittest.TestCase):
@@ -25,7 +23,7 @@ class GetDataDbClientTestCase(unittest.TestCase):
mock_parser.NoOptionError = ConfigParser.NoOptionError
try:
influx.get_data_db_client()
- except Exception as e:
+ except Exception as e: # pylint: disable=broad-except
self.assertIsInstance(e, RuntimeError)
@@ -50,7 +48,7 @@ class QueryTestCase(unittest.TestCase):
try:
sql = 'select * form tasklist'
influx.query(sql)
- except Exception as e:
+ except Exception as e: # pylint: disable=broad-except
self.assertIsInstance(e, RuntimeError)
diff --git a/yardstick/tests/unit/common/__init__.py b/yardstick/tests/unit/common/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/yardstick/tests/unit/common/__init__.py
diff --git a/tests/unit/common/config_sample.yaml b/yardstick/tests/unit/common/config_sample.yaml
index 09218cc79..09218cc79 100644
--- a/tests/unit/common/config_sample.yaml
+++ b/yardstick/tests/unit/common/config_sample.yaml
diff --git a/tests/unit/common/test_ansible_common.py b/yardstick/tests/unit/common/test_ansible_common.py
index 1ef8eee5f..89ea128af 100644
--- a/tests/unit/common/test_ansible_common.py
+++ b/yardstick/tests/unit/common/test_ansible_common.py
@@ -49,7 +49,7 @@ class OverwriteDictTestCase(unittest.TestCase):
class FilenameGeneratorTestCase(unittest.TestCase):
@mock.patch('{}.NamedTemporaryFile'.format(PREFIX))
- def test__handle_existing_file(self, mock_tmp):
+ def test__handle_existing_file(self, _):
ansible_common.FileNameGenerator._handle_existing_file("/dev/null")
def test_get_generator_from_file(self):
@@ -184,7 +184,7 @@ class AnsibleCommonTestCase(unittest.TestCase):
self.assertEqual(a.deploy_dir, "d")
@mock.patch('{}.open'.format(PREFIX))
- def test__gen_ansible_playbook_file_list(self, mock_open):
+ def test__gen_ansible_playbook_file_list(self, _):
d = tempfile.mkdtemp()
try:
a = ansible_common.AnsibleCommon({})
@@ -194,7 +194,7 @@ class AnsibleCommonTestCase(unittest.TestCase):
@mock.patch('{}.NamedTemporaryFile'.format(PREFIX))
@mock.patch('{}.open'.format(PREFIX))
- def test__gen_ansible_inventory_file(self, mock_open, mock_tmp):
+ def test__gen_ansible_inventory_file(self, _, __):
nodes = [{
"name": "name", "user": "user", "password": "PASS",
"role": "role",
@@ -213,7 +213,7 @@ class AnsibleCommonTestCase(unittest.TestCase):
@mock.patch('{}.NamedTemporaryFile'.format(PREFIX))
@mock.patch('{}.open'.format(PREFIX))
- def test__gen_ansible_playbook_file_list_multiple(self, mock_open, mock_tmp):
+ def test__gen_ansible_playbook_file_list_multiple(self, _, __):
d = tempfile.mkdtemp()
try:
a = ansible_common.AnsibleCommon({})
@@ -224,7 +224,7 @@ class AnsibleCommonTestCase(unittest.TestCase):
@mock.patch('{}.NamedTemporaryFile'.format(PREFIX))
@mock.patch('{}.Popen'.format(PREFIX))
@mock.patch('{}.open'.format(PREFIX))
- def test_do_install_tmp_dir(self, mock_open, mock_popen, mock_tmp):
+ def test_do_install_tmp_dir(self, _, mock_popen, __):
mock_popen.return_value.communicate.return_value = "", ""
mock_popen.return_value.wait.return_value = 0
d = tempfile.mkdtemp()
@@ -237,7 +237,7 @@ class AnsibleCommonTestCase(unittest.TestCase):
@mock.patch('{}.NamedTemporaryFile'.format(PREFIX))
@mock.patch('{}.Popen'.format(PREFIX))
@mock.patch('{}.open'.format(PREFIX))
- def test_execute_ansible_check(self, mock_open, mock_popen, mock_tmp):
+ def test_execute_ansible_check(self, _, mock_popen, __):
mock_popen.return_value.communicate.return_value = "", ""
mock_popen.return_value.wait.return_value = 0
d = tempfile.mkdtemp()
diff --git a/tests/unit/common/test_httpClient.py b/yardstick/tests/unit/common/test_httpClient.py
index eb09d1a52..eb09d1a52 100644
--- a/tests/unit/common/test_httpClient.py
+++ b/yardstick/tests/unit/common/test_httpClient.py
diff --git a/tests/unit/common/test_openstack_utils.py b/yardstick/tests/unit/common/test_openstack_utils.py
index b3dc2d9c4..bf468489e 100644
--- a/tests/unit/common/test_openstack_utils.py
+++ b/yardstick/tests/unit/common/test_openstack_utils.py
@@ -21,7 +21,7 @@ from yardstick.common import openstack_utils
class GetCredentialsTestCase(unittest.TestCase):
@mock.patch('yardstick.common.openstack_utils.os')
- def test_get_credentials(self, mock_os):
+ def test_get_credentials(self, _):
with mock.patch.dict('os.environ', {'OS_IDENTITY_API_VERSION': '2'},
clear=True):
openstack_utils.get_credentials()
diff --git a/tests/unit/common/test_process.py b/yardstick/tests/unit/common/test_process.py
index 1c6dfec27..1c6dfec27 100644
--- a/tests/unit/common/test_process.py
+++ b/yardstick/tests/unit/common/test_process.py
diff --git a/tests/unit/common/test_template_format.py b/yardstick/tests/unit/common/test_template_format.py
index 2a7d80b4d..44aa80333 100644
--- a/tests/unit/common/test_template_format.py
+++ b/yardstick/tests/unit/common/test_template_format.py
@@ -24,6 +24,9 @@ class TemplateFormatTestCase(unittest.TestCase):
def test_parse_to_value_exception(self):
+ # TODO(elfoley): Don't hide the error that occurs in
+ # template_format.parse
+ # TODO(elfoley): Separate these tests; one per error type
with mock.patch.object(yaml, 'load') as yaml_loader:
yaml_loader.side_effect = yaml.scanner.ScannerError()
self.assertRaises(ValueError, template_format.parse, 'FOOBAR')
diff --git a/tests/unit/common/test_utils.py b/yardstick/tests/unit/common/test_utils.py
index 452b93a56..452b93a56 100644
--- a/tests/unit/common/test_utils.py
+++ b/yardstick/tests/unit/common/test_utils.py
diff --git a/tests/unit/common/test_yaml_loader.py b/yardstick/tests/unit/common/test_yaml_loader.py
index 90cbb8157..90cbb8157 100644
--- a/tests/unit/common/test_yaml_loader.py
+++ b/yardstick/tests/unit/common/test_yaml_loader.py
diff --git a/tests/unit/test_ssh.py b/yardstick/tests/unit/test_ssh.py
index 88699fd85..dbaae8c37 100644
--- a/tests/unit/test_ssh.py
+++ b/yardstick/tests/unit/test_ssh.py
@@ -262,7 +262,7 @@ class SSHTestCase(unittest.TestCase):
self.test_client.execute.mock_calls)
@mock.patch("yardstick.ssh.paramiko")
- def test_send_command(self, mock_paramiko):
+ def test_send_command(self, _):
paramiko_sshclient = self.test_client._get_client()
with mock.patch.object(paramiko_sshclient, "exec_command") \
as mock_paramiko_exec_command: