Пример #1
0
    def test_logs_present(self):
        self._ensure_test_logs_exist()

        log_list = list(logs.get_available_logs(self.app_id))

        for expected_caption in ("Application Standard Output",
                                 "Application Standard Error",
                                 "Web Server Access Log"):
            self.assertTrue(expected_caption in l["caption"] for l in log_list)
Пример #2
0
def distlog_get_available_logs(panel, app_id=None):
    panel.logger.info("Remote control distlog_get_available_logs request, " "app_id=%s." % app_id)

    if not app_id:
        raise ValueError("distlog_get_available_logs: " "Missing parameter app_id.")

    result = []
    for loginfo in logs.get_available_logs(app_id):
        loginfo["hostname"] = MY_HOSTNAME
        result.append(loginfo)
    return result
Пример #3
0
    def test_getting_log_content(self):
        self._ensure_test_logs_exist()

        log_list = list(logs.get_available_logs(self.app_id))
        self.assertTrue(len(log_list) > 0, log_list)

        for loginfo in log_list:
            log_id = loginfo["log_id"]
            caption = loginfo["caption"]
            filesize = loginfo["filesize"]
            mod_time = loginfo["mod_time"]

            self.assertTrue(isinstance(mod_time, float))

            print "LOG: %s: %s, %d bytes" % (caption, log_id, filesize)

            content = logs.get_log_content(self.app_id, log_id)
            self.assertTrue(isinstance(content, str), content)
Пример #4
0
 def test_get_no_logs(self):
     log_list = list(logs.get_available_logs("nonexistentapp"))
     self.assertEqual(len(log_list), 0)