SUCCESS = APP.alert('Full Cycle diagnostics test') if SUCCESS: print(Fore.GREEN+'message bus is working') else: print(Fore.RED+'message bus is broken') except BaseException as ex: print(Fore.RED+'message bus is broken') print(APP.exceptionmessage(ex)) try: LOG = MinerLog() LOG.createdate = datetime.datetime.utcnow() LOG.minerid = 'diag' LOG.minername = 'diagnostics' LOG.action = 'diagnostics' SUCCESS = APP.log_mineractivity(LOG) LOGS = getminerlog(APP.getsession()) #print(log.__dict__) LOG_CNT = 0 for log in LOGS: LOG_CNT += 1 if SUCCESS and LOG_CNT > 0: print(Fore.GREEN+'database is working, {0} logs'.format(LOG_CNT)) else: print(Fore.RED+'database is broken') except BaseException as ex: print(Fore.RED+'database is broken') print(APP.exceptionmessage(ex))
'''test connectivity with database''' #currently using MariaDB (mysql) #mysql Ver 15.1 Distrib 10.1.23-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2 import datetime from domain.logging import MinerLog from domain.loggingrepository import getminerlog from backend.fcmapp import ApplicationService, ComponentName APP = ApplicationService(ComponentName.fullcycle) LOG = MinerLog() LOG.createdate = datetime.datetime.utcnow() LOG.minerid = 'unit test' LOG.minername = 'unit test' LOG.action = 'unit test' APP.log_mineractivity(LOG) for log in getminerlog(APP.getsession()): print(log.__dict__)