def setUp(self): LogUtils.start_logging() self.artutil = ArtifactoryUtil.ArtifactoryUtil() self.migratorutil = DockerMigratorUtil.DockerMigratorUtil() self.configutil = ConfigUtil.ConfigUtil() # Read test Configuration self.config = self.configutil.read_config_file('quay_test_data.ini') # Artifactory configuration self.artversion = 'latest' self.artport = '8081' self.artcontainername = 'artifactory' # Start Artifactory if not self.artutil.start_artifactory(self.artversion, self.artport, self.artcontainername): sys.exit('Failed to create the Artifactory instance')
def test_get_log_config(self): print(ConfigUtil.get_log_config())
def test_get_tdx_server_config(self): tdx_server_config = ConfigUtil.get_tdx_server_config() print(tdx_server_config) self.assertTrue(isinstance(tdx_server_config, dict)) self.assertTrue( isinstance(tdx_server_config[CONFIG.TDX_STOCK_SERVER_LIST], list))
# # @Author : Wades # @Time : 2018/10/11 3:11 PM # # The MIT License (MIT) # # Copyright (c) 2018 - 2020 # import configparser import datetime import os from zenlog import logging from util import ConfigUtil log_config = ConfigUtil.get_log_config() logging.basicConfig( level=log_config['LEVEL'], format= '%(asctime)s %(levelname)s [%(lineno)d] %(threadName)s Message: %(message)s', datefmt='%H:%M:%S', filename='{}{}onepiece-{}.log'.format( log_config['PATH'], os.sep, str(datetime.datetime.now().strftime('%Y-%m-%d'))), filemode='a', ) console = logging.StreamHandler() console.setLevel(log_config['LEVEL']) formatter = logging.Formatter( '%(asctime)s %(levelname)s [%(lineno)d] %(threadName)s Message: %(message)s'