From 4d647e03fc776e9ea369481217d1825c3625b041 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Thu, 28 Jul 2016 21:09:39 +0200 Subject: Select test cases in tempest to be blacklisted per each scenario JIRA: FUNCTEST-396 Added example for SDNVPN test cases Change-Id: I623130fc330c95239d982097552ca09f2a7ea34a Signed-off-by: jose.lausuch --- ci/exec_test.sh | 15 +------------ ci/testcases.yaml | 2 +- .../OpenStack/tempest/custom_tests/blacklist.txt | 17 ++++++++++++++ testcases/OpenStack/tempest/run_tempest.py | 26 ++++++++++++++++++---- 4 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 testcases/OpenStack/tempest/custom_tests/blacklist.txt diff --git a/ci/exec_test.sh b/ci/exec_test.sh index 800b44ab4..c48bde99f 100755 --- a/ci/exec_test.sh +++ b/ci/exec_test.sh @@ -116,24 +116,11 @@ function run_test(){ $clean_flag --sanity all $report ;; "bgpvpn") - sdnvpn_repo_dir=${repos_dir}/sdnvpn/test/functest/ - # Copy blacklist from sdnvpn repo to the proper place to execute functest - src=${sdnvpn_repo_dir}/tempest_blacklist.txt - dst=${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/custom_tests/blacklist.txt - cp $src $dst - # Execute tempest smoke with blacklist - python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/run_tempest.py \ - $clean_flag -s -m smoke $report - # Remove blacklist file - rm $dst - - # Execute SDNVPN test cases python ${sdnvpn_repo_dir}/run_tests.py $report - ;; "onos") python ${FUNCTEST_REPO_DIR}/testcases/Controllers/ONOS/Teston/onosfunctest.py - ;; + ;; "promise") python ${FUNCTEST_REPO_DIR}/testcases/features/promise.py $report sleep 10 # to let the instances terminate diff --git a/ci/testcases.yaml b/ci/testcases.yaml index 634d041b0..befcdd406 100644 --- a/ci/testcases.yaml +++ b/ci/testcases.yaml @@ -60,7 +60,7 @@ tiers: the OpenStack deplopyment. dependencies: installer: '' - scenario: '^(?!.*bgpvpn).*$' + scenario: '' - name: rally_sanity diff --git a/testcases/OpenStack/tempest/custom_tests/blacklist.txt b/testcases/OpenStack/tempest/custom_tests/blacklist.txt new file mode 100644 index 000000000..49605ca7b --- /dev/null +++ b/testcases/OpenStack/tempest/custom_tests/blacklist.txt @@ -0,0 +1,17 @@ +- + scenarios: + - os-odl_l2-bgpvpn-ha + - os-odl_l2-bgpvpn-noha + installers: + - fuel + - apex + tests: + - tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f,smoke] + - tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_server_details[id-5de47127-9977-400a-936f-abcfbec1218f,smoke] + - tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f,smoke] + - tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_server_details[id-5de47127-9977-400a-936f-abcfbec1218f,smoke] + - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard[id-2cb1baf6-ac8d-4429-bf0d-ba8a0ba53e32,smoke] + - tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops[compute,id-f323b3ba-82f8-4db7-8ea6-6a895869ec49,network,smoke] + - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops[compute,id-7fff3fb3-91d8-4fd0-bd7d-0204f1f180ba,network,smoke] + - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern[compute,id-557cd2c2-4eb8-4dce-98be-f86765ff311b,image,smoke,volume] + - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern[compute,id-557cd2c2-4eb8-4dce-98be-f86765ff311b,image,smoke,volume] diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py index f99678df4..8d23b7415 100755 --- a/testcases/OpenStack/tempest/run_tempest.py +++ b/testcases/OpenStack/tempest/run_tempest.py @@ -21,11 +21,12 @@ import shutil import subprocess import sys import time +import yaml import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils -import yaml + modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing', 'identity', 'image', 'network', 'object_storage', 'orchestration', @@ -330,13 +331,30 @@ def apply_tempest_blacklist(): logger.debug("Applying tempest blacklist...") cases_file = read_file(TEMPEST_RAW_LIST) result_file = open(TEMPEST_LIST, 'w') + black_tests = [] try: - black_file = read_file(TEMPEST_BLACKLIST) + installer_type = os.getenv('INSTALLER_TYPE') + deploy_scenario = os.getenv('DEPLOY_SCENARIO') + if (bool(installer_type) * bool(deploy_scenario)): + # if INSTALLER_TYPE and DEPLOY_SCENARIO are set we read the file + black_list_file = open(TEMPEST_BLACKLIST) + black_list_yaml = yaml.safe_load(black_list_file) + black_list_file.close() + for item in black_list_yaml: + scenarios = item['sceanrios'] + installers = item['installers'] + if (deploy_scenario in scenarios and + installer_type in installers): + tests = item['tests'] + for test in tests: + black_tests.append(test) + break except: - black_file = '' + black_tests = [] logger.debug("Tempest blacklist file does not exist.") + for line in cases_file: - if line not in black_file: + if line not in black_tests: result_file.write(str(line) + '\n') result_file.close() -- cgit 1.2.3-korg