Example #1
0
 def _fetch_testrun_ids(self, test_name, server, cookie, ids, log1):
     rpc = xmlrpclib.Server("http://%s/" % server)
     max_num_retries = 3
     interval = 5
     for i in range(max_num_retries):
         time.sleep(interval)
         try:
             logs = rpc.latest_logs(interval + 11)
         except xmlrpclib.ProtocolError:
             continue
         for id in [log[0] for log in logs if log[4].find(cookie) >= 0]:
             if id not in ids:
                 ids.append(id)
         if ids:
             break
     if not ids:
         log1.error("New test run not found on server after %d " \
             "seconds, server: %s, cookie: %s" % \
             (max_num_retries * interval, CONFIG['server'], cookie))
     for id in ids:
         log1.info("Testrun: %s" % {
             "id": id,
             "name": test_name,
             "url": testrun_log_url(id)
         })
Example #2
0
 def verify(self, expected_result):
     if expected_result == Result.ERROR:
         for id in self.testrun_ids:
             self._assert_result(expected_result, Result.ERROR)
             self.test.assertTrue(log_page_contains_errors(id),
                 "There should be errors in testrun %s." % testrun_log_url(id))
     elif expected_result == Result.FAIL:
         self._assert_result(expected_result, Result.FAIL)
     elif expected_result == Result.PASS:
         for id in self.testrun_ids:
             self._assert_result(expected_result, Result.PASS)
             assert_log_page_contains_messages(self.test, id, \
                                               COMMON_SUCCESS_MESSAGES)
             self.test.assertFalse(log_page_contains_errors(id), \
                                   "Found errors in log %s" % id)
     else:
         raise Exception('Unknown expected result \'%s\'. Actual result: %s'
                         % (expected_result, self.result))
     return self
Example #3
0
 def verify(self, expected_result):
     if expected_result == Result.ERROR:
         for id in self.testrun_ids:
             self._assert_result(expected_result, Result.ERROR)
             self.test.assertTrue(
                 log_page_contains_errors(id),
                 "There should be errors in testrun %s." %
                 testrun_log_url(id))
     elif expected_result == Result.FAIL:
         self._assert_result(expected_result, Result.FAIL)
     elif expected_result == Result.PASS:
         for id in self.testrun_ids:
             self._assert_result(expected_result, Result.PASS)
             assert_log_page_contains_messages(self.test, id, \
                                               COMMON_SUCCESS_MESSAGES)
             self.test.assertFalse(log_page_contains_errors(id), \
                                   "Found errors in log %s" % id)
     else:
         raise Exception(
             'Unknown expected result \'%s\'. Actual result: %s' %
             (expected_result, self.result))
     return self
Example #4
0
 def _fetch_testrun_ids(self, test_name, server, cookie, ids, log1):
     rpc = xmlrpclib.Server("http://%s/" % server)
     max_num_retries = 3
     interval = 5
     for i in range(max_num_retries):
         time.sleep(interval)
         try:
             logs = rpc.latest_logs(interval+11)
         except xmlrpclib.ProtocolError:
             continue
         for id in [log[0] for log in logs if log[4].find(cookie) >= 0]:
             if id not in ids:
                 ids.append(id)
         if ids:
             break
     if not ids:
         log1.error("New test run not found on server after %d " \
             "seconds, server: %s, cookie: %s" % \
             (max_num_retries * interval, CONFIG['server'], cookie))
     for id in ids:
         log1.info("Testrun: %s" % {
             "id": id,
             "name": test_name,
             "url": testrun_log_url(id)})
Example #5
0
def assert_log_page_does_not_contain_regexp_pattern(test, testrun_id, pattern):
    test.assertFalse(
        log_page_contains_regexp_pattern(testrun_id, pattern),
        "Found pattern '%s' in testrun '%s'." %
        (pattern, testrun_log_url(testrun_id)))
Example #6
0
def assert_log_page_contains_regexp_pattern(test, testrun_id, pattern):
    test.assertTrue(
        log_page_contains_regexp_pattern(testrun_id, pattern),
        "Missing pattern '%s' in testrun '%s'." %
        (pattern, testrun_log_url(testrun_id)))
Example #7
0
def assert_log_page_does_not_contain_message(test, testrun_id, string):
    test.assertFalse(
        log_page_contains_message(testrun_id,
                                  string), "Found text '%s' in testrun '%s'." %
        (string, testrun_log_url(testrun_id)))
Example #8
0
def assert_log_page_contains_message(test, testrun_id, string):
    test.assertTrue(
        log_page_contains_message(testrun_id, string),
        "Missing text '%s' in testrun '%s'." %
        (string, testrun_log_url(testrun_id)))
Example #9
0
def assert_log_page_does_not_contain_regexp_pattern(test, testrun_id, pattern):
    test.assertFalse(log_page_contains_regexp_pattern(testrun_id, pattern),
        "Found pattern '%s' in testrun '%s'." %
        (pattern, testrun_log_url(testrun_id)))
Example #10
0
def assert_log_page_contains_regexp_pattern(test, testrun_id, pattern):
    test.assertTrue(log_page_contains_regexp_pattern(testrun_id, pattern),
        "Missing pattern '%s' in testrun '%s'." %
        (pattern, testrun_log_url(testrun_id)))
Example #11
0
def assert_log_page_does_not_contain_message(test, testrun_id, string):
    test.assertFalse(log_page_contains_message(testrun_id, string),
        "Found text '%s' in testrun '%s'." %
        (string, testrun_log_url(testrun_id)))
Example #12
0
def assert_log_page_contains_message(test, testrun_id, string):
    test.assertTrue(log_page_contains_message(testrun_id, string),
        "Missing text '%s' in testrun '%s'." %
        (string, testrun_log_url(testrun_id)))