'A FSM doing convergence that gets a discovery result starts applying
calculated changes using last received desired configuration and
cluster state.'

def test_convergence_done_changes(self):

    local_state = NodeState(hostname=u'192.0.2.123')
    configuration = Deployment()
    received_state = DeploymentState(nodes=[])
    action = ControllableAction(result=Deferred())
    deployer = ControllableDeployer(local_state.hostname, [succeed(local_state)], [action])
    loop = build_convergence_loop_fsm(Clock(), deployer)
    loop.receive(_ClientStatusUpdate(client=self.make_amp_client([local_state]), configuration=configuration, state=received_state))
    expected_local_state = DeploymentState(nodes=[local_state])
    self.assertEqual((deployer.calculate_inputs, action.called), ([(local_state, configuration, expected_local_state)], True))
