def __initLogging(self): ''' @Name : __initLogging @Desc : 1. Initializes the logging for marvin and so provides various log features for automation run. 2. Initializes all logs to be available under given Folder Path,where all test run logs are available for a given run. 3. All logging like exception log,results, run info etc for a given test run are available under a given timestamped folder @Output : SUCCESS or FAILED ''' try: log_obj = MarvinLog("CSLog") if log_obj: ret = log_obj.\ createLogs(self.__testModName, self.__parsedConfig.logger, self.__userLogFolderPath) if ret != FAILED: self.__logFolderPath = log_obj.getLogFolderPath() self.__tcRunLogger = log_obj.getLogger() print "\n=== Marvin Init Logging Successful===" return SUCCESS return FAILED except Exception as e: print "\n Exception Occurred Under __initLogging " \ ":%s" % GetDetailExceptionInfo(e) return FAILED
""" Step1: Create the Logger """ if (options.input) and not (os.path.isfile(options.input)): print "\n=== Invalid Input Config File Path, Please Check ===" exit(1) log_obj = MarvinLog("CSLog") cfg = configGenerator.getSetupConfig(options.input) log = cfg.logger ret = log_obj.createLogs("DeployDataCenter", log) if ret != FAILED: log_folder_path = log_obj.getLogFolderPath() tc_run_logger = log_obj.getLogger() else: print "\n===Log Creation Failed. Please Check===" exit(1) """ Step2 : Create Test Client """ obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr, logger=tc_run_logger) if obj_tc_client and obj_tc_client.createTestClient() == FAILED: print "\n=== TestClient Creation Failed===" exit(1) """ Step3: Verify and continue whether to deploy a DC or remove a DC """
exit(1) if (options.input) and not (os.path.isfile(options.input)): print "\n=== Invalid Input Config File Path, Please Check ===" exit(1) from marvin.marvinLog import MarvinLog from marvin.cloudstackTestClient import CSTestClient log_obj = MarvinLog("CSLogClean") cfg = configGenerator.getSetupConfig(options.input) log = cfg.logger ret = log_obj.createLogs("Clean_Infra", log) if ret != FAILED: log_folder_path = log_obj.getLogFolderPath() tc_run_logger = log_obj.getLogger() else: print "\n=== Log Creation Failed. Please Check ===" exit(1) obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr, logger=tc_run_logger) if obj_tc_client and obj_tc_client.createTestClient() == FAILED: print "\n=== TestClient Creation Failed ===" exit(1) if (options.input) and (os.path.isfile(options.input)): apiClient = obj_tc_client.getApiClient() tmp_dict = {} zones = Zone.list(apiClient)
def test_create_marvin_log_with_name(self): name = 'test-log' marvin_log = MarvinLog(name) self.assertIsNotNone(marvin_log) self.assertEquals(name, marvin_log.getLogger().name)
def test_create_marvin_log_with_default_name(self): marvin_log = MarvinLog() self.assertIsNotNone(marvin_log) self.assertEquals('marvin.marvinLog', marvin_log.getLogger().name)