'Verify that an error from ``IDeployer.discover_state`` does not prevent
a subsequent loop iteration from re-trying state discovery.
:param logger: The ``MemoryLogger`` where log messages are going.
:param error: The first state to pass to the
``ControllableDeployer``, a ``CustomException`` or a ``Deferred``
that fails with ``CustomException``.'

def _discover_state_error_test(self, logger, error):

    local_state = NodeState(hostname=u'192.0.1.2')
    configuration = Deployment(nodes=frozenset([to_node(local_state)]))
    state = DeploymentState(nodes=[local_state])
    client = self.make_amp_client([local_state])
    local_states = [error, succeed(local_state)]
    actions = [no_action(), no_action()]
    deployer = ControllableDeployer(hostname=local_state.hostname, local_states=local_states, calculated_actions=actions)
    reactor = Clock()
    loop = build_convergence_loop_fsm(reactor, deployer)
    self.patch(loop, 'logger', logger)
    loop.receive(_ClientStatusUpdate(client=client, configuration=configuration, state=state))
    reactor.advance(_UNCONVERGED_DELAY)
    self.assertEqual([(NodeStateCommand, dict(state_changes=(local_state,)))], client.calls)
