

@timed(2)
def test_watchdog_send_logs(self):
    'Test if the watchdog send logs'
    m = Main()
    watchdogsock = m.get_watchdogsocket()
    m.tcp_connect()
    m.send_connect([('login', '4.test'), ('passcode', 'test')])
    m.get_frame()
    msg = str(uuid.uuid4())
    watchdogsock.settimeout(0.1)
    try:
        while start.recvfrom(4096):
            pass
    except socket.timeout:
        pass
    m.send_frame('SEND', [('destination', config.TEST_WATCHDOG_TOPIC[0][0])], msg)
    start = time.time()
    watchdogsock.settimeout(1)
    while (time.time() < (start + 3)):
        (frame, _) = watchdogsock.recvfrom(4096)
        if (frame != ''):
            jframe = json.loads(frame)
            if (jframe['type'] == 'log'):
                if ((jframe['topic'] == config.TEST_WATCHDOG_TOPIC[0][0]) and (jframe['message'] == msg)):
                    watchdogsock.close()
                    return
    watchdogsock.close()
    raise Exception('No logs')

dataset/ETHPy150Open ebu/radiodns-plugit/RadioVisServer/tests.py MainTests.test_watchdog_send_logs/VarMisuse@86/125 `watchdogsock`->`start`