예제 #1
0
 def test_gather_log_to_default_file(self):
     if os.path.exists(_DEFAULT_OUT_FILE):
         os.remove(_DEFAULT_OUT_FILE)
     self.assertFalse(os.path.exists(_DEFAULT_OUT_FILE))
     start_time = time.time()
     PSQL.run_sql_command("select pg_sleep(2)")
     end_time = time.time()
     GpLog.gather_log(start_time=start_time, end_time=end_time)
     self.assertTrue(os.path.exists(_DEFAULT_OUT_FILE))
     self.assertTrue(os.path.getsize(_DEFAULT_OUT_FILE) > 0)
예제 #2
0
 def test_gather_log_to_default_file(self):
     if os.path.exists(_DEFAULT_OUT_FILE):
         os.remove(_DEFAULT_OUT_FILE)
     self.assertFalse(os.path.exists(_DEFAULT_OUT_FILE))
     start_time = time.time()
     PSQL.run_sql_command("select pg_sleep(2)")
     end_time = time.time()
     GpLog.gather_log(start_time=start_time, end_time=end_time)
     self.assertTrue(os.path.exists(_DEFAULT_OUT_FILE))
     self.assertTrue(os.path.getsize(_DEFAULT_OUT_FILE) > 0)
예제 #3
0
 def test_gather_log_out_file(self):
     out_file = '/tmp/cluster2.logs'
     if os.path.exists(out_file):
         os.remove(out_file)
     self.assertFalse(os.path.exists(out_file))
     start_time = time.time()
     time.sleep(2)
     end_time = time.time()
     GpLog.gather_log(start_time=start_time, end_time=end_time, out_file=out_file)
     self.assertTrue(os.path.exists(out_file))
     self.assertTrue(os.path.getsize(out_file) > 0)
예제 #4
0
파일: mpp_tc.py 프로젝트: 50wu/gpdb
 def gather_log(self):
     """
     This method will gather logs from all segments between start_time and end_time
     of the test and write it to an out file in the output directory. The default name
     of the log file will be <testmethodname>.logs
     """
     tinctest.logger.trace_in()
     start_time = self.start_time
     if start_time == 0 or not start_time:
         return
     end_time = self.end_time
     if end_time == 0 or not end_time:
         end_time = time.time()
     out_file = os.path.join(self.get_out_dir(), self._testMethodName + '.logs')
     GpLog.gather_log(start_time, end_time, out_file)
     tinctest.logger.trace_out()
예제 #5
0
 def test_check_log(self):
     start_time = time.time()
     PSQL.run_sql_command(
         "SELECT * from some_table_that_does_not_exist_to_generate_errors_in_logs"
     )
     time.sleep(2)
     end_time = time.time()
     self.assertTrue(GpLog.check_log_for_errors(start_time, end_time))
예제 #6
0
 def gather_log(self):
     """
     This method will gather logs from all segments between start_time and end_time
     of the test and write it to an out file in the output directory. The default name
     of the log file will be <testmethodname>.logs
     """
     tinctest.logger.trace_in()
     start_time = self.start_time
     if start_time == 0 or not start_time:
         return
     end_time = self.end_time
     if end_time == 0 or not end_time:
         end_time = time.time()
     out_file = os.path.join(self.get_out_dir(),
                             self._testMethodName + '.logs')
     GpLog.gather_log(start_time, end_time, out_file)
     tinctest.logger.trace_out()
예제 #7
0
파일: mpp_tc.py 프로젝트: 50wu/gpdb
    def inspect_cluster(self):
        """
        This function will inspect the cluster from the start time of this test till now.
        Returns true if there are no errors in logs, False if there are errors in logs.

        @return: Returns True / False depending on whether errors were found in the log
        @rtype: boolean
        """
        tinctest.logger.trace_in()
        start_time = self.start_time
        if start_time == 0 or not start_time:
            return True
        end_time = self.end_time
        if end_time == 0 or not end_time:
            end_time = time.time()

        return_status = not GpLog.check_log_for_errors(start_time, end_time)
        tinctest.logger.trace_out(str(return_status))
        return return_status
예제 #8
0
    def inspect_cluster(self):
        """
        This function will inspect the cluster from the start time of this test till now.
        Returns true if there are no errors in logs, False if there are errors in logs.

        @return: Returns True / False depending on whether errors were found in the log
        @rtype: boolean
        """
        tinctest.logger.trace_in()
        start_time = self.start_time
        if start_time == 0 or not start_time:
            return True
        end_time = self.end_time
        if end_time == 0 or not end_time:
            end_time = time.time()

        return_status = not GpLog.check_log_for_errors(start_time, end_time)
        tinctest.logger.trace_out(str(return_status))
        return return_status
예제 #9
0
 def test_check_log(self):
     start_time = time.time()
     PSQL.run_sql_command("SELECT * from some_table_that_does_not_exist_to_generate_errors_in_logs")
     time.sleep(2)
     end_time = time.time()
     self.assertTrue(GpLog.check_log_for_errors(start_time, end_time))