54 |
54 |
|
55 |
55 |
# --------------------------------------------------------------------
|
56 |
56 |
# Global variables
|
57 |
|
logger = None # Invalid constant name. pylint: disable-msg=C0103
|
|
57 |
logger = None # Invalid constant name. pylint: disable-msg=C0103
|
|
58 |
success = None # Invalid constant name. pylint: disable-msg=C0103
|
58 |
59 |
SNF_TEST_PREFIX = "snf-test-"
|
59 |
60 |
CONNECTION_RETRY_LIMIT = 2
|
60 |
61 |
SYSTEM_USERS = ["images@okeanos.grnet.gr", "images@demo.synnefo.org"]
|
... | ... | |
233 |
234 |
self.info(" Network usage is %s",
|
234 |
235 |
self.quotas['system']['cyclades.network.private']['usage'])
|
235 |
236 |
|
|
237 |
def _run_tests(self, tcases):
|
|
238 |
"""Run some generated testcases"""
|
|
239 |
global success # Using global. pylint: disable-msg=C0103,W0603,W0602
|
|
240 |
|
|
241 |
for tcase in tcases:
|
|
242 |
self.info("Running testsuite %s", tcase.__name__)
|
|
243 |
success = run_test(tcase) and success
|
|
244 |
if self.failfast and not success:
|
|
245 |
break
|
|
246 |
|
236 |
247 |
# ----------------------------------
|
237 |
248 |
# Loggers helper functions
|
238 |
249 |
def log(self, msg, *args):
|
... | ... | |
593 |
604 |
# Run Burnin
|
594 |
605 |
def run_burnin(testsuites, failfast=False):
|
595 |
606 |
"""Run burnin testsuites"""
|
596 |
|
global logger # Using global. pylint: disable-msg=C0103,W0603,W0602
|
|
607 |
# Using global. pylint: disable-msg=C0103,W0603,W0602
|
|
608 |
global logger, success
|
597 |
609 |
|
598 |
610 |
success = True
|
599 |
|
for tcase in testsuites:
|
600 |
|
was_success = run_test(tcase)
|
601 |
|
success = success and was_success
|
602 |
|
if failfast and not success:
|
603 |
|
break
|
|
611 |
run_tests(testsuites, failfast=failfast)
|
604 |
612 |
|
605 |
613 |
# Clean up our logger
|
606 |
614 |
del(logger)
|
... | ... | |
609 |
617 |
return 0 if success else 1
|
610 |
618 |
|
611 |
619 |
|
|
620 |
def run_tests(tcases, failfast=False):
|
|
621 |
"""Run some testcases"""
|
|
622 |
global success # Using global. pylint: disable-msg=C0103,W0603,W0602
|
|
623 |
|
|
624 |
for tcase in tcases:
|
|
625 |
was_success = run_test(tcase)
|
|
626 |
success = success and was_success
|
|
627 |
if failfast and not success:
|
|
628 |
break
|
|
629 |
|
|
630 |
|
612 |
631 |
def run_test(tcase):
|
613 |
632 |
"""Run a testcase"""
|
614 |
633 |
tsuite = unittest.TestLoader().loadTestsFromTestCase(tcase)
|
... | ... | |
619 |
638 |
|
620 |
639 |
# --------------------------------------------------------------------
|
621 |
640 |
# Helper functions
|
622 |
|
def was_successful(tsuite, success):
|
|
641 |
def was_successful(tsuite, successful):
|
623 |
642 |
"""Handle whether a testsuite was succesful or not"""
|
624 |
|
if success:
|
|
643 |
if successful:
|
625 |
644 |
logger.testsuite_success(tsuite)
|
626 |
645 |
return True
|
627 |
646 |
else:
|