コード例 #1
0
def no_such_executable_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """
    assertHasMessage(case, logger, ZFS_ERROR, {
        'status': 1,
        'zfs_command': 'nonsense garbage made up no such command',
        'output': '[Errno 2] No such file or directory'})
    case.assertEqual(len(LoggedMessage.ofType(logger.messages, ZFS_ERROR)), 1)
コード例 #2
0
def error_status_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """
    assertHasMessage(case, logger, ZFS_ERROR, {
        'status': 1,
        'zfs_command': 'python -c raise SystemExit(1)',
        'output': ''})
    case.assertEqual(len(LoggedMessage.ofType(logger.messages, ZFS_ERROR)), 1)
コード例 #3
0
ファイル: test_fsm.py プロジェクト: cyli/machinist
 def assertOutputLogging(self, logger):
     """
     The L{IOutputExecutor} is invoked in the FSM's transition action
     context.
     """
     loggedTransition = LoggedAction.ofType(
         logger.messages, LOG_FSM_TRANSITION)[0]
     loggedAnimal = LoggedMessage.ofType(logger.messages, LOG_ANIMAL)[0]
     self.assertIn(loggedAnimal, loggedTransition.children)
コード例 #4
0
ファイル: test_fsm.py プロジェクト: sashka/machinist
 def assertOutputLogging(self, logger):
     """
     The L{IOutputExecutor} is invoked in the FSM's transition action
     context.
     """
     loggedTransition = LoggedAction.ofType(logger.messages,
                                            LOG_FSM_TRANSITION)[0]
     loggedAnimal = LoggedMessage.ofType(logger.messages, LOG_ANIMAL)[0]
     self.assertIn(loggedAnimal, loggedTransition.children)
コード例 #5
0
def error_status_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """
    errors = LoggedMessage.ofType(logger.messages, ZFS_ERROR)
    assertContainsFields(
        case, errors[0].message,
        {'status': 1,
         'zfs_command': 'python -c raise SystemExit(1)',
         'output': '',
         u'message_type': 'filesystem:zfs:error',
         u'task_level': u'/'})
    case.assertEqual(1, len(errors))
コード例 #6
0
def no_such_executable_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """
    errors = LoggedMessage.ofType(logger.messages, ZFS_ERROR)
    assertContainsFields(
        case, errors[0].message,
        {'status': 1,
         'zfs_command': 'nonsense garbage made up no such command',
         'output': '[Errno 2] No such file or directory',
         u'message_type': 'filesystem:zfs:error',
         u'task_level': u'/'})
    case.assertEqual(1, len(errors))
コード例 #7
0
        exception = ProcessTerminated(99)
        process_protocol.processEnded(Failure(exception))
        self.assertEqual(self.failureResultOf(result).value, exception)


def no_such_executable_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """
    assertHasMessage(
        case, logger, ZFS_ERROR, {
            'status': 1,
            'zfs_command': 'nonsense garbage made up no such command',
            'output': '[Errno 2] No such file or directory'
        })
    case.assertEqual(len(LoggedMessage.ofType(logger.messages, ZFS_ERROR)), 1)


def error_status_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """
    assertHasMessage(case, logger, ZFS_ERROR, {
        'status': 1,
        'zfs_command': 'python -c raise SystemExit(1)',
        'output': ''
    })
    case.assertEqual(len(LoggedMessage.ofType(logger.messages, ZFS_ERROR)), 1)


class SyncCommandTests(SynchronousTestCase):
コード例 #8
0
ファイル: test_filesystems_zfs.py プロジェクト: yilab/flocker
        ``Deferred`` returned from ``zfs_command`` errbacks with
        whatever error the process exited with.
        """
        reactor = FakeProcessReactor()
        result = zfs_command(reactor, [b"-H", b"lalala"])
        process_protocol = reactor.processes[0].processProtocol
        exception = ProcessTerminated(99)
        process_protocol.processEnded(Failure(exception))
        self.assertEqual(self.failureResultOf(result).value, exception)


def no_such_executable_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """
    errors = LoggedMessage.ofType(logger.messages, ZFS_ERROR)
    assertContainsFields(
        case, errors[0].message, {
            'status': 1,
            'zfs_command': 'nonsense garbage made up no such command',
            'output': '[Errno 2] No such file or directory',
            u'message_type': 'filesystem:zfs:error',
            u'task_level': u'/'
        })
    case.assertEqual(1, len(errors))


def error_status_logged(case, logger):
    """
    Validate the error logging behavior of ``_sync_command_error_squashed``.
    """