Services pecan log Configuration – Debug Enabled/Disable

Switch to stestr

Change-Id: I6d268b3484b1107900b40a062010c540b61b04f6
This commit is contained in:
hosingh000 2019-05-03 13:28:12 -05:00 committed by Hari
parent 26e7ae1462
commit c548c0ca31
14 changed files with 24 additions and 18 deletions

2
.gitignore vendored
View File

@ -27,8 +27,6 @@ cover/
.coverage*
!.coveragerc
.tox
nosetests.xml
.testrepository
.venv
.idea/
.stestr/

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./orm/tests/unit
top_dir=./

View File

@ -1,7 +0,0 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./orm/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -14,6 +14,7 @@ use_handlers = 'console,logfile'
# use this setting to override the default level set.
# valid choices are 'CRITICAL', 'DEBUG', 'ERROR', 'INFO', 'WARNING'
debug_level = 'DEBUG'
pecan_debug = True
[keystone_authtoken]
username = 'admin'

View File

@ -55,6 +55,9 @@ OrmOpts = [
choices=('console', 'logfile', 'console,logfile'),
default='console',
help='output logging to console or logfile or both'),
cfg.BoolOpt('pecan_debug',
default=True,
help='Service app log debug level Enabled/Disabled.'),
]
CONF.register_opts(OrmOpts)
@ -320,6 +323,7 @@ CONF.register_opts(OrmCliGroup, orm_cli_group)
################################################################
# logging config settings
debug_level = CONF.debug_level
pecan_debug = CONF.pecan_debug
handler_list = CONF.use_handlers.split(",")
# ranger settings

View File

@ -16,7 +16,7 @@ database = {
app = {
'root': 'orm.services.audit_trail_manager.audit_server.controllers.root.RootController',
'modules': ['orm.services.audit_trail_manager.audit_server'],
'debug': True,
'debug': config.pecan_debug,
}
app_module = app['modules'][0]

View File

@ -19,7 +19,7 @@ server = {
app = {
'root': 'orm.services.customer_manager.cms_rest.controllers.root.RootController',
'modules': ['orm.services.customer_manager.cms_rest'],
'debug': True,
'debug': config.pecan_debug,
'hooks': lambda: [TransactionIdHook(), APIErrorHook(), SecurityHeadersHook()]
}

View File

@ -19,7 +19,7 @@ cache_seconds = 0
app = {
'root': 'orm.services.flavor_manager.fms_rest.controllers.root.RootController',
'modules': ['orm.services.flavor_manager.fms_rest'],
'debug': True,
'debug': config.pecan_debug,
'hooks': lambda: [TransIdHook(), APIErrorHook(), SecurityHeadersHook()]
}

View File

@ -11,7 +11,7 @@ server = {
app = {
'root': 'orm.services.id_generator.uuidgen.controllers.root.RootController',
'modules': ['orm.services.id_generator.uuidgen'],
'debug': True,
'debug': config.pecan_debug,
}
app_module = app['modules'][0]

View File

@ -17,7 +17,7 @@ server = {
app = {
'root': 'orm.services.image_manager.ims.controllers.root.RootController',
'modules': ['orm.services.image_manager.ims'],
'debug': True,
'debug': config.pecan_debug,
'hooks': lambda: [TransIdHook(), APIErrorHook(), SecurityHeadersHook()]
}

View File

@ -17,7 +17,7 @@ server = {
app = {
'root': 'orm.services.region_manager.rms.controllers.root.RootController',
'modules': ['orm.services.region_manager.rms'],
'debug': True,
'debug': config.pecan_debug,
'hooks': lambda: [TransactionIdHook(), APIErrorHook(), SecurityHeadersHook()]
}

View File

@ -3,6 +3,7 @@ import orm.base_config as config
app = {
'root': 'orm.services.resource_distributor.rds.controllers.root.RootController',
'modules': ['orm.services.resource_distributor.rds'],
'debug': config.pecan_debug,
'service_name': 'rds'
}

View File

@ -13,5 +13,5 @@ python-subunit>=0.0.18 # Apache-2.0/BSD
reno>=1.8.0 # Apache-2.0
sphinx>=1.6.2 # BSD
testfixtures>=5.1.1 # MIT
testrepository>=0.0.18 # Apache-2.0/BSD
stestr>=2.0.0
testtools>=1.4.0 # MIT

10
tox.ini
View File

@ -15,7 +15,7 @@ deps = -r{toxinidir}/test-requirements.txt
commands =
find . -type f -name "*.pyc" -delete
ostestr {posargs}
stestr run --slowest {posargs}
whitelist_externals =
bash
@ -34,7 +34,13 @@ commands =
commands = {posargs}
[testenv:cover]
commands = python setup.py testr --coverage --testr-args='{posargs}'
commands =
coverage erase
stestr run --slowest {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report --show-missing
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt