Revision 08f1780b

b/snf-tools/synnefo_tools/burnin/common.py
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:
b/snf-tools/synnefo_tools/burnin/cyclades_common.py
364 364
        try:
365 365
            ssh.connect(hostip, username=username, password=password)
366 366
        except paramiko.SSHException as excpt:
367
            if excpt.code == 104:  # Error reading SSH protocol banner
367
            if excpt.errno == 104:  # Error reading SSH protocol banner
368 368
                raise Retry()
369 369
            else:
370 370
                raise
b/snf-tools/synnefo_tools/burnin/server_tests.py
44 44

  
45 45
from vncauthproxy.d3des import generate_response as d3des_generate_response
46 46

  
47
from synnefo_tools.burnin.common import BurninTests, Proper, run_test
47
from synnefo_tools.burnin.common import BurninTests, Proper
48 48
from synnefo_tools.burnin.cyclades_common import CycladesTests
49 49

  
50 50

  
......
341 341

  
342 342
    def test_004_run_testsuites(self):
343 343
        """Run the generated tests"""
344
        success = True
345
        for gen_cls in self.gen_classes:
346
            self.info("Running testsuite %s", gen_cls.__name__)
347
            success = run_test(gen_cls) and success  # With this order
348
            if self.failfast and not success:
349
                break
350
        self.assertTrue(success, "Some of the generated tests failed")
344
        self._run_tests(self.gen_classes)

Also available in: Unified diff