Exemplo n.º 1
0
    def test_record_output_log_non_capturemode(self):
        # stdout/stderr goes to the process log and the main log,
        # in non-capturemode, the data length doesn't matter
        options = DummyOptions()
        from supervisor import loggers

        options.loglevel = loggers.LevelsByName.TRAC
        config = DummyPConfig(options, "process1", "/bin/process1", stdout_logfile="/tmp/foo")
        process = DummyProcess(config)
        dispatcher = self._makeOne(process)
        dispatcher.output_buffer = "a"
        dispatcher.record_output()
        self.assertEqual(dispatcher.childlog.data, ["a"])
        self.assertEqual(options.logger.data[0], "'process1' stdout output:\na")
        self.assertEqual(dispatcher.output_buffer, "")
Exemplo n.º 2
0
 def test_record_output_log_non_capturemode(self):
     # stdout/stderr goes to the process log and the main log,
     # in non-capturemode, the data length doesn't matter
     options = DummyOptions()
     from supervisor import loggers
     options.loglevel = loggers.LevelsByName.TRAC
     config = DummyPConfig(options, 'process1', '/bin/process1',
                           stdout_logfile='/tmp/foo')
     process = DummyProcess(config)
     dispatcher = self._makeOne(process)
     dispatcher.output_buffer = 'a'
     dispatcher.record_output()
     self.assertEqual(dispatcher.childlog.data, ['a'])
     self.assertEqual(options.logger.data[0],
          "'process1' stdout output:\na")
     self.assertEqual(dispatcher.output_buffer, '')
Exemplo n.º 3
0
 def test_record_output_log_non_capturemode(self):
     # stdout/stderr goes to the process log and the main log,
     # in non-capturemode, the data length doesn't matter
     options = DummyOptions()
     from supervisor import loggers
     options.loglevel = loggers.LevelsByName.TRAC
     config = DummyPConfig(options, 'process1', '/bin/process1',
                           stdout_logfile=os.path.join(tempfile.gettempdir(), 'foo.txt'))
     process = DummyProcess(config)
     dispatcher = self._makeOne(process)
     dispatcher.output_buffer = 'a'
     dispatcher.record_output()
     self.assertEqual(dispatcher.childlog.data, ['a'])
     self.assertEqual(options.logger.data[0],
                      "'process1' stdout output:\na")
     self.assertEqual(dispatcher.output_buffer, '')
Exemplo n.º 4
0
    def test_record_output_capturemode_string_longer_than_token(self):
        # stdout/stderr goes to the process log and the main log,
        # in capturemode, the length of the data needs to be longer
        # than the capture token to make it out.
        options = DummyOptions()
        from supervisor import loggers

        options.loglevel = loggers.LevelsByName.TRAC
        config = DummyPConfig(
            options, "process1", "/bin/process1", stdout_logfile="/tmp/foo", stdout_capture_maxbytes=100
        )
        process = DummyProcess(config)
        dispatcher = self._makeOne(process)
        dispatcher.output_buffer = "stdout string longer than a token"
        dispatcher.record_output()
        self.assertEqual(dispatcher.childlog.data, ["stdout string longer than a token"])
        self.assertEqual(options.logger.data[0], "'process1' stdout output:\nstdout string longer than a token")
Exemplo n.º 5
0
 def test_record_output_capturemode_string_longer_than_token(self):
     # stdout/stderr goes to the process log and the main log,
     # in capturemode, the length of the data needs to be longer
     # than the capture token to make it out.
     options = DummyOptions()
     from supervisor import loggers
     options.loglevel = loggers.LevelsByName.TRAC
     config = DummyPConfig(options, 'process1', '/bin/process1',
                           stdout_logfile='/tmp/foo',
                           stdout_capture_maxbytes=100)
     process = DummyProcess(config)
     dispatcher = self._makeOne(process)
     dispatcher.output_buffer = 'stdout string longer than a token'
     dispatcher.record_output()
     self.assertEqual(dispatcher.childlog.data,
                      ['stdout string longer than a token'])
     self.assertEqual(options.logger.data[0],
          "'process1' stdout output:\nstdout string longer than a token")