Add fuel-qa system tests mapping for openstack/puppet-projects

Add new mapping structure for openstack/puppet-projects
For each project in openstack/puppet-* projects(limited by project described in
github.com/openstack/fuel-library/deployment/puppet/openstack_tasks/Puppetfile)
will be mapped fuel-qa system-test in gates_tests/helpers/openstack_puppet_modules_mapping.yaml

mapping=['system_test']=[list of openstack/puppet-projects]

Mapping takes project edited in review and register single test group -
"review_in_openstack_puppet_modules" which mapped to system_test from mapping.

Change-Id: I16d8015be6e02717893955b45f7c718413ee8c10
Closes-Bug: #1590066
This commit is contained in:
Artem Grechanichenko 2016-06-09 15:27:33 +03:00
parent 6fcffb8667
commit 2fe3dc56ff
4 changed files with 92 additions and 5 deletions

View File

@ -0,0 +1,28 @@
bvt_2:
- openstack/puppet-ceph
- openstack/puppet-glance
- openstack/puppet-horizon
- openstack/puppet-keystone
- openstack/puppet-keystone
- openstack/puppet-neutron
- openstack/puppet-nova
- openstack/puppet-openstacklib
- openstack/puppet-oslo
neutron_vlan_ha:
- openstack/puppet-cinder
- openstack/puppet-swift
deploy_sahara_ha_tun:
- openstack/puppet-sahara
deploy_murano_ha_with_tun:
- openstack/puppet-murano
ironic_deploy_ceph:
- openstack/puppet-ironic
deploy_heat_ha:
- openstack/puppet-aodh
- openstack/puppet-ceilometer
- openstack/puppet-heat

View File

@ -289,7 +289,7 @@ def get_sha_sum(file_path):
return md5_sum
def puppet_modules_mapping(modules):
def fuel_library_modules_mapping(modules):
"""
find fuel-qa system test which have maximum coverage for edited
puppet modules and register that group with "review_in_fuel_library" name
@ -298,7 +298,8 @@ def puppet_modules_mapping(modules):
"""
# open yaml with covered modules
with open("gates_tests/helpers/puppet_module_mapping.yaml", "r") as f:
with open(
"gates_tests/helpers/fuel_library_modules_mapping.yaml", "r") as f:
mapping = yaml.load(f)
if modules and isinstance(modules, dict):
@ -317,7 +318,6 @@ def puppet_modules_mapping(modules):
.format(module, modules[module]))
# find test group which has better coverage of modules from review
formatted_modules = [module.split('.')[0] for module in modules]
system_test = "bvt_2"
max_intersection = 0
if not ("ceph" in modules and
@ -325,7 +325,7 @@ def puppet_modules_mapping(modules):
set(modules)):
for test in mapping:
test_intersection = len(
set(mapping[test]).intersection(set(formatted_modules)))
set(mapping[test]).intersection(set(modules)))
if test_intersection > max_intersection:
max_intersection = test_intersection
system_test = test
@ -349,6 +349,50 @@ def puppet_modules_mapping(modules):
depends_on_groups=[system_test])
def openstack_puppet_project_mapping(project):
"""
find fuel-qa system test which have maximum coverage for edited
openstack/puppet-project and register that group with
"review_in_openstack_puppet_project" name
project - puppet project edited in review
Example: project = "openstack/puppet-openstacklib"
"""
# open yaml with covered projects
with open(
"gates_tests/helpers/openstack_puppet_projects_mapping.yaml",
"r") as f:
mapping = yaml.load(f)
all_projects = set([j for i in mapping.values() for j in i])
logger.debug(
"List of openstack/puppet-projects "
"covered by system_tests {}".format(
all_projects))
logger.info(
"Edited project in review - '{}'".format(project))
# checking that project from review covered by system_test
if project not in all_projects:
logger.warning(
"{} project not exist or not covered by system_test"
.format(project))
# find test group which cover project edited in review
system_test = "bvt_2"
for test in mapping:
if project in mapping[test]:
system_test = test
break
logger.info(
"Edited project in review - '{}'"
" will be checked by next system test: {}".format(
project, system_test))
register(groups=['review_in_openstack_puppet_project'],
depends_on_groups=[system_test])
def map_test_review_in_fuel_library(**kwargs):
groups = kwargs.get('run_groups', [])
old_groups = kwargs.get('groups', None)
@ -359,7 +403,19 @@ def map_test_review_in_fuel_library(**kwargs):
modules = mp.get_changed_modules()
else:
modules = dict()
puppet_modules_mapping(modules)
fuel_library_modules_mapping(modules)
def map_test_review_in_openstack_puppet_projects(**kwargs):
groups = kwargs.get('run_groups', [])
old_groups = kwargs.get('groups', None)
groups.extend(old_groups or [])
if 'review_in_openstack_puppet_project' in groups:
if settings.GERRIT_PROJECT:
project = settings.GERRIT_PROJECT
else:
project = str()
openstack_puppet_project_mapping(project)
def check_package_version_injected_in_bootstraps(

View File

@ -11,6 +11,8 @@ from proboscis import register
from fuelweb_test.helpers.utils import pretty_log
from gates_tests.helpers.utils import map_test_review_in_fuel_library
from gates_tests.helpers.utils import \
map_test_review_in_openstack_puppet_projects
from system_test import register_system_test_cases
from system_test import get_groups
@ -215,6 +217,7 @@ def shell():
discover_import_tests(basedir, tests_directory)
define_custom_groups()
map_test_review_in_fuel_library(**vars(args))
map_test_review_in_openstack_puppet_projects(**vars(args))
COMMAND_MAP[args.command](**vars(args))