Resources to handle testcase related requests
"""
+import ConfigParser
import logging
import os
import re
-import pkg_resources
import socket
import uuid
-import ConfigParser
from flask import jsonify
from flasgger.utils import swag_from
+import pkg_resources
from functest.api.base import ApiResource
from functest.api.common import api_utils, thread
from functest.cli.commands.cli_testcase import Testcase
from functest.api.database.v1.handlers import TasksHandler
-from functest.utils.constants import CONST
+from functest.utils import config
+from functest.utils import env
import functest.utils.functest_utils as ft_utils
LOGGER = logging.getLogger(__name__)
result = 'FAIL'
env_info = {
- 'installer': os.environ.get('INSTALLER_TYPE', None),
- 'scenario': os.environ.get('DEPLOY_SCENARIO', None),
- 'build_tag': os.environ.get('BUILD_TAG', None),
- 'ci_loop': os.environ.get('CI_LOOP', 'daily')
+ 'installer': env.get('INSTALLER_TYPE'),
+ 'scenario': env.get('DEPLOY_SCENARIO'),
+ 'build_tag': env.get('BUILD_TAG'),
+ 'ci_loop': env.get('CI_LOOP')
}
result = {
'task_id': args.get('task_id'),
def _update_logging_ini(self, task_id): # pylint: disable=no-self-use
""" Update the log file for each task"""
- config = ConfigParser.RawConfigParser()
- config.read(
- pkg_resources.resource_filename('functest', 'ci/logging.ini'))
- log_path = os.path.join(getattr(CONST, 'dir_results'),
+ rconfig = ConfigParser.RawConfigParser()
+ rconfig.read(
+ pkg_resources.resource_filename('xtesting', 'ci/logging.ini'))
+ log_path = os.path.join(getattr(config.CONF, 'dir_results'),
'{}.log'.format(task_id))
- config.set('handler_file', 'args', '("{}",)'.format(log_path))
+ rconfig.set('handler_file', 'args', '("{}",)'.format(log_path))
with open(
pkg_resources.resource_filename(
- 'functest', 'ci/logging.ini'), 'wb') as configfile:
- config.write(configfile)
+ 'xtesting', 'ci/logging.ini'), 'wb') as configfile:
+ rconfig.write(configfile)