diff options
Diffstat (limited to 'tests')
29 files changed, 528 insertions, 48 deletions
diff --git a/tests/ci/prepare_env.sh b/tests/ci/prepare_env.sh index ed832bc47..723a04aa1 100755 --- a/tests/ci/prepare_env.sh +++ b/tests/ci/prepare_env.sh @@ -52,3 +52,6 @@ fi source $OPENRC export EXTERNAL_NETWORK INSTALLER_TYPE DEPLOY_TYPE NODE_NAME + +# Prepare a admin-rc file for StorPerf integration +$YARDSTICK_REPO_DIR/tests/ci/prepare_storperf_admin-rc.sh diff --git a/tests/ci/prepare_storperf_admin-rc.sh b/tests/ci/prepare_storperf_admin-rc.sh new file mode 100755 index 000000000..0401719ff --- /dev/null +++ b/tests/ci/prepare_storperf_admin-rc.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2016 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 +############################################################################## + +AUTH_URL=${OS_AUTH_URL} +USERNAME=${OS_USERNAME:-admin} +PASSWORD=${OS_PASSWORD:-console} +TENANT_NAME=${OS_TENANT_NAME:-admin} +VOLUME_API_VERSION=${OS_VOLUME_API_VERSION:-2} +PROJECT_NAME=${OS_PROJECT_NAME:-$TENANT_NAME} +TENANT_ID=`keystone tenant-get admin|grep 'id'|awk -F '|' '{print $3}'|sed -e 's/^[[:space:]]*//'` + + +rm -f ~/storperf_admin-rc +touch ~/storperf_admin-rc + +echo "OS_AUTH_URL="$AUTH_URL >> ~/storperf_admin-rc +echo "OS_USERNAME="$USERNAME >> ~/storperf_admin-rc +echo "OS_PASSWORD="$PASSWORD >> ~/storperf_admin-rc +echo "OS_TENANT_NAME="$TENANT_NAME >> ~/storperf_admin-rc +echo "OS_VOLUME_API_VERSION="$VOLUME_API_VERSION >> ~/storperf_admin-rc +echo "OS_PROJECT_NAME="$PROJECT_NAME >> ~/storperf_admin-rc +echo "OS_TENANT_ID="$TENANT_ID >> ~/storperf_admin-rc 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_cases/opnfv_yardstick_tc069.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc069.yaml new file mode 100644 index 000000000..637e160c6 --- /dev/null +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc069.yaml @@ -0,0 +1,38 @@ +--- +# Yardstick TC069 config file +# Measure memory read and write bandwidth using ramspeed + +schema: "yardstick:task:0.1" + +scenarios: +- + type: Ramspeed + options: + type_id: 1 + load: 32 + block_size: 64 + + host: kratos.yardstick-TC069 + + runner: + type: Iteration + iterations: 5 + interval: 1 + + sla: + min_bandwidth: 7000 + action: monitor + +context: + name: yardstick-TC069 + image: yardstick-trusty-server + flavor: yardstick-flavor + user: ubuntu + + servers: + kratos: + floating_ip: true + + networks: + test: + cidr: '10.0.1.0/24' diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml new file mode 100644 index 000000000..644010916 --- /dev/null +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml @@ -0,0 +1,85 @@ +--- +# Yardstick TC071 config file +# Measure cache hit/miss ratio and usage, network throughput and latency. +# Different amounts of flows are tested with, from 2 up to 1001000. +# All tests are run 2 times each. First 2 times with the least +# amount of ports, then 2 times with the next amount of ports, +# and so on until all packet sizes have been run with. +# +# During the measurements cache hit/miss ration, cache usage statistics and +# network latency are recorded/measured using cachestat and ping, respectively. + +schema: "yardstick:task:0.1" + +scenarios: +- + type: CACHEstat + run_in_background: true + + options: + interval: 1 + + host: demeter.yardstick-TC071 +- + type: CACHEstat + run_in_background: true + + options: + interval: 1 + + host: poseidon.yardstick-TC071 +- + type: Ping + run_in_background: true + + options: + packetsize: 100 + + host: demeter.yardstick-TC071 + target: poseidon.yardstick-TC071 + + sla: + max_rtt: 10 + action: monitor +{% for num_ports in [1, 10, 50, 100, 300, 500, 750, 1000] %} +- + type: Pktgen + options: + packetsize: 64 + number_of_ports: {{num_ports}} + duration: 20 + + host: demeter.yardstick-TC071 + target: poseidon.yardstick-TC071 + + runner: + type: Iteration + iterations: 2 + interval: 1 + + sla: + max_ppm: 1000 + action: monitor +{% endfor %} + +context: + name: yardstick-TC071 + image: yardstick-trusty-server + flavor: yardstick-flavor + user: ubuntu + + placement_groups: + pgrp1: + policy: "availability" + + servers: + demeter: + floating_ip: true + placement: "pgrp1" + poseidon: + floating_ip: true + placement: "pgrp1" + + networks: + test: + cidr: '10.0.1.0/24' diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc044.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc072.yaml index d7406832d..f3e6d4c40 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc044.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc072.yaml @@ -1,35 +1,35 @@ --- -# Yardstick TC044 config file -# Measure memory usage statistics, network throughput, latency and packet loss. +# Yardstick TC072 config file +# Measure network throughput and packet loss using pktgen. # Different amounts of flows are tested with, from 2 up to 1001000. # All tests are run 2 times each. First 2 times with the least # amount of ports, then 2 times with the next amount of ports, # and so on until all packet sizes have been run with. # -# During the measurements memory usage statistics and network latency are +# During the measurements network usage statistics and network latency are # recorded/measured using sar and ping, respectively. schema: "yardstick:task:0.1" scenarios: - - type: MEMORYload + type: NetUtilization run_in_background: true options: interval: 1 - count: 1 + count: 10 - host: demeter.yardstick-TC044 + host: demeter.yardstick-TC072 - - type: MEMORYload + type: NetUtilization run_in_background: true options: interval: 1 - count: 1 + count: 10 - host: poseidon.yardstick-TC044 + host: poseidon.yardstick-TC072 - type: Ping run_in_background: true @@ -37,8 +37,8 @@ scenarios: options: packetsize: 100 - host: demeter.yardstick-TC044 - target: poseidon.yardstick-TC044 + host: demeter.yardstick-TC072 + target: poseidon.yardstick-TC072 sla: max_rtt: 10 @@ -51,8 +51,8 @@ scenarios: number_of_ports: {{num_ports}} duration: 20 - host: demeter.yardstick-TC044 - target: poseidon.yardstick-TC044 + host: demeter.yardstick-TC072 + target: poseidon.yardstick-TC072 runner: type: Iteration @@ -65,7 +65,7 @@ scenarios: {% endfor %} context: - name: yardstick-TC044 + name: yardstick-TC072 image: yardstick-trusty-server flavor: yardstick-flavor user: ubuntu diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-ha_daily.yaml new file mode 100644 index 000000000..d40125e36 --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-ha_daily.yaml @@ -0,0 +1,22 @@ +--- +# Huawei US bare daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-nosdn-lxd-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 diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-noha_daily.yaml new file mode 100644 index 000000000..7c0785fe5 --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-lxd-noha_daily.yaml @@ -0,0 +1,22 @@ +--- +# Huawei US bare daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-nosdn-lxd-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 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/opnfv/test_suites/opnfv_os-nosdn-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-noha_daily.yaml new file mode 100644 index 000000000..b0a340dbf --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-noha_daily.yaml @@ -0,0 +1,22 @@ +--- +# Huawei US bare daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-nosdn-nofeature-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 diff --git a/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-noha_daily.yaml new file mode 100644 index 000000000..9888935cc --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-ocl-nofeature-noha_daily.yaml @@ -0,0 +1,22 @@ +--- +# Huawei US bare daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-ocl-nofeature-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 diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-noha_daily.yaml new file mode 100644 index 000000000..b94cdf755 --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-nofeature-noha_daily.yaml @@ -0,0 +1,22 @@ +--- +# Huawei US bare daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-odl_l2-nofeature-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 diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-noha_daily.yaml new file mode 100644 index 000000000..458afba13 --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-sfc-noha_daily.yaml @@ -0,0 +1,22 @@ +--- +# Huawei US bare daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-odl_l2-sfc-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 diff --git a/tests/opnfv/test_suites/opnfv_os-onos-nofeature-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-onos-nofeature-noha_daily.yaml new file mode 100644 index 000000000..fd76673de --- /dev/null +++ b/tests/opnfv/test_suites/opnfv_os-onos-nofeature-noha_daily.yaml @@ -0,0 +1,22 @@ +--- +# Huawei US bare daily task suite + +schema: "yardstick:suite:0.1" + +name: "os-onos-nofeature-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 diff --git a/tests/unit/benchmark/scenarios/availability/test_attacker_general.py b/tests/unit/benchmark/scenarios/availability/test_attacker_general.py index d6488a9a7..aa2e0cc4d 100644 --- a/tests/unit/benchmark/scenarios/availability/test_attacker_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_attacker_general.py @@ -32,7 +32,8 @@ class GeneralAttackerServiceTestCase(unittest.TestCase): 'fault_type': 'general-attacker', 'action_parameter':{'process_name':'nova_api'}, 'rollback_parameter':{'process_name':'nova_api'}, - 'key':'stop_service', + 'key':'stop-service', + 'attack_key':'stop-service', 'host': 'node1', } diff --git a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py b/tests/unit/benchmark/scenarios/availability/test_basemonitor.py index 140841075..a20cf8187 100644 --- a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py +++ b/tests/unit/benchmark/scenarios/availability/test_basemonitor.py @@ -23,7 +23,7 @@ class MonitorMgrTestCase(unittest.TestCase): def setUp(self): config = { 'monitor_type': 'openstack-api', - 'key' : 'service_status' + 'key' : 'service-status' } self.monitor_configs = [] @@ -40,7 +40,7 @@ class MonitorMgrTestCase(unittest.TestCase): def test_MonitorMgr_getitem(self, mock_monitor): monitorMgr = basemonitor.MonitorMgr() monitorMgr.init_monitors(self.monitor_configs, None) - monitorIns = monitorMgr['service_status'] + monitorIns = monitorMgr['service-status'] class BaseMonitorTestCase(unittest.TestCase): diff --git a/tests/unit/benchmark/scenarios/availability/test_baseoperation.py b/tests/unit/benchmark/scenarios/availability/test_baseoperation.py index 8c341913f..d85f1e19f 100644 --- a/tests/unit/benchmark/scenarios/availability/test_baseoperation.py +++ b/tests/unit/benchmark/scenarios/availability/test_baseoperation.py @@ -22,7 +22,7 @@ class OperationMgrTestCase(unittest.TestCase): def setUp(self): config = { 'operation_type': 'general-operation', - 'key' : 'service_status' + 'key' : 'service-status' } self.operation_configs = [] @@ -31,7 +31,7 @@ class OperationMgrTestCase(unittest.TestCase): def test_all_successful(self, mock_operation): mgr_ins = baseoperation.OperationMgr() mgr_ins.init_operations(self.operation_configs, None) - operation_ins = mgr_ins["service_status"] + operation_ins = mgr_ins["service-status"] mgr_ins.rollback() def test_getitem_fail(self, mock_operation): @@ -59,7 +59,7 @@ class BaseOperationTestCase(unittest.TestCase): def setUp(self): self.config = { 'operation_type': 'general-operation', - 'key' : 'service_status' + 'key' : 'service-status' } def test_all_successful(self): diff --git a/tests/unit/benchmark/scenarios/availability/test_director.py b/tests/unit/benchmark/scenarios/availability/test_director.py index 887ddd631..06116725d 100644 --- a/tests/unit/benchmark/scenarios/availability/test_director.py +++ b/tests/unit/benchmark/scenarios/availability/test_director.py @@ -33,16 +33,16 @@ class DirectorTestCase(unittest.TestCase): 'key': "kill-process"}], 'monitors': [{ 'monitor_type': "general-monitor", - 'key': "service_status"}], + 'key': "service-status"}], 'operations': [{ 'operation_type': 'general-operation', - 'key' : 'service_status'}], + 'key' : 'service-status'}], 'resultCheckers': [{ 'checker_type': 'general-result-checker', 'key' : 'process-checker',}], 'steps':[ { - 'actionKey': "service_status", + 'actionKey': "service-status", 'actionType': "operation", 'index': 1}, { @@ -54,7 +54,7 @@ class DirectorTestCase(unittest.TestCase): 'actionType': "resultchecker", 'index': 3}, { - 'actionKey': "service_status", + 'actionKey': "service-status", 'actionType': "monitor", 'index': 4}, ] @@ -69,12 +69,12 @@ class DirectorTestCase(unittest.TestCase): def test_director_all_successful(self, mock_checer, mock_opertion, mock_attacker, mock_monitor): ins = Director(self.scenario_cfg, self.ctx) - opertion_action = ins.createActionPlayer("operation", "service_status") + opertion_action = ins.createActionPlayer("operation", "service-status") attacker_action = ins.createActionPlayer("attacker", "kill-process") checker_action = ins.createActionPlayer("resultchecker", "process-checker") - monitor_action = ins.createActionPlayer("monitor", "service_status") + monitor_action = ins.createActionPlayer("monitor", "service-status") - opertion_rollback = ins.createActionRollbacker("operation", "service_status") + opertion_rollback = ins.createActionRollbacker("operation", "service-status") attacker_rollback = ins.createActionRollbacker("attacker", "kill-process") ins.executionSteps.append(opertion_rollback) ins.executionSteps.append(attacker_rollback) diff --git a/tests/unit/benchmark/scenarios/availability/test_monitor_general.py b/tests/unit/benchmark/scenarios/availability/test_monitor_general.py index 85487a574..de7d26cbf 100644 --- a/tests/unit/benchmark/scenarios/availability/test_monitor_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_monitor_general.py @@ -31,18 +31,20 @@ class GeneralMonitorServiceTestCase(unittest.TestCase): self.context = {"node1": host} self.monitor_cfg = { 'monitor_type': 'general-monitor', - 'key': 'service_status', + 'key': 'service-status', + 'monitor_key': 'service-status', 'host': 'node1', 'monitor_time': 3, 'parameter': {'serviceName': 'haproxy'}, - 'sla': {'max_recover_time': 1} + 'sla': {'max_outage_time': 1} } self.monitor_cfg_noparam = { 'monitor_type': 'general-monitor', - 'key': 'service_status', + 'key': 'service-status', + 'monitor_key': 'service-status', 'host': 'node1', 'monitor_time': 3, - 'sla': {'max_recover_time': 1} + 'sla': {'max_outage_time': 1} } def test__monitor_general_all_successful(self, mock_open, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/availability/test_operation_general.py b/tests/unit/benchmark/scenarios/availability/test_operation_general.py index 6713733a8..26cd3f7c4 100644 --- a/tests/unit/benchmark/scenarios/availability/test_operation_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_operation_general.py @@ -34,11 +34,13 @@ class GeneralOperaionTestCase(unittest.TestCase): 'action_parameter': {'ins_cup': 2}, 'rollback_parameter': {'ins_id': 'id123456'}, 'key': 'nova-create-instance', + 'operation_key': 'nova-create-instance', 'host': 'node1', } self.operation_cfg_noparam = { 'operation_type': 'general-operation', 'key': 'nova-create-instance', + 'operation_key': 'nova-create-instance', 'host': 'node1', } diff --git a/tests/unit/benchmark/scenarios/availability/test_result_checker_general.py b/tests/unit/benchmark/scenarios/availability/test_result_checker_general.py index 88a9b9d20..bbadf0ac3 100644 --- a/tests/unit/benchmark/scenarios/availability/test_result_checker_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_result_checker_general.py @@ -38,6 +38,7 @@ class GeneralResultCheckerTestCase(unittest.TestCase): 'condition' : 'eq', 'expectedValue' : 1, 'key' : 'process-checker', + 'checker_key' : 'process-checker', 'host': 'node1' } diff --git a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py b/tests/unit/benchmark/scenarios/availability/test_scenario_general.py index c17edea45..bab9d62f1 100644 --- a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py +++ b/tests/unit/benchmark/scenarios/availability/test_scenario_general.py @@ -29,14 +29,14 @@ class ScenarioGeneralTestCase(unittest.TestCase): 'key': "kill-process"}], 'monitors': [{ 'monitor_type': "general-monitor", - 'key': "service_status"}], + 'key': "service-status"}], 'steps':[ { 'actionKey': "kill-process", 'actionType': "attacker", 'index': 1}, { - 'actionKey': "service_status", + 'actionKey': "service-status", 'actionType': "monitor", 'index': 2}] } @@ -62,4 +62,4 @@ class ScenarioGeneralTestCase(unittest.TestCase): mock_obj.verify.return_value = False ins.director = mock_obj ins.run(None) - ins.teardown()
\ No newline at end of file + ins.teardown() diff --git a/tests/unit/benchmark/scenarios/compute/test_computecapacity.py b/tests/unit/benchmark/scenarios/compute/test_computecapacity.py index 5745b7ec9..660bb3391 100644 --- a/tests/unit/benchmark/scenarios/compute/test_computecapacity.py +++ b/tests/unit/benchmark/scenarios/compute/test_computecapacity.py @@ -29,7 +29,7 @@ class ComputeCapacityTestCase(unittest.TestCase): def setUp(self): self.ctx = { 'nodes': { - 'host1': { + 'host': { 'ip': '172.16.0.137', 'user': 'cirros', 'key_filename': "mykey.key", diff --git a/tests/unit/benchmark/scenarios/networking/test_sfc.py b/tests/unit/benchmark/scenarios/networking/test_sfc.py index 2d7990e59..618efc32e 100644 --- a/tests/unit/benchmark/scenarios/networking/test_sfc.py +++ b/tests/unit/benchmark/scenarios/networking/test_sfc.py @@ -45,8 +45,22 @@ class SfcTestCase(unittest.TestCase): def test_run_for_success(self, mock_subprocess, mock_openstack, mock_ssh): # Mock a successfull SSH in Sfc.setup() and Sfc.run() mock_ssh.SSH().execute.return_value = (0, '100', '') - mock_openstack.return_value = "127.0.0.1" - mock_subprocess.return_value = 'mocked!' + mock_openstack.get_an_IP.return_value = "127.0.0.1" + mock_subprocess.call.return_value = 'mocked!' + + result = {} + self.sfc.setup() + self.sfc.run(result) + self.sfc.teardown() + + @mock.patch('yardstick.benchmark.scenarios.networking.sfc.ssh') + @mock.patch('yardstick.benchmark.scenarios.networking.sfc.sfc_openstack') + @mock.patch('yardstick.benchmark.scenarios.networking.sfc.subprocess') + def test2_run_for_success(self, mock_subprocess, mock_openstack, mock_ssh): + # Mock a successfull SSH in Sfc.setup() and Sfc.run() + mock_ssh.SSH().execute.return_value = (0, 'vxlan_tool.py', 'succeeded timed out') + mock_openstack.get_an_IP.return_value = "127.0.0.1" + mock_subprocess.call.return_value = 'mocked!' result = {} self.sfc.setup() 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"}' + |