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)
Beispiel #3
0
 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)
Beispiel #4
0
 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)
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))
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))
Beispiel #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):
Beispiel #8
0
        ``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``.
    """