Commit 663e4975 authored by Jérome Perrin's avatar Jérome Perrin

testing: adjust logged messages by framework

Respect semantics of "verbose" vs "debug", to make it possible to run tests in
debug mode but without verbose messages.

Also adjust "Starting", this message was not clear
parent 167404e8
......@@ -129,7 +129,7 @@ def makeModuleSetUpAndTestCaseClass(
logger = logging.getLogger()
console_handler = logging.StreamHandler()
console_handler.setLevel(
logging.DEBUG if (verbose or debug) else logging.WARNING)
logging.DEBUG if verbose else logging.WARNING)
logger.addHandler(console_handler)
if debug:
......@@ -414,7 +414,7 @@ def installSoftwareUrlList(cls, software_url_list, max_retry=10, debug=False):
cls._copySnapshot(path, name)
try:
cls.logger.debug("Starting")
cls.logger.debug("Starting SlapOS")
cls.slap.start()
for software_url in software_url_list:
cls.logger.debug("Supplying %s", software_url)
......@@ -570,7 +570,7 @@ class SlapOSInstanceTestCase(unittest.TestCase):
snapshot_name = "{}.{}.setUpClass".format(cls.__module__, cls.__name__)
try:
cls.logger.debug("Starting")
cls.logger.debug("Starting setUpClass %s", cls)
cls.slap.start()
cls.logger.debug(
"Formatting to remove old partitions XXX should not be needed because we delete ..."
......@@ -736,7 +736,15 @@ class SlapOSInstanceTestCase(unittest.TestCase):
cls._storeSystemSnapshot(
"{}._cleanup request destroy".format(snapshot_name))
try:
# To make debug usable, we tolerate report_max_retry-1 errors and
# only debug the last.
for _ in range(3):
if cls._debug and cls.report_max_retry:
try:
cls.slap.waitForReport(max_retry=cls.report_max_retry - 1)
except SlapOSNodeCommandError:
cls.slap.waitForReport(debug=True)
else:
cls.slap.waitForReport(max_retry=cls.report_max_retry, debug=cls._debug)
except:
cls.logger.exception("Error during actual destruction")
......@@ -768,7 +776,15 @@ class SlapOSInstanceTestCase(unittest.TestCase):
"{}._cleanup leaked_partitions request destruction".format(
snapshot_name))
try:
# To make debug usable, we tolerate report_max_retry-1 errors and
# only debug the last.
for _ in range(3):
if cls._debug and cls.report_max_retry:
try:
cls.slap.waitForReport(max_retry=cls.report_max_retry - 1)
except SlapOSNodeCommandError:
cls.slap.waitForReport(debug=True)
else:
cls.slap.waitForReport(max_retry=cls.report_max_retry, debug=cls._debug)
except:
cls.logger.exception(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment