def preSuiteBack(): try: os.environ['JHSCHEDULER_TOP'] except Exception as e: print "Error:please check the environment of JHSCHEDULER_TOP" raise e try: os.environ['AUTOTEST_TOP'] except Exception as e: print "Error:please check the environment of AUTOTEST_TOP" raise e killAllJob() backconf("oldconf") jhadmin_command() print "preSuitBack successed"
def postSuite(): try: os.environ['JHSCHEDULER_TOP'] except Exception as e: print "Error:please check the environment of JHSCHEDULER_TOP" raise e try: os.environ['AUTOTEST_TOP'] except Exception as e: print "Error:please check the environment of AUTOTEST_TOP" raise e killAllJob() recoverconf(conf_name="oldconf") jhadmin_command() killDefault() print "postSuite successed"
def preSuite(conf_path): try: os.environ['JHSCHEDULER_TOP'] except Exception as e: print "Error:please check the environment of JHSCHEDULER_TOP" raise e try: os.environ['AUTOTEST_TOP'] except Exception as e: print "Error:please check the environment of AUTOTEST_TOP" raise e try: conf_file = get_dir_path('AUTOTEST_TOP', conf_path) except IndexError: print "can not find the file of %s" % conf_path raise NameError killAllJob() backconf("oldconf") jhadmin_command() copyConfFile(conf_file) jhadmin_command() print "preSuite successed"
def postJadminSuite(timeout=60): try: os.environ['JHSCHEDULER_TOP'] except Exception as e: print "Error:please check the environment of JHSCHEDULER_TOP" raise e try: os.environ['AUTOTEST_TOP'] except Exception as e: print "Error:please check the environment of AUTOTEST_TOP" raise e killAllJob() stdout, stderr, exitcode = execCommand("su jhadmin -c 'jadmin hopen all'", timeout) stdout1, stderr1, exitcode1 = execCommand( "su jhadmin -c 'jadmin qopen all'", timeout) stdout2, stderr2, exitcode2 = execCommand( "su jhadmin -c 'jadmin qact all'", timeout) if exitcode or exitcode1 or exitcode2: print "the err code of postJadminSuite is %s,%s,%s" % ( exitcode, exitcode1, exitcode2) recoverconf(conf_name="oldconf") jhadmin_command() print "postSuite successed"
def postTest(): killAllJob() recoverconf(conf_name="suitconf") jhadmin_command() print "postTest successed"
def preTest(): killAllJob() backconf("suitconf") jhadmin_command() print "preTest successed"