from __future__ import print_function
import logging
-import os
import re
import shutil
import subprocess
import sys
-import pkg_resources
import dns.resolver
from six.moves import urllib
import yaml
from functest.utils import constants
+from functest.utils import env
LOGGER = logging.getLogger(__name__)
Get the CI env variables
"""
ci_env_var = {
- "installer": os.environ.get('INSTALLER_TYPE'),
- "scenario": os.environ.get('DEPLOY_SCENARIO')}
+ "installer": env.get('INSTALLER_TYPE'),
+ "scenario": env.get('DEPLOY_SCENARIO')}
return ci_env_var
return returncode
-def get_dict_by_test(testname):
- # pylint: disable=bad-continuation
- with open(pkg_resources.resource_filename(
- 'functest', 'ci/testcases.yaml')) as tyaml:
- testcases_yaml = yaml.safe_load(tyaml)
-
- for dic_tier in testcases_yaml.get("tiers"):
- for dic_testcase in dic_tier['testcases']:
- if dic_testcase['case_name'] == testname:
- return dic_testcase
-
- LOGGER.error('Project %s is not defined in testcases.yaml', testname)
- return None
-
-
-def get_criteria_by_test(testname):
- tdict = get_dict_by_test(testname)
- if tdict:
- return tdict['criteria']
- return None
-
-
# ----------------------------------------------------------
#
# YAML UTILS
def get_functest_config(parameter):
- yaml_ = constants.CONST.__getattribute__('CONFIG_FUNCTEST_YAML')
+ yaml_ = constants.CONFIG_FUNCTEST_YAML
return get_parameter_from_yaml(parameter, yaml_)
def get_functest_yaml():
# pylint: disable=bad-continuation
- with open(constants.CONST.__getattribute__(
- 'CONFIG_FUNCTEST_YAML')) as yaml_fd:
+ with open(constants.CONFIG_FUNCTEST_YAML) as yaml_fd:
functest_yaml = yaml.safe_load(yaml_fd)
return functest_yaml